-
Notifications
You must be signed in to change notification settings - Fork 282
SIMD: load/store lane, any_true, q-format multiply, i64x2.widen #196
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
SIMD: load/store lane, any_true, q-format multiply, i64x2.widen #196
Conversation
For wabt tests using the old syntax it should be fine to update this whitelist of tests to not run. Other than that looks good to me! Since we're losing some test coverage with wabt, mind adding a new test which covers at least the new instructions? |
Sounds good. I expect the SIMD tests will be updated shortly and can then be pulled in here, but somebody's calling a do-over on some of the opcode assignments... I'll keep this PR alive but will tell you when I think it's safe to merge. |
Skip tests that won't pass until all tools have removed iNxM.any_true and moved over to v128.any_true
Achievement unlocked: add a new argument type to the parser in expr.rs... But we have a problem, there's a grammar ambiguity here. Consider The multi-memory spec is pretty quiet on the matter. I think the best way to resolve this is for the memory index in a memarg to be denoted with a keyword in the manner of alignment and offset, memidx=n or memory=n. |
Oh dear, that indeed sounds bad. Want to hardcode that instruction's memory index as 0 for now and bring this up as an issue on the multi-memory repo? I suspect we'll probably do as you mention but it's probably easier to hardcode 0 for now and implement that later as necessary. |
I can do that. |
@alexcrichton, PTAL. This excludes a number of included-repo test cases that will fail until wabt is updated, adds tests for all new instructions (and a few that were affected by the exclusion), pins the memory index to zero, and disables some local tests that were affectd by the memory index change. I did not run rustfmt since that seemed to have effects well beyond my work; LMK. The assigned opcodes are unfortunately tentative and may change, but to the best of my understanding what I have here corresponds with what V8 has chosen for the time being. (I'll double-check that now, since some time has passed.) |
Looks like the opcodes used in the patch are in sync with current v8 code (assuming that v128.any_true maps to the opcode of i8x16.any_true, as discussed in the committee), and v8 is kept in sync with llvm and binaryen. We've agreed to renumber any new opcodes when the set of instructions has been frozen; opcodes that were renumbered in the last renumbering pass will not be affected. In short, no more work remaining here for the time being. |
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.
I'm not really sure how rustfmt decides to format these sorts of enum
declarations but it should be fine to just run cargo fmt
to appease it. If it changes things that you didn't touch that's ok. If you'd like, though, you could make the format changes a separate commit (doesn't matter much to me). Sometimes this can arise when the codebase was last formatted with 1.48 and 1.49 differs slightly, for example.
tests/local/atomics.wast
Outdated
) | ||
) | ||
"unknown memory 1") | ||
;; Disabled because memory indices are not currently supported |
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.
To confirm, is the intention that you'd write:
v128.load8_lane offset=3 3
for loading lane 3 at offset 3? As opposed to
v128.load8_lane 3 offset=3
(I figured the land would want to be prioritized here?)
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.
I thought this would be the latter, that is, since otherwise this breaks the multi-memory support for all instructions in wast
I think which I think may be a bit too breaking for now. Changing from an index/identifier to (memory $m)
should resolve the ambiguity there, though, and could be implemented for now. That'd be parsed as Option<ItemRef<kw::memory>>
in wast
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.
Yes, confirmed. According to the SIMD spec, the memory argument comes before the lane argument in the binary form, and arguably this is best for the text form too. (The SIMD spec, alas, uses a C++-oriented form and is not a ton of help, but the order of operands is memory arg before lane.)
I'm not sure what you mean by the comment that it breaks all multi-memory support. With the current code, which does not parse any memory index, there is no multi-memory support, hence all test cases that use a memory index are commented out.
Andreas also thought (memory $m) would be the correct syntax. I can look into making that work, and will re-enable tests if and when it works.
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 makes sense. If you'd like I can land the change to (memory ..)
before this PR since ideally this PR wouldn't be affected by multi-memory at all.
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.
Your call. Since my patch now seems to do what it needs to do, I'm fine either way.
This introduces the use of the What I did not do here is require the |
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.
Thanks! To confirm would you want a publish as well?
Yeah, a new version would be welcome. Thanks! |
Ok should be published now |
This adds the usual stuff for a number of newly approved instructions, that's the first four commits. The fifth commit is tricker: it removes two instructions and renames a third, because these instructions all had the same meaning. The code is simple but this breaks a ton of tests. Most of those tests are simple to fix (not included here - what do I do with my changes?) but some are not, because the test runner roundtrips through wabt and wabt needs to be updated. @alexcrichton, guidance welcome.