-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Switch Cranelift over to regalloc2. #3989
Conversation
7f56594
to
b3e1e8a
Compare
@fitzgen I've split this into somewhat more reasonably-sized chunks; I think this should be more manageable, but let me know if you want me to try to factor the core changes more finely still. I'll switch this out of 'draft' mode once bytecodealliance/regalloc2#38 is reviewed and merged and I can switch the dep back to a crate version here. |
… lowering machinery for regalloc2.
4c22cf2
to
be9ee18
Compare
@fitzgen I've split the work into more-or-less separate chunks, and cleaned up the last CI nits, so I think this is ready for review now! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! r=me with comments addressed. Thanks Chris!
…and removes needless churn in precise-output tests.
…1.1 with serde support.
Yep, filed #4024. |
…st baking in assumptions in the rest of the code.
We are currently (bytecodealliance/wasmtime#3989) switching over to a new register allocator in Cranelift/wasmtime. This PR switches our fuzzing setup to start fuzzing the new allocator instead of the old one.
…g_clobber()` instead.
I believe I've resolved all pending review comments now, with a few followup issues filed as well. Thanks @fitzgen for the speedy and helpful review! I'll hold off on merging this until my morning (PDT) so I'm around just out of caution, but given all of the fuzzing and testing I am cautiously optimistic this should be uneventful... |
We are currently (bytecodealliance/wasmtime#3989) switching over to a new register allocator in Cranelift/wasmtime. This PR switches our fuzzing setup to start fuzzing the new allocator instead of the old one.
…Buffer. Following the merge of regalloc2 support, this became slower because we are stricter about the critical-edge invariant, generating a separate edge block for every out-edge even if two or more out-edges go to the same successor (this is significant in cases of `br_table` with many entries having the same target block, for example). Many of those edge blocks are empty and end up collapsed by the MachBuffer, which leads to a large set of aliased labels. The invariant validation will dutifully iterate over all the data structures at every step, validating all of our conditions. But this gets way slower in the new context, to the point that we'll probably have some fuzz timeouts. This was pointed out in [1] but I missed removing this in bytecodealliance#3989. Given that `MachBuffer` has been around for nearly two years now, has been fuzzed continuously with the invariant validation for that time, and also has a correctness proof in the comments, it's probably reasonable to remove this high (recently increased) cost from the fuzzing-specific compilation configuration. [1] bytecodealliance#3989 (comment)
…Buffer. (#4038) Following the merge of regalloc2 support, this became slower because we are stricter about the critical-edge invariant, generating a separate edge block for every out-edge even if two or more out-edges go to the same successor (this is significant in cases of `br_table` with many entries having the same target block, for example). Many of those edge blocks are empty and end up collapsed by the MachBuffer, which leads to a large set of aliased labels. The invariant validation will dutifully iterate over all the data structures at every step, validating all of our conditions. But this gets way slower in the new context, to the point that we'll probably have some fuzz timeouts. This was pointed out in [1] but I missed removing this in #3989. Given that `MachBuffer` has been around for nearly two years now, has been fuzzed continuously with the invariant validation for that time, and also has a correctness proof in the comments, it's probably reasonable to remove this high (recently increased) cost from the fuzzing-specific compilation configuration. [1] #3989 (comment)
We are currently (bytecodealliance/wasmtime#3989) switching over to a new register allocator in Cranelift/wasmtime. This PR switches our fuzzing setup to start fuzzing the new allocator instead of the old one.
This is a draft PR for now, meant to serve as a discussion-starter. I'll work on splitting this into logically separate commits next week, but wanted to get the initial thing up first.
All tests pass on x86-64, aarch64, and s390x (at least locally on Linux, modulo any CI surprises) and performance numbers from #3942 still apply.
There is a summary of the design changes in this document (I'll turn that into more permanent documentation before this merges).
Closes #3942.
Requires bytecodealliance/regalloc2#38 and subsequent crate version bump/release.(done.)