Commit Graph

8743 Commits

Author SHA1 Message Date
Nick Fitzgerald
33a9384bfe Add notes for 2021-08-09 Cranelift meeting 2021-08-09 09:25:03 -07:00
Till Schneidereit
2de091eb99 Add stub agendas for Wasmtime and Cranelift project meetings through mid-December (#3167) 2021-08-09 11:50:44 +02:00
Till Schneidereit
13b9ce8902 Add notes for 21-08-05 wasmtime meeting (#3165) 2021-08-09 11:22:36 +02:00
Afonso Bordado
8862499529 cranelift: Fix trampoline args for b1 types
Our DataValues only have one size of booleans so we are always going to
have this mismatch of sizes
2021-08-08 17:42:50 +01:00
Chris Fallin
9c550fcf41 Merge pull request #3128 from sparker-arm/aarch64-atomics
Re-implement AArch64 atomic load and stores
2021-08-06 14:38:25 -07:00
Alex Crichton
480dff21e8 fuzz: Disable more features for spectests fuzzer (#3159)
The previous commit to eanble multi-memory and simd leaked into the
spectest fuzzer, but to pass the spec tests we can't enable these features.
2021-08-06 16:27:42 -05:00
Chris Fallin
ca6325f06c Merge pull request #3162 from jlb6740/cranelift-meeting-8-9-agenda-update-jlb6740
cranelift-meeting-8-9-agenda-update - Discuss approach to SIMD loweri…
2021-08-06 13:45:32 -07:00
Johnnie Birch
ce3a0f1185 cranelift-meeting-8-9-agenda-update - Discuss approach to SIMD lowering when fixing latest fuzzing bugs 2021-08-06 12:09:18 -07:00
Alex Crichton
33c3d00f10 Remove rss prediction from api_calls fuzzer (#3156)
This functionality is now subsumed by the limiter built-in to all
fuzzing stores, so there's no longer any need for it. It was also
triggering arithmetic overflows in fuzzing, so instead of fixing I'm
removing it!
2021-08-06 12:43:22 -05:00
Nick Fitzgerald
e5ef1455a3 Merge pull request #3157 from alexcrichton/centralize-error-handling
fuzz: Centralize handling instantiation errors
2021-08-06 10:38:48 -07:00
Alex Crichton
45896e0533 Decrease memory limit in fuzzing to 1gb (#3155)
This should keep us under the default 2gb limit when fuzzing
2021-08-06 12:28:49 -05:00
Alex Crichton
ee3ff52661 Refactor cranelift immediates slightly
I've run up against the `Into`-vs-`From` impls a few times and figured
I'd go ahead and put up a refactoring. This switches `Into` impls into
`From` impls which allows using both traits instead of just the `Into`
version. Additionally this removes a few small `as` casts in favor of
infallible `from`/`into` or `try_from` with error handling.
2021-08-06 09:14:25 -07:00
Alex Crichton
3bdf6c7a48 fuzz: Centralize handling instantiation errors
At the same time remove some string matching in favor of checking for
oom explicitly.
2021-08-06 07:47:28 -07:00
Alex Crichton
bb85366a3b Enable simd fuzzing on oss-fuzz (#3152)
* Enable simd fuzzing on oss-fuzz

This commit generally enables the simd feature while fuzzing, which
should affect almost all fuzzers. For fuzzers that just throw random
data at the wall and see what sticks, this means that they'll now be
able to throw simd-shaped data at the wall and have it stick. For
wasm-smith-based fuzzers this commit also updates wasm-smith to 0.6.0
which allows further configuring the `SwarmConfig` after generation,
notably allowing `instantiate-swarm` to generate modules using simd
using `wasm-smith`. This should much more reliably feed simd-related
things into the fuzzers.

Finally, this commit updates wasmtime to avoid usage of the general
`wasm_smith::Module` generator to instead use a Wasmtime-specific custom
default configuration which enables various features we have
implemented.

* Allow dummy table creation to fail

Tables might creation for imports may exceed the memory limit on the
store, which we'll want to gracefully recover from and not fail the
fuzzers.
2021-08-05 16:24:42 -05:00
Alex Crichton
214c5f862d fuzz: Implement finer memory limits per-store (#3149)
* fuzz: Implement finer memory limits per-store

This commit implements a custom resource limiter for fuzzing. Locally I
was seeing a lot of ooms while fuzzing and I believe it was generally
caused from not actually having any runtime limits for wasm modules. I'm
actually surprised that this hasn't come up more on oss-fuzz more in
reality, but with a custom store limiter I think this'll get the job
done where we have an easier knob to turn for controlling the memory
usage of fuzz-generated modules.

For now I figure a 2gb limit should be good enough for limiting fuzzer
execution. Additionally the "out of resources" check if instantiation
fails now looks for the `oom` flag to be set instead of pattern matching
on some error messages about resources.

* Fix tests
2021-08-05 15:07:33 -05:00
Chris Fallin
2c70d1d6f6 Merge pull request #3151 from cfallin/cranelift-meeting-20210809
Add agenda for Cranelift meeting on 2021-08-09.
2021-08-05 12:39:28 -07:00
Alex Crichton
d8c4ac2c25 Improve output of expectation failures of the wast commands (#3150)
This commit updates the output of failed expectations in the `wast`
crate to fold in the check-is-the-value-the-same with the
generate-a-nice-message. Additionally this tries to make sure that
everything is aligned in the output to make it a bit more easily
readable. Vectors should notably be improved where lane differences can
be compared vertically in the case of integers and printed out
specifically in the case of floats.
2021-08-05 14:31:55 -05:00
Chris Fallin
2b51f75e78 Add agenda for Cranelift meeting on 2021-08-09. 2021-08-05 12:17:31 -07:00
Alex Crichton
c6b095f9a3 cranelift: Implement nan canonicalization for vectors (#3146)
This fixes some fuzz bugs that came about enabling simd where nan
canonicalization is performed on the fuzzers but cranelift would panic
on these ops for vectors. This adds some custom codegen with `bitselect`
to ensure any nan lanes are canonical-nan lanes in the canonicalized
operations.
2021-08-05 13:44:16 -05:00
Alex Crichton
9e142f8792 Fix some warnings on nightly Rust (#3148)
Looks like these trailing-semicolons-in-macros are likely to become a
hard error in the future, so this updates to remove them as necessary.
2021-08-05 13:02:44 -05:00
Alex Crichton
4cfa031c5f Implement API support for v128-globals (#3147)
Found via fuzzing, and looks like these were accidentally left out along
the way SIMD was taking shape.
2021-08-05 13:02:34 -05:00
Till Schneidereit
79638791fd Add information for Cranelift and Wasmtime project meetings (#3145) 2021-08-05 16:37:36 +02:00
Sam Parker
b6f6ac116a Revert IR changes
Along with the x64 and s390x changes. Now pattern matching the
uextend(atomic_load) in the aarch64 backend.
2021-08-05 09:35:32 +01:00
Sam Parker
cbb7229457 Re-implement atomic load and stores
The AArch64 support was a bit broken and was using Armv7 style
barriers, which aren't required with Armv8 acquire-release
load/stores.

The fallback CAS loops and RMW, for AArch64, have also been updated
to use acquire-release, exclusive, instructions which, again, remove
the need for barriers. The CAS loop has also been further optimised
by using the extending form of the cmp instruction.

Copyright (c) 2021, Arm Limited.
2021-08-05 09:08:08 +01:00
Alex Crichton
85f16f488d Consolidate address calculations for atomics (#3143)
* Consolidate address calculations for atomics

This commit consolidates all calcuations of guest addresses into one
`prepare_addr` function. This notably remove the atomics-specifics paths
as well as the `prepare_load` function (now renamed to `prepare_addr`
and folded into `get_heap_addr`).

The goal of this commit is to simplify how addresses are managed in the
code generator for atomics to use all the shared infrastrucutre of other
loads/stores as well. This additionally fixes #3132 via the use of
`heap_addr` in clif for all operations.

I also added a number of tests for loads/stores with varying alignments.
Originally I was going to allow loads/stores to not be aligned since
that's what the current formal specification says, but the overview of
the threads proposal disagrees with the formal specification, so I
figured I'd leave it as-is but adding tests probably doesn't hurt.

Closes #3132

* Fix old backend

* Guarantee misalignment checks happen before out-of-bounds
2021-08-04 15:57:56 -05:00
Alex Crichton
91d24b8448 Fix pooling tests on high-cpu-count systems (#3141)
This commit fixes an issue where `cargo test` was failing pretty
reliably on an 80-thread system where many of the pooling tests would
fail in `mmap` to reserve address space for the linear memories
allocated for a pooling allocator. Each test wants to reserve about 6TB
of address space, and if we let 80 tests do that apparently Linux
doesn't like that and starts returning errors from `mmap`.

The implementation here is a relatively simple semaphore-lookalike
which allows a fixed amount of concurrency in pooling tests.
2021-08-04 11:55:52 -05:00
Alex Crichton
8e06b78177 Update the spec test suite submodule (#3142)
Mostly just updating it to HEAD, no major changes here expected.
2021-08-04 11:12:39 -05:00
Alex Crichton
a33caec9be Bump the wasm-tools crates (#3139)
* Bump the wasm-tools crates

Pulls in some updates here and there, mostly for updating crates to the
latest version to prepare for later memory64 work.

* Update lightbeam
2021-08-04 09:53:47 -05:00
Chris Fallin
9419d635c6 Merge pull request #3138 from sparker-arm/aarch64-extadd-pairwise
Enable simd_X_extadd_pairwise_X for AArch64
2021-08-03 15:47:48 -07:00
Sam Parker
3bc2f0c701 Enable simd_X_extadd_pairwise_X for AArch64
Lower to [u|s]addlp for AArch64.

Copyright (c) 2021, Arm Limited.
2021-08-03 10:25:09 +01:00
Chris Fallin
d551997657 Merge pull request #3137 from cfallin/release-0.29-date
Adjust date of v0.29 release in RELEASES.md to today.
2021-08-02 17:43:47 -07:00
Chris Fallin
4dfb0a6138 Adjust date of v0.29 release in RELEASES.md to today.
This was a bit of an oversight in the relnotes updates for the
just-released v0.29: since the release PR was prepared a few days before
the actual release, I should have updated the "released on" date in
RELEASES.md (oops!). I don't think it's a big enough deal to re-roll
anything but we should have the correct date in the version on `main`.
2021-08-02 16:44:16 -07:00
Chris Fallin
81f1dc944f Merge pull request #3123 from cfallin/release-0.29
Bump to Wasmtime v0.29.0 and Cranelift 0.76.0.
2021-08-02 13:08:58 -07:00
Chris Fallin
a13a777230 Bump to Wasmtime v0.29.0 and Cranelift 0.76.0. 2021-08-02 11:24:09 -07:00
Chris Fallin
07cafd73df Update RELEASES.md with last PRs for 0.29. 2021-08-02 11:24:09 -07:00
Alex Crichton
a9b6dfee93 Update release notes. 2021-08-02 11:18:28 -07:00
Alex Crichton
63a3bbbf5a Change VMMemoryDefinition::current_length to usize (#3134)
* Change VMMemoryDefinition::current_length to `usize`

This commit changes the definition of
`VMMemoryDefinition::current_length` to `usize` from its previous
definition of `u32`. This is a pretty impactful change because it also
changes the cranelift semantics of "dynamic" heaps where the bound
global value specifier must now match the pointer type for the platform
rather than the index type for the heap.

The motivation for this change is that the `current_length` field (or
bound for the heap) is intended to reflect the current size of the heap.
This is bound by `usize` on the host platform rather than `u32` or`
u64`. The previous choice of `u32` couldn't represent a 4GB memory
because we couldn't put a number representing 4GB into the
`current_length` field. By using `usize`, which reflects the host's
memory allocation, this should better reflect the size of the heap and
allows Wasmtime to support a full 4GB heap for a wasm program (instead
of 4GB minus one page).

This commit also updates the legalization of the `heap_addr` clif
instruction to appropriately cast the address to the platform's pointer
type, handling bounds checks along the way. The practical impact for
today's targets is that a `uextend` is happening sooner than it happened
before, but otherwise there is no intended impact of this change. In the
future when 64-bit memories are supported there will likely need to be
fancier logic which handles offsets a bit differently (especially in the
case of a 64-bit memory on a 32-bit host).

The clif `filetest` changes should show the differences in codegen, and
the Wasmtime changes are largely removing casts here and there.

Closes #3022

* Add tests for memory.size at maximum memory size

* Add a dfg helper method
2021-08-02 13:09:40 -05:00
Chris Fallin
87fefd8a21 Merge pull request #3031 from jlb6740/extend-add-pairwise-x64
Add extend-add-pairwise instructions x64
2021-07-31 21:14:49 -07:00
Johnnie Birch
e519fca61c Refactor and turn on lowering for extend-add-pairwise 2021-07-31 10:52:39 -07:00
Johnnie Birch
e373ddfe1b Add extend-add-pairwise instructions x64 2021-07-30 15:06:58 -07:00
Andrew Brown
26c78c06ef refactor: remove unused field
PR #3131 fixed the failing builds by allowing this field to be dead.
After looking at it further the field is not being used and can be
removedi completely.
2021-07-30 10:58:37 -07:00
Alex Crichton
4632b6a816 Fix warning on new-stable (#3131)
One of the fields of `TargetIsa` isn't used in the
cranelift-codegen-meta crate, but instead of refactoring to try to
remove it this just adds `#[allow(dead_code)]` for now in the assumption
that when the old backends go away this will probably go away as well.
2021-07-30 11:13:21 -05:00
Chris Fallin
535b3a47ee Merge pull request #3126 from jlb6740/int-to-int-extend
Add x64 support for remaining int-to-int extend simd instructions
2021-07-29 09:49:22 -07:00
Shamil
072d5dc978 Fix typo in doc (#3127) 2021-07-29 08:59:41 -05:00
Johnnie Birch
4f601edc36 Add x64 support for remaining int-to-int extend simd instructions
Adds remaming support for int to int extend simd instructions.
Specifically adds support for remaining I32x4->I64x2 instructions
2021-07-28 23:33:42 -07:00
Andrew Brown
e3c56efd3e Fix unused borrow warning
`#[warn(unused_must_use)]` is on, prompting a compiler warning like:
"unused borrow that must be used".
2021-07-28 15:39:45 -07:00
Chris Fallin
323197ea93 Merge pull request #3070 from sparker-arm/simd-extmul-aarch64
Enable simd_extmul_* for AArch64
2021-07-28 11:10:57 -07:00
Sam Parker
5eb2dca9f1 Added doc comment
And removed an accidental code move.

Copyright (c) 2021, Arm Limited.
2021-07-28 13:14:20 +01:00
Sam Parker
f2806a9192 rebase and ran cargo fmt
Copyright (c) 2021, Arm Limited.
2021-07-28 13:14:20 +01:00
Sam Parker
541a4ee428 Enable simd_extmul_* for AArch64
Lower simd_extmul_[low/high][signed/unsigned] to [s|u]widen inputs to
an imul node.

Copyright (c) 2021, Arm Limited.
2021-07-28 13:14:20 +01:00