Skip to content

rdna2spirv: support run-time wave32 s_bfm_b64 width and offset - #8409

Draft
LukeOsland1 wants to merge 1 commit into
ItsNotRexed:mainfrom
LukeOsland1:codex/wave32-dynamic-bfm64
Draft

LukeOsland1 wants to merge 1 commit into
ItsNotRexed:mainfrom
LukeOsland1:codex/wave32-dynamic-bfm64

Conversation

@LukeOsland1

@LukeOsland1 LukeOsland1 commented Nov 23, 2026 •

Copy link
Copy Markdown

Coordination claim. Based directly on main at 6dda063.

A wave32 compute shader with an ordinary SGPR holding the width or offset of s_bfm_b64 previously stopped translation with Unsupported. For an SGPR-pair destination, emit each 32-bit word by intersecting the requested bit range with that word. This uses 32-bit operations, takes the low six bits of both operands, and preserves SCC. Both source values are read before writing the destination pair. Compile-time operands still fold to constants.

  • Parent regression: the new run-time case raises Unsupported before producing a shader.
  • Branch: all seven wave32 BFM tests pass. The interpreter checks boundary values, high input bits, overlapping registers, and SCC. The generated synthetic compute module passed spirv-val (Vulkan 1.2).
  • Native Windows compute readback: RTX 4070 Ti SUPER (32.0.16.1088) and AMD Radeon(TM) Graphics (32.0.21042.62), verified device names and required compute subgroup size 32. Each ran all 4,096 combinations of 6-bit width and offset, with the destination overlapping both inputs. Each adapter returned the ISA formula's low and high words and the original SCC for all 131,072 invocations. Zero mismatches.
  • Semantic suite: 447 files, 5,957 tests. Two files failed. Re-running both files on the parent reproduced the same failures: one in test_image_store_d16 and 47 subtests in test_image_atomics_guard.
  • Matched 200-shader slice: 200 translated and 200 spirv-val-valid on both revisions. Full-corpus comparison running.

AI-assisted with Codex. All fixtures are hand-written.

@morodirule

Copy link
Copy Markdown

Tested 4a1278e on Arch Linux, Python 3.14.10, CPU only: pass — first Linux check. test_wave32_bfm64 7/7 + related bfm suites green. Negative control: base translator → runtime-operand test errors (Unsupported); restored, green again. No game files. AI-assisted.

@morodirule

Copy link
Copy Markdown

Tested 4a1278e on Arch Linux, Python 3.14.10, CPU only: pass — first Linux check. new test_wave32_bfm64_data 7/7 + related bfm suites green. Negative control: base tool → runtime-operand test errors; restored, green again. No game files. AI-assisted.

@NiHuShu

NiHuShu commented Nov 23, 2026

Copy link
Copy Markdown

AI-assisted native wave32 hardware check. On 4a1278ecbc9a7eb7aea5a8dfbeeab3c89efca48c all 4,096 runtime width/offset pairs produced the expected two data words. Both runtime operands aliased the destination, carried additional upper bits, and came from the workgroup ID. All 4,096 SCC values and group-ID controls also matched. A second fixture with immediate operands (2,54) matched every word on both revisions.

On parent 6dda0630bd6fc0514baadb94fb98e36bd7d64c0b the translator exited 0 but reported “s_bfm_b64 with a run-time operand in wave32” and emitted only the literal control. Head emitted both modules, both passed spirv-val, and both dispatches exited 0. One parent case blocked at translation, zero harness skips.

CachyOS, CPython 3.14.10, LLVM 23.1.5, SPIRV-Tools 2026.4, NVIDIA GeForce RTX 4080 620.70.06, subgroup 32, Khronos validation on. Used synthetic FSPX metadata with wave32 set. Commands: python -I tools/rdna2spirv.py <disasm> --out <out>, then VKC_SUBGROUP_SIZE=32 VKC_DUMP=<file> vk_compute_test <spv> 4096 dump.

@memorypressure

Copy link
Copy Markdown

Tested 4a1278e vs main 867d922 (tree 8c7963164): tests/semantic/test_wave32_bfm64_data.py Ran 7 OK (re-run here); on clean main the new pair tests fail via the old Unsupported path — not vacuous. Differential mutations: masking with &31 instead of &63 → 3 failures; clamping word 1 at 16 instead of 32 → 6 failures; source md5-clean after each. SCC-preservation and dest-overlaps-source aliasing both have teeth via the s_cmp/s_cselect readback. The docs row's hardware citation names device + method. Flags: NO CI checks reported; overlap with #2956 in tools/rdna2spirv.py/docs/design.md (known trio) — merge-order care. AI-assisted: yes. Tested on Linux (RTX 5080 host, CPU-only run).

@N4use4tic

Copy link
Copy Markdown

Tested 4a1278e on Windows 11, Python 3.14.4, no GPU or LLVM: pass.
From tests/semantic: test_wave32_bfm64_data (7 tests) and test_wave64_subgroup_ops (6) OK; tests/test_lane_masks.py ok.
test_image_atomics_guard and test_image_store_d16 are still red, as on main (#7284).
Note: this PR conflicts with #8264 (2 conflicts, both touch the s_bfm_b64 path and test_wave32_bfm64_data.py); whichever lands second needs a rebase.
Code not reviewed beyond the test run.

@ne1i

ne1i commented Nov 23, 2026

Copy link
Copy Markdown

Tested 4a1278ec on Linux, CPython 3.14, CPU only, merged onto main 867d922f: pass

  • python -m unittest discover -s tests/semantic -p test_wave32_bfm64_data.py: Ran 7 tests, OK. With only tools/rdna2spirv.py reverted to main: FAILED (errors=1), so the new tests exercise the change.

I ran only this PR's own test file, not the whole semantic suite.

Independent check (not the author). Run by an AI agent (DeepSeek V4.1 Flash) and re-run by the orchestrating session (Claude Code) before posting.

@Atomic258

Copy link
Copy Markdown
Contributor

Tested 4a1278ec on Windows Server 2022, CPython 3.13.12: pass

  • python -I -m unittest discover -s tests/semantic -p "test_wave32_bfm64_data.py" -> OK

git diff --check clean; python -m compileall -q exit 0. No game files, no GPU. AI-assisted (Devin).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants