Repository navigation
dummy PR for actions - #2
Closed
pufferfish101007 wants to merge 653 commits into
Closed
pufferfish101007 wants to merge 653 commits into
pufferfish101007 wants to merge 653 commits into
Conversation
Followup to WebAssembly#8169. Fixes the fuzzer which currently generates code with --enable-relaxed-atomics which isn't supported in v8. To test, I ran the fuzzer successfully for ~20 minutes locally. Part of WebAssembly#8165. In the future, we'll also add fuzzing support for relaxed atomics by generating acqrel instructions.
…obalStructInference (WebAssembly#7906)
All recent distributions of clang also include lld, and it links much faster than most other linkers.
ReorderTypes previously collected the module types and their counts, even though it already extends GlobalTypeRewriter, which also collects the module types in its constructor. Not only did this duplicate work, it was also a subtle source of bugs because ReorderTypes and GlobalTypeRewriter collected types slightly differently. ReorderTypes collected the binary types and GlobalTypeRewriter collected the used IR types. This could result in different types being collected for the same multivalue control flow signatures, causing an assertion failure when a type was seemingly missing from the collected info. Fix the problem and make the pass more efficient by simply not collecting the types two separate times.
UniqueRecGroups compares the shapes of rec groups after considering how types will be written in the final binary for a particular feature set. Previously its interface dealt in arbitrary vectors of types, but it turns out that it could sometimes be subtly incorrect to pass vectors of types that were not already all in the same rec group. The problem is that the base case for the RecGroupShape utility that hashes rec group shapes is either hashing the index in the group for recursive references to types in the group or the type ID for non-recursive references. When the type vector contains types from different rec groups, non-recursive references across groups can inadvertently appear and be hashed as recursive references. Fix the problem for UniqueRecGroups by changing the interface to take RecGroups rather than arbitrary vectors of heap types. A regression test for this bug will be included in an upcoming PR. It cannot be included here because it depends on running a pass that does not exist yet.
Update a comment to better match the code and tweak a loop to avoid repeated work. Not NFC because avoiding the double count of multivalue control flow types changes type ordering.
…ebAssembly#8208) This will allow more experimentation with where we do this.
The LINUX variable only exists in CMake starting in version 3.25 However we support CMake versions down to 3.16 currently. Use an explicit CMAKE_SYSTEM_NAME check instead.
The mimalloc CMake code unconditionally adds libatomic to its link dependencies, but it's not actually needed on the modern systems that we're building for. Adding the --as-needed flag causes the linker to only link against the following libraries if they provide symbols that are actually needed. For static linking, we wrap mimalloc's injected dependencies in -Wl,--as-needed since they surface all the way up to the final link line for each tool (I don't think it would hurt to just link all the tools with --as-needed but this seemed cleaner). For dynamic linking, it's sufficient to just make the libmimalloc.so link with --as-needed. As a drive-by cleanup, also make mimalloc a private dependency of libbinaryen. Fixes emscripten-core/emsdk#928
We have global stores for interned strings and wasm types, and cleaning those up takes a lot of time. This PR skips them, which makes roundtripping a large Dart binary 10% faster.
This caused a miscompilation in GUFA: when a basic type was not present, we'd not find an entry for its size, which meant map[type] returned the default value - which was 0. 0 is right 99% of the time, except for ext, which has a subtype (string). Add all the subtypes, and assert in GUFA on entries always existing, which would have caught this bug.
Part of WebAssembly#8180. We currently replicate the existing behavior. In the future, we can also change ctor-eval to really simulate tables, and only use the EvallingRuntimeTable in the case of table imports. Removes existing pointer chasing logic that we repeat for each table operation (e.g. tableLoad, tableStore). Allows us to fix spec tests where a table import becomes valid by resizing it in WebAssembly#8222.
Fixes some incorrect auto-formatting in a couple places
WebAssembly#8224) On a Dart testcase I am looking at, there is a huge number of roots in the graph, and it is 7% faster to use the more efficient indexes over the raw structure. We do that elsewhere, but root processing is typically not a big part of the total time, so this was not noticed before.
Part of WebAssembly#8165. Fuzzing and library support will be added in a future PR with all instructions together. relaxed-atomics.wast is updated using the WIP script in WebAssembly#8220.
The Chromium CI builders (which build the emsdk release builds) don't support LTO builds with the system linker on Mac (but they do have lld). This reverts the part of WebAssembly#8204 that removed the usage of lld along with LTO, but keeps the part that enables it for non-LTO cases.
…embly#8232) Older versions of macOS are missing the libc symbol quick_exit, despite the fact that libc++ implements std::quick_exit on top of it. The result is that Binaryen will link but fail to load. Switch to _Exit instead.
The directory is created by `./scripts/emcc-tests.sh` and contains python files that don't pass the formatting check ```sh ./emcc-build/test/lit/lit.site.cfg.py:3:1: F821 undefined name 'config' ./emcc-build/test/lit/lit.site.cfg.py:4:1: F821 undefined name 'config' ./emcc-build/test/lit/lit.site.cfg.py:6:1: F821 undefined name 'lit_config' ./emcc-build/test/lit/lit.site.cfg.py:7:5: F821 undefined name 'config' ./emcc-build/test/lit/lit.site.cfg.py:7:26: F821 undefined name 'config' ```
TableUtils::IsSubType is removed because it never makes sense to check for subtyping between two (static) `Table` definitions, since the runtime size must be taken into account. Fixes the `table_grow.wast` spec test. Also make tableMeta() non-virtual in RuntimeTable since the base class has the field and it never makes sense to override it.
Suggested in [WebAssembly#8222#discussion_r2721815229](WebAssembly#8222 (comment))
WebAssembly#8229) The External phase considers all externally-visible things and marks them as such. That includes functions in a public table. The old code ran on each item and processed it, which turns out to be very slow on Dart: Dart can have massive tables with many repeated elements, so it is much faster to first collect the function names in a set, then process those. This makes --gufa on this large Dart testcase 7.7x faster - not 7.7 percent, but times: from 393 seconds to 51. (This is the same situation as in WebAssembly#8048, again the huge table is not something we have handled well.)
WebAssembly#8223 bumped the LLVM version which changed some formatting. The only manual change was [to add an extra space to ensure that windows.h is included before shellapi.h](WebAssembly@7ce6fc7) which is required by the Windows API. `ack '' -l --type cpp --ignore-dir=third_party | xargs clang-format -i` TODO: Will add this to .git-blame-ignore-revs in the next PR
In `ModuleSplitter::shareImportableItems`, we now check if each module element is used by a secondary module and export & import it only when it is necessary. This removes the need to run RemoveUnusedModuleElements pass for secondary modules at the end, and also removes unnecessary exports from the primary module in case they are not used in any secondary modules. This reduces the running time on a 'acx_gallery' reproducer provided by @biggs0125 before from 78.3s to 16.4s in average on my machine, reducing it by around 79%. In that 'acx_gallery' program, this PR reduces the size of the primary module by 13% and its export section by 62.1%, and reduces the all combined module size (primary + secondaries) by 7.4%. --- Detailed analysis for 'acx_gallery', a case where we split a module into 301 (1 primary + 300 secondary) modules: - Before this PR: Time: 78.3s Task breakdown: ``` Task Total Time (ms) Percentage --------------------------------------------------------------------------- shareImportableItems 34472.0000 49.90% removeUnusedSecondaryElements 24720.2000 35.78% moveSecondaryFunctions 4938.0500 7.15% writeModule_secondary 2892.7603 4.19% writeModule_primary 897.3630 1.30% exportImportCalledPrimaryFunctions 667.9780 0.97% indirectReferencesToSecondaryFunctions 201.9830 0.29% indirectCallsToSecondaryFunctions 133.2190 0.19% classifyFunctions 118.3200 0.17% setupTablePatching 42.6402 0.06% thunkExportedSecondaryFunctions 0.9307 0.00% initExportedPrimaryFuncs 0.8008 0.00% --------------------------------------------------------------------------- ``` - After this PR: Time: 16.4s Task breakdown: ``` Task Total Time (ms) Percentage --------------------------------------------------------------------------- moveSecondaryFunctions 5341.1700 43.94% writeModule_secondary 2960.8319 24.36% shareImportableItems 1568.6400 12.91% writeModule_primary 765.7240 6.30% exportImportCalledPrimaryFunctions 762.9670 6.28% indirectReferencesToSecondaryFunctions 362.3300 2.98% classifyFunctions 204.4540 1.68% indirectCallsToSecondaryFunctions 139.2110 1.15% setupTablePatching 45.2461 0.37% thunkExportedSecondaryFunctions 3.0373 0.02% initExportedPrimaryFuncs 0.9982 0.01% --------------------------------------------------------------------------- Overall Total 12154.6095 100.00% ``` We can see that `shareImportableItems`, which took up the largest share, has been reduced significantly, and `removeUnusedSecondaryElements`, which was the second largest, is not necessary anymore. --- Code size - Primary module's export section size: -62.1% - With the name section present - Primary module size: -8% - All combined module size: -4.4% - With the name section stripped from the result - Primary module size: -13% - All combined module size: -7.4%
* Use Literal::add and Literal::mul to avoid overflow of signed arithmetic. These do the right thing by casting to unsigned first. * Use bit_cast instead of a C-style cast to convey the intent better when converting between signed and unsigned. * Also add a unit test for i8x16.avgr_u to demonstrate that it doesn't overflow. From reading the code, most other arithmetic in Literal.cpp shouldn't invoke UB. There are some spec tests that are disabled due to float/nan behavior that I'll look at in future PRs.
This splits out option tests into `multi-split-options.wast`. I plan to add more option tests and adding all them to `multi-split.wast` looks a little too crowded.
* Adds support for (either ...) in assert_return in WAST
* Also allows customizing the error type in Result, which we use to keep
track of the failing lane in assertions.
Example failure:
```wast
(module
(func (export "f") (result i32)
(i32.const 1)
)
)
(assert_return (invoke "f") (either (i32.const 2) (i32.const 3)))
```
```
Expected one of (2 | 3) but got 1
```
Example failure with SIMD from `relaxed_min_max.wast`:
```
Expected one of (canonical f32 | canonical f32 | 0 | 0x00000000) at lane 0 but got i32x4 0x7fc00000 0x7fc00000 0x7fc00000 0x7fc00000
```
Part of WebAssembly#8261 and WebAssembly#8315. Fixes `i16x8_relaxed_q15mulr_s.wast`,
`i8x16_relaxed_swizzle.wast`, `relaxed_madd_nmadd.wast` spec tests, and
partially fixes `relaxed_dot_product.wast`, `relaxed_laneselect.wast`,
`relaxed_min_max.wast`, and `threads/thread.wast`.
The added test would previously pass wrongly.
SubTyper was introduced back when we still had equirecursive types. Back then it implemented the coinductive subtype checking algorithm, but since then it has had dual roles: it has checked subtyping between pairs of types and heaptypes, and it also checks whether the definition of a subtype is valid. Since these are two very different roles, it does not make sense to bundle them in a single utility. Split up the code and move each part to its users.
Struct and array cmpxchg operations allow the accessed field to be a shared or unshared eqref, but subtype-exprs.h was assuming that if it was a reference, it would be a subtype of unshared eqref only. Fix it to account for shared types as well.
Unsubtyping has to propagate a `subtypesExposedToJS` marker from supertypes to subtypes. It previously did this by propagating from supertype to subtype whenever a new subtyping relationship was found. But subtyping trees are not always built from top to bottom. In cases where the newly discovered subtype already had subtypes, the previous propagation scheme would fail to propagate to those transitive subtypes. Fix the problem by propagating to the full subtype tree rooted at a newly discovered subtype. Use a DFS over the tree and avoid traversing subtrees that have already been marked to avoid introducing possible quadratic behavior.
When we updated EffectsAnalzyer to handle atomic effects more precisely, we forgot to update AtomicFence. It previously was considered to access shared memories, but in fact it should be considered to access all possible shared locations. This properly prevents it from being reordered with accesses to shared structs and arrays as well.
The coverage uploader has been running into rate limits and no one has complained. Clearly we are not using or benefiting from this builder in practice, so simply remove it.
* Fix bit patterns for canonical and arithmetic NaNs * Canonicalize NaNs for float instructions covered by spec tests * Also remove equivalent tests in test/spec since they're the same as the upstream tests but with some previously-failing parts removed, and using older syntax for checking for NaNs * Fixes 12 spec tests Part of WebAssembly#8261.
Now that we want to fuzz stack switching against a real implementation in V8, add proper validation. Copy in the stack switching tests, commenting out parts we do not handle for other reasons, to test that the new validation logic is correct. Fix DAE2 and a couple of stack switching tests that were not actually valid to begin with.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.