-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
WebAssembly SIMD support in Chakra #4200
Conversation
running simple SIMD tests build ops generating signatures with macroses running simple tests for simd build ops bbrk fix multi-byte reader all opcodes enabling build and extract ops back separate op file, using flag i8x16, i16x8 fixes float fix & i8x16 boolean type fix aruns comments binary arithmetics fixes, review r2 more fixes fixed macros fixes build & extract tests removing the uneccessary part of fix 7c63df5 renaming wast files for consistency
…s build/extract and binary arithmetic ops. Merge pull request chakra-core#2736 from Krovatkin:wasm-simd-collab This PR includes * A list of SIMD opcodes * Initial extensions to WasmBytecodeGenerator and WasmBinaryReader to support reading and generating bytecodes for `extract`, `build` and arithmetic binary operations. * Tests for these operations * A few fixes The fixes include: * https://github.com/Microsoft/ChakraCore/pull/2736/files#diff-b0ef4db6dba17fc268e8745b695badceL1117 * https://github.com/Microsoft/ChakraCore/pull/2736/files#diff-9d396b386e20933b7bfbec028a04e8c9R248 * https://github.com/Microsoft/ChakraCore/pull/2736/files#diff-314ffb76644084b820e66bdfe3f879d9R377 In this version, we decided to not group SIMD operations into one case arm since this way we could encapsulate all SIMD-related reading logic in `ReadOpCode`. We could always move all SIMD ops into a separate case arm later. I temp disabled short-signature comparisons since I didn't know what the best way would be to extend it to support SIMD types.
…anch Merge pull request chakra-core#2791 from Krovatkin:wasm-simd-collab
loads & stores cleaned up
wraparound tests + wraparound fix in OpSimdXXArrGeneric
…d/store + constants Merge pull request chakra-core#3185 from Krovatkin:wasm.simd_0xfd This PR contains * updates to `WasmBinaryReader` to decode simd ops in the current spec format * regenerated tests for load/store and constants * load and store ops * extract_lane ops * ops for generating simd128 constants
extractlane fix add missing wasm files for negation and splat tests addressing Mike's feedback
…eLane + tests Merge pull request chakra-core#3237 from Krovatkin:replacelane This PR includes: * Negation op + tests * Splat op + tests * ReplaceLane op + tests
Merge pull request chakra-core#3288 from Krovatkin:wasm.simd.logical This PR includes * logical operations + tests * truncation & conversion operations for 32x4 types + tests
…ds (matching lane width) of CanonicalizeToBools Merge pull request chakra-core#3342 from Krovatkin:wasm.simd.compops This should fix failures in SIMD.validation
fixing flag
@dotnet-bot test OSX static_osx_osx_debug pleaese |
I am not yet done with the review, but I have a few action items for you to handle so I am publishing my progress for now Reviewed 65 of 129 files at r1, 2 of 22 files at r2. lib/WasmReader/WasmBinaryOpCodes.h, line 11 at r2 (raw file):
nit: could you move this back to the top lib/WasmReader/WasmBinaryOpCodes.h, line 88 at r2 (raw file):
could we move this to the bottom instead and wrap it with lib/WasmReader/WasmBinaryOpcodesSimd.h, line 8 at r2 (raw file):
Since there is only one type and it might stay like this for a little while. lib/WasmReader/WasmBinaryReader.cpp, line 29 at r2 (raw file):
lib/WasmReader/WasmBinaryReader.cpp, line 41 at r2 (raw file):
Looks like this is unused, can we clean it up please ? lib/WasmReader/WasmBinaryReader.cpp, line 716 at r2 (raw file):
Here I think I would prefer lib/WasmReader/WasmByteCodeGenerator.cpp, line 213 at r2 (raw file):
Could you cleanup those comments please ? lib/WasmReader/WasmByteCodeGenerator.cpp, line 474 at r2 (raw file):
Here we should do lib/WasmReader/WasmByteCodeGenerator.cpp, line 623 at r2 (raw file):
nit: use lib/WasmReader/WasmByteCodeGenerator.cpp, line 625 at r2 (raw file):
Here you should rewrite this to EmitInfo args[lanes];
for (uint i = 0; i < lanes; i++)
{
args[i] = PopEvalStack(type);
} lib/WasmReader/WasmByteCodeGenerator.cpp, line 1171 at r2 (raw file):
shouldn't we use lib/WasmReader/WasmByteCodeGenerator.cpp, line 1311 at r2 (raw file):
nit: extra new line lib/WasmReader/WasmByteCodeGenerator.cpp, line 1448 at r2 (raw file):
We should pass the index by argument here instead of looking at the reader. lib/WasmReader/WasmByteCodeGenerator.cpp, line 1479 at r2 (raw file):
The default should be 0 so that we always throw index out of range lib/WasmReader/WasmByteCodeGenerator.cpp, line 1503 at r2 (raw file):
nit: trailing whitespaces lib/WasmReader/WasmByteCodeGenerator.cpp, line 1540 at r2 (raw file):
The format string is invalid. I suppose you meant to use lib/WasmReader/WasmByteCodeGenerator.cpp, line 1552 at r2 (raw file):
nit: trailing whitespace lib/WasmReader/WasmSignature.cpp, line 146 at r1 (raw file):
We need to figure out the story with wasm.simd here at this point test/rlexedirs.xml, line 332 at r1 (raw file):
I don't know how much we use it, but you should add test/rlexedirs.xml, line 333 at r1 (raw file):
Please remove this second line Comments from Reviewable |
lib/WasmReader/WasmBinaryOpcodesSimd.h, line 8 at r2 (raw file): Previously, Cellule (Michael Ferris) wrote…
Yes, makes sense. Comments from Reviewable |
lib/WasmReader/WasmBinaryReader.cpp, line 716 at r2 (raw file): Previously, Cellule (Michael Ferris) wrote…
Yes, that is better. Done. Comments from Reviewable |
lib/WasmReader/WasmByteCodeGenerator.cpp, line 474 at r2 (raw file): Previously, Cellule (Michael Ferris) wrote…
yes! good catch. Thanks. Comments from Reviewable |
Review status: 67 of 129 files reviewed at latest revision, 20 unresolved discussions, some commit checks failed. lib/WasmReader/WasmBinaryOpCodes.h, line 11 at r2 (raw file): Previously, Cellule (Michael Ferris) wrote…
Done. lib/WasmReader/WasmBinaryOpCodes.h, line 88 at r2 (raw file): Previously, Cellule (Michael Ferris) wrote…
Done. lib/WasmReader/WasmBinaryReader.cpp, line 29 at r2 (raw file): Previously, Cellule (Michael Ferris) wrote…
Done. lib/WasmReader/WasmBinaryReader.cpp, line 41 at r2 (raw file): Previously, Cellule (Michael Ferris) wrote…
Done. lib/WasmReader/WasmByteCodeGenerator.cpp, line 213 at r2 (raw file): Previously, Cellule (Michael Ferris) wrote…
Done. lib/WasmReader/WasmByteCodeGenerator.cpp, line 623 at r2 (raw file): Previously, Cellule (Michael Ferris) wrote…
Done. lib/WasmReader/WasmByteCodeGenerator.cpp, line 625 at r2 (raw file): Previously, Cellule (Michael Ferris) wrote…
Done. lib/WasmReader/WasmByteCodeGenerator.cpp, line 1171 at r2 (raw file): Previously, Cellule (Michael Ferris) wrote…
Done. lib/WasmReader/WasmByteCodeGenerator.cpp, line 1311 at r2 (raw file): Previously, Cellule (Michael Ferris) wrote…
Done. lib/WasmReader/WasmByteCodeGenerator.cpp, line 1448 at r2 (raw file): Previously, Cellule (Michael Ferris) wrote…
Done. lib/WasmReader/WasmByteCodeGenerator.cpp, line 1479 at r2 (raw file): Previously, Cellule (Michael Ferris) wrote…
Yes, Thanks. Done. lib/WasmReader/WasmByteCodeGenerator.cpp, line 1503 at r2 (raw file): Previously, Cellule (Michael Ferris) wrote…
Done. lib/WasmReader/WasmByteCodeGenerator.cpp, line 1540 at r2 (raw file): Previously, Cellule (Michael Ferris) wrote…
Done. Will look into the error cases. lib/WasmReader/WasmByteCodeGenerator.cpp, line 1552 at r2 (raw file): Previously, Cellule (Michael Ferris) wrote…
Done. lib/WasmReader/WasmSignature.cpp, line 146 at r1 (raw file): Previously, Cellule (Michael Ferris) wrote…
Is it right to think of m_shortSig as a fast signature comparison scheme? Sorry for my ignorance here, but why do we have this logic disabled? test/rlexedirs.xml, line 332 at r1 (raw file): Previously, Cellule (Michael Ferris) wrote…
Done. test/rlexedirs.xml, line 333 at r1 (raw file): Previously, Cellule (Michael Ferris) wrote…
Done. Comments from Reviewable |
eebff83
to
f70f51c
Compare
Reviewed 42 of 129 files at r1, 19 of 22 files at r2, 9 of 9 files at r3. lib/Backend/IRBuilderAsmJs.cpp, line 4585 at r3 (raw file):
Here it should remain lib/Backend/IRBuilderAsmJs.cpp, line 4750 at r3 (raw file):
I just noticed this was commented out. lib/Common/ConfigFlagsList.h, line 900 at r3 (raw file):
For now I think this should be a FLAGNR (non release) until we figure out the story to make this available through experimental flag. lib/Runtime/Base/ThreadConfigFlagsList.h, line 60 at r3 (raw file):
You will have to remove this by changing the flag to FLAGNR lib/Runtime/ByteCode/OpCodesAsmJs.h, line 337 at r3 (raw file):
This is probably a merge remnant. I think it was remove a little while back. lib/Runtime/Language/SimdInt64x2Operation.h, line 18 at r3 (raw file):
We should add to this todo why we can't change it right now, if I recall it's because they're being called directly from the jit right ? lib/WasmReader/WasmSignature.cpp, line 146 at r1 (raw file): Previously, arunetm (Arun Etm) wrote…
Yes, we want to do a simple integer comparison on signature with few arguments.
I think you can leave this as it is for now. Comments from Reviewable |
Reviewed 5 of 5 files at r4. lib/Runtime/Base/ThreadConfigFlagsList.h, line 60 at r3 (raw file): Previously, Cellule (Michael Ferris) wrote…
I think you removed the wrong one Comments from Reviewable |
Review status: all files reviewed at latest revision, 6 unresolved discussions, some commit checks failed. lib/Backend/IRBuilderAsmJs.cpp, line 4585 at r3 (raw file): Previously, Cellule (Michael Ferris) wrote…
Code removed. lib/Backend/IRBuilderAsmJs.cpp, line 4750 at r3 (raw file): Previously, Cellule (Michael Ferris) wrote…
Done. lib/Common/ConfigFlagsList.h, line 900 at r3 (raw file): Previously, Cellule (Michael Ferris) wrote…
Yes sure. Changing to FLAGNR. lib/Runtime/Base/ThreadConfigFlagsList.h, line 60 at r3 (raw file): Previously, Cellule (Michael Ferris) wrote…
yes. :) lib/Runtime/Language/SimdInt64x2Operation.h, line 18 at r3 (raw file): Previously, Cellule (Michael Ferris) wrote…
That's right. We currently have helper calls for these from jit. Will add the info to the ToDo. lib/WasmReader/WasmSignature.cpp, line 146 at r1 (raw file): Previously, Cellule (Michael Ferris) wrote…
Yes makes sense. Thanks for the explanation. lib/Runtime/ByteCode/OpCodesAsmJs.h, line 337 at r3 (raw file): Previously, Cellule (Michael Ferris) wrote…
Thanks for catching this. seems like a merge mistake. Fixed. Comments from Reviewable |
@Cellule, please take a look. |
Review status: 125 of 127 files reviewed at latest revision, 1 unresolved discussion, some commit checks failed. lib/Runtime/Base/ThreadConfigFlagsList.h, line 60 at r3 (raw file): Previously, arunetm (Arun Etm) wrote…
Done. Comments from Reviewable |
Reviewed 3 of 3 files at r5. Comments from Reviewable |
Merge pull request #4200 from arunetm:wasm.simd This PR contains the implementation of the current WASM SIMD specification Spec: https://github.com/WebAssembly/simd <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/microsoft/chakracore/4200) <!-- Reviewable:end -->
This PR contains the implementation of the current WASM SIMD specification
Spec: https://github.com/WebAssembly/simd
This change is