Skip to content

hw_oracle: native RDNA2 measurement of ds_permute_b32 (SHADER-133) - #2178

Merged
ItsNotRexed merged 2 commits into
ItsNotRexed:mainfrom
Faterek:shader-133-ds-permute-rdna2
Nov 22, 2026
Merged

ItsNotRexed merged 2 commits into
ItsNotRexed:mainfrom
Faterek:shader-133-ds-permute-rdna2

Conversation

@Faterek

@Faterek Faterek commented Nov 22, 2026

Copy link
Copy Markdown
Contributor

What and why

Closes SHADER-133 (claimed in #2078). Measures ds_permute_b32 natively on RDNA2 (gfx1036, wave32 and wave64) via tools/hw_oracle and confirms every detail of the translator's Gen.ds_permute implementation (#628/#789):

  • Unaddressed active lanes: receive 0.
  • EXEC masking: off destination lanes preserve their prior VDST; off source lanes send nothing (so an active destination targeted only by an off source gets 0).
  • Collisions: 2-way, 4-way, 32-way, and 31-way (with top lane 31/63 masked off in EXEC) collisions deterministically pick the highest-numbered active lane in the 32-lane half, matching the translator.
  • Address & offset: ((vAddr + offset) >> 2) mod 32, with carry from the low 2 bits before the shift ((3 + 1) >> 2 == 1).
  • Wave64 halves: runs as two completely independent 32-lane halves (vAddr = (lane + 32) * 4 wraps within each half; lanes 0..31 and 32..63 never cross).
  • Partial waves: missing lanes (20 threads in wave32, 40 in wave64) act as EXEC = 0 and send nothing.

No translator change was needed — tools/rdna2spirv.py already matches RDNA2 hardware on all 9 cases.

Added / Updated

  • tools/ds_permute_probe.py — standalone RDNA2 hardware probe (tools/hw_oracle, stdlib-only, --self-test, exit 77 when unavailable/non-GFX10)
  • tests/test_ds_permute_probe.py — CPU-only unit tests for the probe
  • docs/design.md — recorded the native gfx1036 verification in the LDS / ds_permute_b32 row

Tested

  • Native RDNA2 hardware (tools/ds_permute_probe.py): AMD Ryzen 7 9800X3D iGPU (gfx1036, Linux 7.3.4-1-cachyos, AMDGPU DRM via tools/hw_oracle):
    • wave32 (gfx1036): 9/9 ds_permute_b32 cases exact
    • wave64 (gfx1036): 9/9 ds_permute_b32 cases exact
  • CPU / semantic:
    • python3 -m compileall -q make_game.py tools tests clean
    • pytest -q tests/test_ds_permute_probe.py tests/test_tool_stdout_encoding.py: 4 passed
    • python3 -m unittest discover -s tests/semantic -p test_ds_permute.py -v: 5/5 passed
  • No game data, keys, or online services.

AI-assisted.

@ddm-j

ddm-j commented Nov 22, 2026

Copy link
Copy Markdown

Tested 37dfb03 on AMD Radeon 610M (RDNA2 iGPU, gfx1036, Linux 7.3.4 Fedora 45, AMDGPU DRM via tools/hw_oracle) and NVIDIA RTX 4070 Ti (615.78.08): pass

This is an independent native run of the probe on a second machine. The chip is the same as in the description, a 9800X3D iGPU, so it confirms the result is reproducible. It doesn't add new silicon.

  • tools/ds_permute_probe.py:
    • wave32 (gfx1036): 9/9 ds_permute_b32 cases exact
    • wave64 (gfx1036): 9/9 ds_permute_b32 cases exact
    • --self-test: OK.
  • tests/test_ds_permute_probe.py: 2 passed. tests/semantic: 1671 OK.
  • run_gpu_tests.py gives the same as main 4eb6155: RADV 167/180, 13 skipped; NVIDIA 136/180, 44 skipped; NVIDIA with LEONIDA_W64_EMULATE=1 167/180, 13 skipped.

Setup: Fedora clang 23.1.5 and lld, libdrm 2.4.134, LEONIDA_HW_DRM_NODE set to the iGPU's render node. No display is attached to that GPU. runner.py reports arch=gfx1036 engine=10.0.

AI-assisted (Claude Code); numbers copied from the run logs.

@Dom-in

Dom-in commented Nov 22, 2026

Copy link
Copy Markdown
Contributor

Checked on an AMD Radeon RX 9070 (RDNA4, gfx1201), Windows 11, merged onto main 4947579 (clean merge). This card is not RDNA2, so it can't give the measurement itself; what I could check:

  • ds_permute_probe --self-test: OK.
  • ds_permute_probe natively through tools/hw_oracle (AMD clang from rocm-sdk-core): SKIP: gfx1201 is not GFX10 (RDNA1/RDNA2), exit 0. It refuses non-GFX10 hardware cleanly instead of reporting RDNA4 results as RDNA2 ones.
  • tests/test_ds_permute_probe.py: 2 passed.
  • scripts/run_gpu_tests.py: 167/180 native and 167/180 with LEONIDA_W64_EMULATE=1, 0 failures. The 13 skips are the 12 run by d3d12_*_test shaders and ps_w64x_readlane (no 64-wide fragment subgroup on this device), the same as main.

AI-assisted (Claude Code); runs on my machine.

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.

4 participants