-
Notifications
You must be signed in to change notification settings - Fork 786
Change the default type system to isorecursive #5239
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
Conversation
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.
Should we finish fuzzing this mode before switching to it? Atm the fuzzer runs on --nominal
and it looks like this PR doesn't change that.
@@ -1,7 +1,7 @@ | |||
(module | |||
(type $none_=>_none (func)) | |||
(memory $0 1 1) | |||
(func $foo | |||
(func $foo (type $none_=>_none) |
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.
Can we not print these if GC is not on? That is, even if the type system is isorecursive, we don't need these types if the features don't require it. It would also make the diff here much smaller I think.
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.
Yeah, I added that logic and it helped some of the lit tests, but the problem is that most of these tests run with -all
.
04b5d9f
to
5a46d6f
Compare
Current dependencies on/for this PR:
This comment was auto-generated by Graphite. |
Given that the old default was also not fuzzed, I wouldn't consider this a blocker. |
We did at least fuzz equirecursive quite a lot before we switched the fuzzer over. It was fully stable back then. So we lost fuzz coverage but it had a good starting point at least. But, maybe it shouldn't block here. I am mainly concerned for any interactions with MVP wasm, but I guess such things should have been caught by tests. |
Certainly fuzzing is a good idea. I can fuzz with isorecursive types overnight before landing this. |
This diff is too large to comment on in the web UI 😄 What is this part of the diff? diff --git a/test/example/type-builder.cpp b/test/example/type-builder.cpp
index 7da2f8f0383..2ce064b5ffe 100644
--- a/test/example/type-builder.cpp
+++ b/test/example/type-builder.cpp
@@ -18,26 +18,26 @@ void test_canonicalization() {
TypeBuilder builder(4);
- Type tempSigRef1 = builder.getTempRefType(builder[2], Nullable);
- Type tempSigRef2 = builder.getTempRefType(builder[3], Nullable);
+ Type tempSigRef1 = builder.getTempRefType(builder[0], Nullable);
+ Type tempSigRef2 = builder.getTempRefType(builder[1], Nullable); |
The order of types in that test needed to change so that the earlier types no longer referred to later types. That kind of forward reference is only allowed in recursion groups in the isorecursive system, but this test doesn't really need a recursion group, so I just changed the type order instead. |
I had to write a python script to get through this massive diff 😄 lgtm, but please fuzz this even without changing the fuzzer to hybrid, as I think I saw an error. It was on a branch that I merged this PR to, but the error may have been due to the branch in theory... it did look like a type error though. I can't reproduce it outside of the branch but that might just be different random choices in the fuzzer. Probably not helpful, but here is part of the log:
(the branch was this PR + monomorphize) |
Ok, I got an error with just this PR. Seed: |
Oh, it could actually be |
7a446d2
to
11f9981
Compare
4e7579e
to
7331510
Compare
7331510
to
ab33f74
Compare
This should be ready to land |
Validate that GC is enabled if struct and array types are used by the module and validate that both GC and isorecursive types are enabled when nontrivial rec groups are used. This fixes a fuzz bug in #5239 where initial contents included a rec group but the fuzzer disabled GC. Since the resulting module passed validation, the rec groups made it into the binary output, making the type section malformed.
ab33f74
to
4acf48d
Compare
Ran over 7k fuzzer iterations at this latest commit with |
I can take another look now. I see force-pushes though, so it's a little hard to see what's changed since I read this last. Is there a way to do that on github? About fuzzing, if we aren't also changing the default in |
Sounds good, will fuzz more both with and without the flag changed. Sorry about the force-pushes, I know they make review more difficult. That's the trade off I'm making to get to use stacked PRs. I would welcome feedback about whether that's a good trade off or not on the review side. I'm not squashing or changing any existing commits during those force pushes (except that merge conflicts get resolved in whatever arbitrary commit the conflict occurred at), so you can always look at the individual new commits to see what has changed. GitHub doesn't have a good way of seeing how many commits are new since your last review in the presence of force pushes, though. |
4acf48d
to
6767c08
Compare
Interesting, thanks, if the commit contents don't change then I could in theory remember by their names which I've reviewed... |
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.
Ok, pretty sure I've reviewed the first one before, and the others look ok together, so lgtm with that fuzzing.
6767c08
to
500e591
Compare
Update `HeapType::getFeatures` to report that GC is used for heap types that have nontrivial recursion groups or supertypes. Update validation to check the features on function heap types, not just their individual params and results. This fixes a fuzz bug in #5239 where initial contents included a rec group but the fuzzer disabled GC. Since the resulting module passed validation, the rec groups made it into the binary output, making the type section malformed.
This makes Binaryen's default type system match the WasmGC spec. Update the way type definitions without supertypes are printed to reduce the output diff for MVP tests that do not involve WasmGC. Also port some type-builder.cpp tests from test/example to test/gtest since they needed to be rewritten to work with isorecursive type anyway. A follow-on PR will remove equirecursive types completely.
500e591
to
b6159e1
Compare
Fuzzed just under 50k iterations on this before merging. |
This makes Binaryen's default type system match the WasmGC spec.
Update the way type definitions without supertypes are printed to reduce the output diff for MVP tests that do not involve WasmGC. Also port some type-builder.cpp tests from test/example to test/gtest since they needed to be rewritten to work with isorecursive type anyway.
A follow-on PR will remove equirecursive types completely.