Add WebGPU SPIR-V Assembler in JavaScript.#2876
Add WebGPU SPIR-V Assembler in JavaScript.#2876dj2 merged 4 commits intoKhronosGroup:masterfrom dj2:add_sva
Conversation
This CL adds a simple JavaScript library which will assemble SPIR-V Assembly compatable with WebGPU.
dneto0
left a comment
There was a problem hiding this comment.
I think I found a few small bugs. Also suggest some more test cases.
| let kind = undefined; | ||
| let value = undefined; | ||
| let params = []; | ||
| if (data.kind === "IdResult" || data.kind === "IdRef" |
There was a problem hiding this comment.
I think you'll need more cases, as in https://github.com/KhronosGroup/SPIRV-Tools/blob/master/source/text.cpp#L210
There is also memory-semantics-ID, scope-id, optional-id.
There was a problem hiding this comment.
Will flush this out post land as I create test cases.
|
|
||
| it.skip("handles spec constant ops", () => { | ||
| // let input = "%sum = OpSpecConstantOp %i32 IAdd %a %b"; | ||
| }); |
There was a problem hiding this comment.
Please add this stress test from OpCopyMemory. It uses two optional memory access operands, each of which has its own mixed set of enums, some of which with its own parameters.
https://github.com/KhronosGroup/SPIRV-Tools/blob/master/test/text_to_binary.memory_test.cpp#L274
Here's the whole test, showing you exactly which words are produced. You can figure out how the mapping goes by staring at it...
std::string spirv =
"OpCopyMemory %1 %2 Volatile|Nontemporal|"
"MakePointerVisible %3 "
"Aligned|MakePointerAvailable|NonPrivatePointer 16 %4\n";
EXPECT_THAT(CompiledInstructions(spirv),
Eq(MakeInstruction(SpvOpCopyMemory, {1, 2, 21, 3, 42, 16, 4})));
std::string disassembly =
EncodeAndDecodeSuccessfully(spirv, SPV_BINARY_TO_TEXT_OPTION_NONE);
EXPECT_THAT(disassembly, Eq(spirv));
There was a problem hiding this comment.
Ugh, gross. That's going to fail, heh.
There was a problem hiding this comment.
Added a skip test, will work out post land.
There was a problem hiding this comment.
yeah spir-v syntax is deliberately LR parsing. Need to keep a stack of expected tokens, and reading the mask makes you push stack of more expected tokens.
There was a problem hiding this comment.
dneto0
left a comment
There was a problem hiding this comment.
Request change to add the comment at the value() method.
Also, please add TODOs in the spots where it's known to be incomplete or wrong.
dj2
left a comment
There was a problem hiding this comment.
Added comments as needed. Didn't add a TODO for the skip test, as the fact that it's a skip test is already a TODO, heh.
Roll third_party/effcee/ 6527fb254..cd25ec17e (2 commits) google/effcee@6527fb2...cd25ec1 $ git log 6527fb254..cd25ec17e --date=short --no-merges --format='%ad %ae %s' 2019-09-18 dneto Start v2019.1-dev 2019-09-18 dneto Finalize v2019.0 Roll third_party/glslang/ 664ad41..caca1d1 (12 commits) KhronosGroup/glslang@664ad41...caca1d1 $ git log 664ad41..caca1d1 --date=short --no-merges --format='%ad %ae %s' 2019-09-17 cepheus SPV_KHR_physical_storage_buffer/SPV: Add GL_EXT_buffer_reference_uvec2 2019-09-16 digit Fix Fuchsia build. 2019-09-18 cepheus README: Fix WASM typos. 2019-09-18 cepheus HLSL: Fix KhronosGroup#1903 Catch 0-argument case to constructors. 2019-09-08 jbolz Add GL_EXT_shader_subgroup_extended_types support 2019-08-28 cepheus GLSL: Only require constant for subgroupBroadcast when SPV < 1.5. 2019-08-18 cepheus SPV: Support SPIR-V 1.5; five extensions no longer need OpExtension. 2019-09-09 laddoc Add flags for local size values ( compute shader ) 2019-09-13 cepheus SPV 1.5: Switch to the 1.5 header, for SPIR-V 1.5. 2019-09-11 dsinclair Comment out params instead of removing 2019-09-10 dsinclair Remove unused params 2019-09-09 rex.xu Fix incorrect function prototypes of 64-bit findLSB/findMSB Roll third_party/googletest/ 3f05f651a..f2fb48c3b (9 commits) google/googletest@3f05f65...f2fb48c $ git log 3f05f651a..f2fb48c3b --date=short --no-merges --format='%ad %ae %s' 2019-09-16 krystian.kuzniarek Googletest export 2019-09-13 misterg Googletest export 2019-09-12 hgsilverman Googletest export 2019-09-11 absl-team Googletest export 2019-09-10 absl-team Googletest export 2019-09-09 absl-team Googletest export 2019-09-06 absl-team Googletest export 2019-09-06 absl-team Googletest export 2019-08-12 krystian.kuzniarek restore mistakenly removed iffs in their explicit form Roll third_party/spirv-cross/ b32a1b415..5431e1da2 (7 commits) KhronosGroup/SPIRV-Cross@b32a1b4...5431e1d $ git log b32a1b415..5431e1da2 --date=short --no-merges --format='%ad %ae %s' 2019-09-19 post Update SPIR-V headers. 2019-09-19 post MSL: Fix 16-bit integer literals. 2019-09-18 rharrison Update external/ to SPIR-V 1.5 2019-09-18 post CMake: Add option to force -fPIC. 2019-09-17 post Fix -Wshorten-64-to-32 warnings. 2019-09-16 post CMake: Add option to skip installation targets. 2019-09-12 post Consider discard and demote as impure statements. Roll third_party/spirv-headers/ 38cafab..601d738 (2 commits) KhronosGroup/SPIRV-Headers@38cafab...601d738 $ git log 38cafab..601d738 --date=short --no-merges --format='%ad %ae %s' 2019-09-18 cepheus Add SPV_KHR_physical_storage_buffer. 2019-09-13 cepheus SPIR-V 1.5. Roll third_party/spirv-tools/ 76261e2..08fcf8a (28 commits) KhronosGroup/SPIRV-Tools@76261e2...08fcf8a $ git log 76261e2..08fcf8a --date=short --no-merges --format='%ad %ae %s' 2019-09-19 ehsannas Fix header include syntax. (KhronosGroup#2882) 2019-09-19 stevenperron Handle OpConstantNull in copy-prop-arrays. (KhronosGroup#2870) 2019-09-19 dneto Fix comment typo found by protobufs linter (KhronosGroup#2884) 2019-09-19 dsinclair Move docs into docs/ folder (KhronosGroup#2872) 2019-09-18 dsinclair Add WebGPU SPIR-V Assembler in JavaScript. (KhronosGroup#2876) 2019-09-18 dneto Android.mk: Add dependency from optimizer file to amd-shader-ballot-insts.inc (KhronosGroup#2883) 2019-09-18 dneto Update SPIRV-Headers in DEPS (KhronosGroup#2880) 2019-09-18 afdx Fix detection of blocks bypassed by new edge (KhronosGroup#2874) 2019-09-18 afdx Fix CMake issue related to spirv-fuzz (KhronosGroup#2877) 2019-09-18 afdx Add fuzzer pass to replace ids with synonyms (KhronosGroup#2857) 2019-09-18 alanbaker Relaxed bitcast with pointers (KhronosGroup#2878) 2019-09-17 52076061+digit-google Fix Fuchsia build. (KhronosGroup#2868) 2019-09-16 raun.krisch Adding valilidation checks for OpEntryPoint duplicate names and execution mode (KhronosGroup#2862) 2019-09-16 alanbaker Extra resource interface validation (KhronosGroup#2864) 2019-09-13 alanbaker Split capability tests (KhronosGroup#2866) 2019-09-13 alanbaker SPIRV-Tools support for SPIR-V 1.5 (KhronosGroup#2865) 2019-09-11 afdx Add fuzzer pass to copy objects (KhronosGroup#2853) 2019-09-11 rharrison Handle another case where creating a constant can fail (KhronosGroup#2854) 2019-09-11 stevenperron Don't inline function containing OpKill (KhronosGroup#2842) 2019-09-11 stevenperron Handle id overflow in wrap op kill. (KhronosGroup#2851) 2019-09-11 dneto Assembler: Can't set an ID in instruction without result ID (KhronosGroup#2852) 2019-09-10 zoddicus Handle creating a new constant failing gracefully (KhronosGroup#2848) 2019-09-10 afdx Rework management of probabilities in spirv-fuzz (KhronosGroup#2839) 2019-09-10 afdx Fix add-dead-break and add-dead-continue passes to respect dominance (KhronosGroup#2838) 2019-09-10 stevenperron Handle id overflow in the ssa rewriter. (KhronosGroup#2845) 2019-09-09 stevenperron Handle id overflow in the constant manager. (KhronosGroup#2844) 2019-09-09 alanbaker Add generic builtin validation of target (KhronosGroup#2843) 2019-09-09 stevenperron Don't register duplicate decoration in validator. (KhronosGroup#2841) Created with: roll-dep third_party/effcee third_party/glslang third_party/googletest third_party/re2 third_party/spirv-cross third_party/spirv-headers third_party/spirv-tools
This CL adds a simple JavaScript library which will assemble SPIR-V
Assembly compatable with WebGPU.