Repository navigation
spirv_asm: pure-Python Vulkan 1.2 SPIR-V binary assembler - #2251
Conversation
|
Independent Windows review of Runtime fixtures: eight synthetic compute fixtures ( Compatibility gaps in the standalone assembler:
Synthetic inputs only. AI-assisted (Codex). |
|
Tested I found two integer-literal differences in
For the existing floating-literal finding, the same unhandled |
…ng escapes Addresses standalone compatibility review findings on PR ItsNotRexed#2251 (@FreddyxS): - Encode width-aware IEEE-754 hex-float literals (16/32/64-bit) directly into bit patterns, including SPIRV-Tools Inf and NaN payload spellings (0x1p+128 -> 0x7f800000, 0x1.8p+128 -> 0x7fc00000, and f16/f64 equivalents) without OverflowError. - Match SPIRV-Tools literal string decoding in _unquote_string: \<ch> yields <ch> verbatim (e.g. \n -> 'n', not LF). - Add regression test comparing assembled words against spirv-as in tests/test_spirv_asm.py.
|
Thank you @FreddyxS and @duudiis for the thorough RX 9070 XT / 7700X iGPU / RTX 5070 hardware verification and standalone review! Both compatibility gaps reported by @FreddyxS are fixed in
|
|
Independent Windows retest of 45a7cbb on main ec8ec4c: both review findings are resolved. Original review and coordination claim.
Windows 11 build 26200, AMD driver 26.10.1, Python 3.13.15, LLVM MC 23.1.6 and SPIRV-Tools 2026.4. Synthetic inputs only. AI-assisted (Codex). |
|
Tested Runtime and test programs built from this head (MSVC 14.51, Ninja, RelWithDebInfo), native Windows
On Windows, The GPU rows use the default AI-assisted (Claude Code); I checked the results. |
Adds a standard-library-only, pure-Python SPIR-V binary assembler (
tools/spirv_asm.py+ Khronos MIT grammar tables intools/spirv_asm_tables.py) and wires--assembler {spirv-as,python}intotools/rdna2spirv.py(claim: #1902 (comment)).What this adds
tools/spirv_asm_tables.py: compact tables (891 core opcodes, 42 ValueEnums, 16 BitEnums, 81GLSL.std.450extended instructions) generated directly from Khronos GroupSPIRV-Headers(MIT License:spirv.core.grammar.jsonandextinst.glsl.std.450.grammar.json).tools/spirv_asm.py: encodes SPIR-V assembly text directly to binary.spvwords in memory forvulkan1.0..vulkan1.4/spv1.0..spv1.6(defaultvulkan1.2-> SPIR-V 1.5), handling all operand categories (forward%idrefs,ValueEnum/BitEnumascending-bit extra params, int/float 16/32/64OpConstantincluding-0.0and hex floats,OpSwitch,OpPhi,OpExtInstGLSL.std.450,OpSpecConstantOp, escaped strings) with a fast path for pure-ID instructions.tools/rdna2spirv.py: adds--assembler {spirv-as,python}(default staysspirv-asfor full backwards compatibility). With--assembler python --no-asm,rdna2spirv.pyencodes in memory without spawningspirv-asand skips writing the temporary.spvasmfile to disk unless validation fails.Verification
python3 -m unittest tests/test_spirv_asm.py -v: 5/5 OK.runtime/test/shaders/*.asm(native +--wave64-emulate): 164 / 164 modules (1,590,154 SPIR-V words) passedspirv-val --target-env vulkan1.2 --allow-offset-texture-operand(331.6 ms in-process vs 354.8 ms spawningspirv-ason Linux, with zero temporary.spvasmdisk I/O).python3 -m unittest tests/test_tool_startup.py tests/test_text_write_line_endings.py: 4/4 OK.AI-assisted.