Repository navigation
rdna2spirv: every saveexec kind and s_andn1_wrexec - #1657
Conversation
Only and/or/andn2_saveexec and andn2_wrexec were translated; xor, andn1, orn1, orn2, nand, nor and xnor_saveexec (b32/b64) and andn1_wrexec were rejected. One table (Gen.EXEC_LOGIC, the definitions of tools/cf_ref.py _SAVEEXEC) now gives f(S0, EXEC) for the whole family; the existing three kinds emit the same code as before. tests/semantic/test_saveexec_variants.py checks every lane's saved bit, new EXEC and SCC against cf_ref._SAVEEXEC in wave32 and wave64; cf_diff (300 programs x wave32/64) still passes. docs/design.md row added.
|
Tested 6cfcf7c on NVIDIA GeForce RTX 5080 (616.92) and AMD Radeon RDNA2 iGPU (26.10.1), Windows 11: pass I ran all seven new saveexec kinds (
What the shaders do. For each case, S0 comes from a Main pattern: low 32 lanes S0 =
The Each op also has a second case whose result is empty, so SCC must be 0: xor and andn1 with S0 = EXEC = the pattern, nor and xnor with EXEC = ~S0, nand with both all ones, orn1 with S0 = all and EXEC = 0, orn2 with S0 = 0 and EXEC = all, and andn1_wrexec with S0 = EXEC (D = 0). In every run all eight gave EXEC 0, SCC 0, and D equal to the old EXEC (or 0 for wrexec). Negative control: I changed The shaders are about 290 and 320 lines (16 cases each), too long to paste here. If you want them as GPU fixtures in this PR or a follow-up, I can post them or open a small PR that registers them in AI-assisted. |
|
Tested 6cfcf7c on NVIDIA GeForce RTX 3070 (Ampere, subgroup 32..32), driver 610.57.04 (Vulkan 1.4.341), Debian 13 (kernel 6.12.115): pass, no regression. Adds Linux and a negative control to @Vonsek's GPU run above. Base is
AI-assisted: yes |
|
Tested
AI-assisted (Claude Code). |
…xed#1657 s_xor/andn1/orn1/orn2/nand/nor/xnor_saveexec_b32 and s_andn1_wrexec_b32 were merged with CPU checks only. cs_w32_saveexec_ext.asm runs each with EXEC = lanes 0..23 and S0 = lanes 10..29 (from compares) and stores (s_bcnt1 << 8) | s_ff1 of the new EXEC, a whole-wave word. It is a wave32 lane-mask dump (WAVE32_LANE_DUMPS), skipped below 32 lanes. tests/semantic/test_saveexec_ext_fixture.py runs the fixture on the CPU against tools/cf_ref.py's _SAVEEXEC and checks both runners expect the same words.
|
Correction to my note above: like on #1640, I compared this branch with Rerun on the same seeded 400 (from the 18,001 corpus shaders with an AI-assisted (Claude Code). |
…xed#1657 s_xor/andn1/orn1/orn2/nand/nor/xnor_saveexec_b32 and s_andn1_wrexec_b32 were merged with CPU checks only. cs_w32_saveexec_ext.asm runs each with EXEC = lanes 0..23 and S0 = lanes 10..29 (from compares) and stores (s_bcnt1 << 8) | s_ff1 of the new EXEC, a whole-wave word. It is a wave32 lane-mask dump (WAVE32_LANE_DUMPS), skipped below 32 lanes. tests/semantic/test_saveexec_ext_fixture.py runs the fixture on the CPU against tools/cf_ref.py's _SAVEEXEC and checks both runners expect the same words.
…xed#1657 s_xor/andn1/orn1/orn2/nand/nor/xnor_saveexec_b32 and s_andn1_wrexec_b32 were merged with CPU checks only. cs_w32_saveexec_ext.asm runs each with EXEC = lanes 0..23 and S0 = lanes 10..29 (from compares) and stores (s_bcnt1 << 8) | s_ff1 of the new EXEC, a whole-wave word. It is a wave32 lane-mask dump (WAVE32_LANE_DUMPS), skipped below 32 lanes. tests/semantic/test_saveexec_ext_fixture.py runs the fixture on the CPU against tools/cf_ref.py's _SAVEEXEC and checks both runners expect the same words.
Only
s_and/or/andn2_saveexec_b32/b64ands_andn2_wrexec_b32/b64were translated. The other saveexec kinds (xor,andn1,orn1,orn2,nand,nor,xnor) ands_andn1_wrexecraisedUnsupported; #1562's ISA coverage lists them as unknown.s_xor_saveexecis the one LLVM'sSI_ELSElowering uses.Change: one table,
Gen.EXEC_LOGIC, givesf(S0, EXEC)for the whole family as (op, NOT S0, NOT EXEC, NOT result).D = EXEC; EXEC = f(S0, EXEC); SCC = (EXEC != 0)EXEC = f(S0, EXEC); D = EXECtools/cf_ref.py_SAVEEXEC, the FUZZ-8 ISA model.andn1complements S0 andandn2complements EXEC.fis the bitwise op on that bit. A lane EXEC had off becomes active whenfgives 1 for it, as on hardware (nand,nor,orn1,orn2,xnor, ...). SCC is the wave vote, as before.Tests:
tests/semantic/test_saveexec_variants.pyruns translated pixel shaders inspirv_wave_interp. EXEC starts partial (v_cmpx) and S0 is a different lane range. Every lane's saved bit, new EXEC bit and SCC are checked againstcf_ref._SAVEEXEC:python -I tools/cf_diff.py --self-testpasses, and--programs 300 --seed 7 --wave bothgives 600 pass, 0 mismatch.python -I -m unittest discover -s tests/semantic: 1341 tests OK (2 skipped).docs/design.md: new row after "EXEC".This doesn't touch the existing tests for the and/or/andn2 kinds (#1299, #1326, @Vonsek's GPU test claim), or #663. Tested on CPU only; no GPU run for the seven new kinds. No game files.
AI-assisted (Claude Code): I reviewed and ran the change and the tests.