Commit Graph

179 Commits

Author SHA1 Message Date
Alex Crichton
ce6e967eeb Add a CLI option for module linking (#2524)
* Add a CLI option for module linking

Forgot to add this earlier!

* Always apt-get update before install
2020-12-18 14:12:02 -06:00
Louis Pilfold
26b6074420 Download precompiled cargo deny 2020-12-17 13:55:48 +00:00
Louis Pilfold
b4283c514f cargo deny runs on CI 2020-12-17 11:42:41 +00:00
Chris Fallin
2cec20aa57 Merge pull request #2486 from cfallin/fix-probestack
Two Lucet-related fixes to stack overflow handling.
2020-12-07 16:47:37 -08:00
Chris Fallin
3a01d14712 Two Lucet-related fixes to stack overflow handling.
Lucet uses stack probes rather than explicit stack limit checks as
Wasmtime does. In bytecodealliance/lucet#616, I have discovered that I
previously was not running some Lucet runtime tests with the new
backend, so was missing some test failures due to missing pieces in the
new backend.

This PR adds (i) calls to probestack, when enabled, in the prologue of
every function with a stack frame larger than one page (configurable via
flags); and (ii) trap metadata for every instruction on x86-64 that can
access the stack, hence be the first point at which a stack overflow is
detected when the stack pointer is decremented.
2020-12-07 16:08:53 -08:00
Chris Fallin
04e3730ba6 Update to a CentOS 7 docker container for binary compatible builds.
CentOS 6 just went EOL at the end of November 2020; as of today, the
repository seems to have disappeared, so our CI builds are failing. This
PR updates us to CentOS 7, which should be usable until June 30, 2024.
2020-12-02 09:58:12 -08:00
Pat Hickey
f7a0d86c64 install-openvino: typo 2020-11-20 11:22:52 -08:00
Pat Hickey
fb68c80420 install-openvino: make it easier to invoke on your local machine
put the default version in the shell script, not the yml.
write any files to the directory where the action lives,
and .gitignore them.
2020-11-19 15:23:07 -08:00
Andrew Brown
a61f068c64 Add an initial wasi-nn implementation for Wasmtime (#2208)
* Add an initial wasi-nn implementation for Wasmtime

This change adds a crate, `wasmtime-wasi-nn`, that uses `wiggle` to expose the current state of the wasi-nn API and `openvino` to implement the exposed functions. It includes an end-to-end test demonstrating how to do classification using wasi-nn:
 - `crates/wasi-nn/tests/classification-example` contains Rust code that is compiled to the `wasm32-wasi` target and run with a Wasmtime embedding that exposes the wasi-nn calls
 - the example uses Rust bindings for wasi-nn contained in `crates/wasi-nn/tests/wasi-nn-rust-bindings`; this crate contains code generated by `witx-bindgen` and eventually should be its own standalone crate

* Test wasi-nn as a CI step

This change adds:
 - a GitHub action for installing OpenVINO
 - a script, `ci/run-wasi-nn-example.sh`, to run the classification example
2020-11-16 12:54:00 -06:00
Alex Crichton
d2daf5064e Get lightbeam compiling on stable Rust (#2370)
This will hopefully remove a small thorn in our side with periodic
nightly breakage due to nightly features changing. This commit moves
lightbeam to stable Rust, swapping out `staticvec` for `arrayvec` and
otherwise updating some dependencies (namely `dynasm`) to compile with
stable.

This then also updates CI appropriately to not use a pinned nightly and
instead us a floating `nightly` channel so we can head off any breakage
coming up ASAP.
2020-11-06 13:23:08 -06:00
Alex Crichton
ead53b88c3 Update nightly used on CI for testing
Pull in a Cargo fix for flaky failures using `-Zpackage-features`
2020-11-02 18:30:58 -08:00
Andrew Brown
6d50099816 Rewrite interpreter generically (#2323)
* Rewrite interpreter generically

This change re-implements the Cranelift interpreter to use generic values; this makes it possible to do abstract interpretation of Cranelift instructions. In doing so, the interpretation state is extracted from the `Interpreter` structure and is accessed via a `State` trait; this makes it possible to not only more clearly observe the interpreter's state but also to interpret using a dummy state (e.g. `ImmutableRegisterState`). This addition made it possible to implement more of the Cranelift instructions (~70%, ignoring the x86-specific instructions).

* Replace macros with closures
2020-11-02 12:28:07 -08:00
Alex Crichton
b73b831892 Replace binaryen -ttf based fuzzing with wasm-smith (#2336)
This commit removes the binaryen support for fuzzing from wasmtime,
instead switching over to `wasm-smith`. In general it's great to have
what fuzzing we can, but our binaryen support suffers from a few issues:

* The Rust crate, binaryen-sys, seems largely unmaintained at this
  point. While we could likely take ownership and/or send PRs to update
  the crate it seems like the maintenance is largely on us at this point.

* Currently the binaryen-sys crate doesn't support fuzzing anything
  beyond MVP wasm, but we're interested at least in features like bulk
  memory and reference types. Additionally we'll also be interested in
  features like module-linking. New features would require either
  implementation work in binaryen or the binaryen-sys crate to support.

* We have 4-5 fuzz-bugs right now related to timeouts simply in
  generating a module for wasmtime to fuzz. One investigation along
  these lines in the past revealed a bug in binaryen itself, and in any
  case these bugs would otherwise need to get investigated, reported,
  and possibly fixed ourselves in upstream binaryen.

Overall I'm not sure at this point if maintaining binaryen fuzzing is
worth it with the advent of `wasm-smith` which has similar goals for
wasm module generation, but is much more readily maintainable on our
end.

Additonally in this commit I've added a fuzzer for wasm-smith's
`SwarmConfig`-based fuzzer which should expand the coverage of tested
modules.

Closes #2163
2020-10-29 10:02:59 -05:00
Nick Fitzgerald
9fe900ae89 CI: upload built peepholes as artifacts
For people who can't build Z3, this lets them update the peephole optimizers
when necessary.
2020-10-27 13:02:17 -07:00
Till Schneidereit
fc1cedb2ff Add docs.wasmtime.dev as a CNAME for the Wasmtime docs (#2317)
* Update version of mdbook used in CI

* Configure cname for wasmtime docs
2020-10-25 15:48:20 -05:00
Nick Fitzgerald
4f104d3a4e CI: fix rebuilding peepmatic peephole optimizers (#2311)
The test that triggers the rebuild of the peephole optimizers is in the
`cranelift-codegen` crate, not the umbrella cranelift crate. This was previously
successfully running zero tests, and then successfully reporting no `git diff`
because no peephole optimizers were ever rebuilt.

This change fixes it so that we run the correct test that triggers the
rebuilding of the peephole optimizers.
2020-10-22 12:39:40 -05:00
Alex Crichton
e22e2c3722 Update Github Actions CI set-env/add-path (#2265)
In accordance with [this
advisory](https://github.blog/changelog/2020-10-01-github-actions-deprecating-set-env-and-add-path-commands/)
it's recommended we moved to a different scheme of setting env vars and
updating PATH.
2020-10-05 15:08:56 -05:00
Chris Fallin
e71d4fdbb8 Add ARM32 build test to CI.
We do not yet want to gate our CI on tests passing, because the backend
is only partially complete; but we want to make sure that it remains
up-to-date as we change internal APIs.
2020-10-02 12:48:22 -07:00
Benjamin Bouvier
d7fda6ac0e Update subscribe-to-label.json 2020-10-02 10:18:25 +02:00
Benjamin Bouvier
b684384986 Reenable the new backend x64 CI;
The intermittent failure have likely been fixed by a recent round of
general fixes in the new x64 backend. This basically reverts
https://github.com/bytecodealliance/wasmtime/pull/2100 and uses the CI
script there.
2020-09-23 16:42:03 +02:00
Nick Fitzgerald
d32b2c82f8 CI: Don't enforce builds work with rustc 1.43.0 for clif-util
`clif-util` doesn't get used in SpiderMonkey, so it doesn't need to work with
rustc 1.43.0.
2020-09-15 09:39:43 -07:00
Nick Fitzgerald
443965b95d Create a crate for converting Souper optimizations into Peepmatic DSL
This crate is currently empty but is hooked up to our CI, the cargo workspace,
our publish script, etc.
2020-09-10 16:06:30 -07:00
Chris Fallin
3775276050 Update minimum Rust version in CI to 1.43.0.
Firefox currently requires vendored Rust code (including Cranelift) to
compile on Rust 1.43.0, according to this line:

https://searchfox.org/mozilla-central/rev/eb9d5c97927aea75f0c8e38bbc5b5d288099e687/python/mozboot/mozboot/util.py#16

Whenever that version is updated, we can bump this CI check's Rust
version accordingly.
2020-09-10 15:29:07 -07:00
Pat Hickey
f3f6127217 maybe try nightly 08-25? 2020-09-02 11:17:54 -07:00
Pat Hickey
e98f136adb pin nightly toolchain to 2020-08-30 - staticvec is broken with 09-01 2020-09-02 11:12:08 -07:00
Alex Crichton
693c6ea771 wasmtime: Extract cranelift/lightbeam compilers to separate crates (#2117)
This commit extracts the two implementations of `Compiler` into two
separate crates, `wasmtime-cranelfit` and `wasmtime-lightbeam`. The
`wasmtime-jit` crate then depends on these two and instantiates them
appropriately. The goal here is to start reducing the weight of the
`wasmtime-environ` crate, which currently serves as a common set of
types between all `wasmtime-*` crates. Long-term I'd like to remove the
dependency on Cranelift from `wasmtime-environ`, but that's going to
take a lot more work.

In the meantime I figure it's a good way to get started by separating
out the lightbeam/cranelift function compilers from the
`wasmtime-environ` crate. We can continue to iterate on moving things
out in the future, too.
2020-08-20 11:34:31 +02:00
Alex Crichton
7fdbd081e6 Switch back to nightly channel for testing (#2116)
I believe the staticvec issues should be resolved now!
2020-08-17 15:16:12 +02:00
Chris Fallin
ebf847eb28 Temporarily disable new x64 backend CI. (#2100)
This CI test has been intermittently failing, which is causing issues
with other PRs. We should turn it back off until we can work out why the
intermittent failures are occuring.
2020-08-05 11:58:46 -05:00
Benjamin Bouvier
79abcdb035 machinst x64: add testing to the CI; 2020-07-30 10:32:00 +02:00
Benjamin Bouvier
2c1d370465 CI: use fixed version of Rust nightly following build failures in staticvec 2020-07-28 12:29:49 +02:00
Chris Fallin
96ef2f1a1b Fix u8::MAX -> std::u8::MAX. (#2047)
As per Carlo Kok on Zulip #cranelift, this breaks builds with stable
Rust pre-1.43, as `core::u8::MAX` was only stabilized then. We'd like to
support older versions if we can easily do so.

This PR also adds `cranelift-tools` to the crates checked on CI with
Rust 1.41.0, which pulls in all backends (including `aarch64`).
2020-07-20 14:59:15 -05:00
Nick Fitzgerald
ee5982fd16 peepmatic: Be generic over the operator type
This lets us avoid the cost of `cranelift_codegen::ir::Opcode` to
`peepmatic_runtime::Operator` conversion overhead, and paves the way for
allowing Peepmatic to support non-clif optimizations (e.g. vcode optimizations).

Rather than defining our own `peepmatic::Operator` type like we used to, now the
whole `peepmatic` crate is effectively generic over a `TOperator` type
parameter. For the Cranelift integration, we use `cranelift_codegen::ir::Opcode`
as the concrete type for our `TOperator` type parameter. For testing, we also
define a `TestOperator` type, so that we can test Peepmatic code without
building all of Cranelift, and we can keep them somewhat isolated from each
other.

The methods that `peepmatic::Operator` had are now translated into trait bounds
on the `TOperator` type. These traits need to be shared between all of
`peepmatic`, `peepmatic-runtime`, and `cranelift-codegen`'s Peepmatic
integration. Therefore, these new traits live in a new crate:
`peepmatic-traits`. This crate acts as a header file of sorts for shared
trait/type/macro definitions.

Additionally, the `peepmatic-runtime` crate no longer depends on the
`peepmatic-macro` procedural macro crate, which should lead to faster build
times for Cranelift when it is using pre-built peephole optimizers.
2020-07-17 16:16:49 -07:00
Nick Fitzgerald
ae95ad8733 cranelift: Don't build peepmatic-based optimizations in build.rs
Instead, when the `rebuild-peephole-optimizers` feature is enabled, rebuild them
the first time they are used. This allows peepmatic to run when Cranelift's
`Opcode` is defined and available, which paves the way forward for:

* merging `peepmatic_runtime::operator::Operator` and Cranelift's `Opcode` (we
  are wasting a bunch of cycles converting between the two of them), and

* supporting vcode optimizations in `peepmatic`.
2020-07-17 14:35:16 -07:00
Alex Crichton
978070c020 Verify crates are publish-able on CI (#2036)
This commit updates our CI to verify that all crates are publish-able at
all times on every commit. During the 0.19.0 release we found another
case where the crates as they live in this repository weren't
publish-able, so the hope is that this no longer comes up again!

The script added in this commit also takes the time/liberty to remove
the existing bump/publish scripts and instead replace them with one Rust
script originally sourced from wasm-bindgen. The intention of this
script is that it has three modes:

* `./publish bump` - bumps version numbers which are sent as a PR to get
  reviewed (probably with a changelog as well)

* `./publish verify` - run on CI on every commit, builds every crate we
  publish as if it's being published to crates.io, notably without raw
  access to other crates in the repository.

* `./publish publish` - publishes all crates to crates.io, passing the
  `--no-verify` flag to make this a much speedier process than it is
  today.
2020-07-17 16:19:35 -05:00
Alex Crichton
85ffc8f595 Switch CI back to nightly channel (#2014)
* Switch CI back to nightly channel

I think all upstream issues are now fixed so we should be good to switch
back to nightly from our previously pinned version.

* Fix doc warnings
2020-07-13 18:40:47 -05:00
Nick Fitzgerald
2040a654d6 CI: collect backtraces for example tests 2020-07-10 13:37:24 -07:00
Alex Crichton
d72b330de2 Add support for documenting the C API (#1928)
This commit adds a bit of a skeleton of what it might look like to
document the C API. Today the C API has virtually zero documentation
because the upstream documentation does not exist and we haven't put a
ton of effort into documenting our own extensions. Given that this is
one of the main vectors we expect users to use Wasmtime, we should make
sure it's thoroughly documented!

I've never really done much documentation generation of C myself before,
but I did a bit of searching and Doxygen seems reasonable proficient for
doing this. This commit sets up what it might look like for Doxygen to
be used for the C API. One nice feature of DOxygen is that we can
document the items in `wasm.h` without actually modifying `wasm.h`. For
those purposes a `doc-wasm.h` file was added here which is where we can
put Wasmtime-specific documentation about `wasm.h`.

There's quite a few functions in the C API so I didn't want to get them
all done before getting consensus on this. I've started some skeletons
of documentation for global types in `wasm.h` and also confirmed that
documentation works for our own `wasmtime.h` and such header files. If
this looks good to everyone and it runs reasonable well on CI then I can
spend more time filling out the rest of the documentation.
2020-07-01 14:05:18 -05:00
Alex Crichton
0acd2072c2 Fix doc warnings and link failures (#1948)
Also add configuration to CI to fail doc generation if any links are
broken. Unfortunately we can't blanket deny all warnings in rustdoc
since some are unconditional warnings, but for now this is hopefully
good enough.

Closes #1947
2020-06-30 13:01:49 -05:00
Alex Crichton
a92a31d850 Rename the master branch to main (#1924)
* This PR is against a branch called `main`
* Internally all docs/CI/etc is updated
* The default branch of the repo is now `main`
* All active PRs have been updated to retarget `main`

Closes #1914
2020-06-25 14:03:21 -05:00
Nick Fitzgerald
ab80107dfb CI: use cargo fuzz 0.8.X
It has switched to release+debug assertion builds by default, so pass `--dev` to
avoid compiling with optimizations.
2020-06-25 10:01:23 -07:00
Alex Crichton
06a69d18fa Disable static memory under QEMU on CI (#1895)
* Enable the spec::simd::simd_align test for AArch64

Copyright (c) 2020, Arm Limited.

* Disable static memory under QEMU on CI

This commit disables the usage of "static" memory on CI and instead
forces all memories to be "dynamic" meaning that they reserve much
smaller chunks of memory. This causes the QEMU process's memory to
drastically drop (10GiB -> 600MiB) and should allow us to keep enabling
tests without hitting the OOM killer on CI.

Closes #1871 (includes that)
Closes #1893

* Fix typo

Co-authored-by: Anton Kirilov <anton.kirilov@arm.com>
2020-06-17 21:05:21 -05:00
Benjamin Bouvier
eb548e263d machinst: label ISA-specific changes as such (#1879) 2020-06-17 15:15:14 +02:00
Alex Crichton
9a1a0abc48 Pin nightlies to previous night (#1873)
* Pin nightlies to previous night

Fixes some upstream breakage in rust-lang/rust which should get fixed
tomorrow.

* fix-0.65

Co-authored-by: Yury Delendik <ydelendik@mozilla.com>
2020-06-12 12:35:08 -05:00
Chris Fallin
cdbe76a1d4 Remove uses of matches!() macro, incompatible with Firefox build.
When we vendor Cranelift into Firefox, we need to be able to build with
the Firefox CI setup (unless we carry patches on top of upstream).
Unfortunately, the Firefox CI currently appears to build with a slightly
older version of Rust: I can't work out which version exactly, but one
without stable support for `matches!()`.

A recent attempt to version-bump Cranelift failed with build errors at
the two locations in this patch:

https://treeherder.mozilla.org/logviewer.html#/jobs?job_id=305994046&repo=autoland&lineNumber=24829

I also see a bunch of uses of `matches!()` in Peepmatic, but those
crates are not built by Firefox, so we can leave them be for now, I
think.
2020-06-11 15:11:10 -07:00
Yury Delendik
70424037c3 Refactor debug library to use object:🧝:* (#1860)
* Add GDB test

* rm stray test resource

* use object:🧝:* structures

* install gdb on CI
2020-06-11 13:53:38 -05:00
Chris Fallin
5c7e6e6e9a Update from qemu 4.2.0 to qemu 5.0.0 for emulation-based CI jobs. 2020-06-05 12:52:00 -07:00
Alex Crichton
5a8afd4540 Pin nightlies to fix lightbeam compilation (#1818)
Looks like lightbeam's nightly dependencies don't compile on the most
recent nightly. For now let's pin nightlies to get CI green.
2020-06-04 11:32:49 -05:00
Alex Crichton
16afca4451 Update the checkout action to v2 (#1791)
I think this pulls in a few nice updates like depth 0 cloning, better
logs, etc. In any case seems good to update while we can!
2020-05-29 16:52:30 -05:00
Nick Fitzgerald
5c39b74eb8 Make the fuzzing CI job faster (#1727)
* CI: Only build fuzz targets, don't run them over the corpora

We've only ever caught a single potential regression by running the fuzz targets
over a sample of their corpora. However, this is also our slowest CI
job. Running the fuzz targets over their corpora simply isn't paying for itself.

Instead, just ensure that we can build the fuzz targets with `cargo fuzz` and
all of the libFuzzer and sanitizer instrumentation that it enables. This will
ensure that we don't break the fuzz targets, and we leave finding regressions in
the fuzz corpora to oss-fuzz.

* fuzz: feature gate peepmatic's fuzz targets

This makes it so that the CI's fuzz target-building job doesn't build peepmatic,
and transitively Z3.
2020-05-19 15:27:52 -05:00
Nick Fitzgerald
463734b002 CI: only test peepmatic in one job (#1714)
* CI: only test `peepmatic` in one job

This avoids building Z3 in most jobs, which saves CI time.

* Fix curl syntax on Windows

Co-authored-by: Alex Crichton <alex@alexcrichton.com>
2020-05-15 21:16:16 -05:00