-
Notifications
You must be signed in to change notification settings - Fork 715
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
Update SIMD support #1553
Update SIMD support #1553
Conversation
7622441
to
d33c459
Compare
I've updated the PR now that WebAssembly/testsuite has been synchronized with the WebAssembly/simd repo upstream. All of the simd tests are still passing but one of the new (unrelated) tests pulled in from WebAssembly/spec does not pass and I'm not sure how to fix it. The test is this one which was added from WebAssembly/spec#1213. |
Looks like the Is this the root cause? |
@aardappel Yes, that's the one I wasn't sure how to fix either. It's related to this issue: WebAssembly/spec#1213. There's a similar test above it that doesn't use the quoted module (here) and that one does fail (correctly). The problem seemingly has to do with the fact that the type index (here) is out of range and should trigger the Probably there is some sort of validation that has to happen when processing the quoted module to catch this but I don't understand enough about the internals of |
@rossberg (and @binji if around) any guidance what the new test in WebAssembly/spec#1213 is supposed to do? Both myself and @darinmorrison so far have failed to fix it in WABT (see error above). |
@aardappel, can you be more specific? There is more than one test there. |
Ah, sorry, didn't read up-thread. Let me look. |
Okay, so the difference between this test and the preceding one is that the function also lists a parameter explicitly. This is a form of syntactic sugar in the text format alone, that has no correspondence in the binary format, and thus the AST. Consequently, it has to be desugared in the parser. But desugaring it requires knowing the actual type. So in order to do that, the parser (not just the validator) has to know and access the type definition for type 2 in this case, which doesn't exist. Since it's the parser failing this time, it produces malformed, not invalid. It is rather annoying, but I'm not sure what the alternative could be, given that we have this sugar. What does wabt produce for this test atm? |
@rossberg Currently
Alright, I think that makes sense. I know almost nothing about the internals of However, I think there may be something more fundamental going wrong with how (assert_invalid
(module quote
"(func $f (result f64) (f64.const 0))" ;; adds implicit type definition
"(func $g (param i32))" ;; reuses explicit type definition
"(func $h (result f64) (f64.const 1))" ;; reuses implicit type definition
"(type $t (func (param i32)))"
"(func (type 2))" ;; does not exist
)
"unknown type"
) Just to be clear, should the above give an |
Yes, that should be invalid, just like the preceding test. |
@darinmorrison any progress on fixing that last issue? |
@aardappel Unfortunately I don't really know how to fix that test. I think this will need some input from @binji or @sbc100 or some other maintainer who is more familiar with the internals of wabt. |
Ok, I will have another look. |
Ok, in
That made |
@aardappel Do you mean like this? Result CheckFuncTypeVarMatchesExplicit(const Location& loc,
const Module& module,
const FuncDeclaration& decl,
Errors* errors) {
Result result = Result::Ok;
if (decl.has_func_type) {
const FuncType* func_type = module.GetFuncType(decl.type_var);
if (func_type) {
result |=
CheckTypes(loc, decl.sig.result_types, func_type->sig.result_types,
"function", "result", errors);
result |=
CheckTypes(loc, decl.sig.param_types, func_type->sig.param_types,
"function", "argument", errors);
} else {
errors->emplace_back(ErrorLevel::Error, loc, "type index out of range");
result = Result::Error;
}
}
return result;
} Maybe I'm missing something but when I re-run
For comparison, before the change (just with this current PR), this is the output I get:
Was there maybe another change that needed to be included? |
Did you run |
@aardappel Yes, I did try that with individual tests but I'm still getting errors. Running
If you were able to get it to work (with the tests passing on CI), can you make your branch available? From that, I could just cherry-pick the commit into this PR. |
weird, I don't get those errors, instead I get some remaining SIMD errors I haven't solved yet.. I may make a PR later and we can compare |
Sorry for the long delay on resolving this. Is It looks like other than this problem, the rest of the PR is relatively straightforward. |
@binji Yes, it's just the one test in |
9d07cf2
to
b351e0b
Compare
@binji this should be good to go now I think. |
b351e0b
to
faf6e33
Compare
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.
Awesome, thanks for doing this! lgtm
This PR updates SIMD support corresponding to changes in the WebAssembly/simd proposal repo from the following PRs:
WebAssembly/simd#321
WebAssembly/simd#322
WebAssembly/simd#341
WebAssembly/simd#344
This should not be merged until WebAssembly/testsuite#32 is merged since it needs the updated testsuite using the new syntax for the SIMD tests.
For the moment I have pointed the
third_party/testsuite
to my local branch which has the recent changes from WebAssembly/simd merged.Note that in the PR I referenced for the WebAssembly/testsuite there will be additional (probably minor) breakage from recent changes in other proposal repos but I didn't include fixes for all of those here since I wanted this PR to focus on SIMD.