RDNA2 (RX 6800): RGP capture of a prison frame, hardware BVH node test timing, and negative results #35

Open
opened 2026-12-01 01:06:17 +00:00 by github-bot · 1 comment
Owner

@⁠just-another-dude84 on GitHub · 2026-12-01 01:04 UTC · original

Seen on: 3a0b738 plus the 4 commits of just-another-dude84:rdna2-fixes, PR #22 (LDS stack pops), and local experiment
patches that are not proposed (translator switch for the hardware node test, a small Mesa 26.3.1 patch and a dxil-spirv
patch for it, an ACO occupancy switch). RX 6800, RADV/ACO from Mesa 26.3.1, prison cell scene, 2560x1440.

This issue reports findings for two items in docs/TASKS.md: "GPU time: ray tracing and GI compute" (the RGP capture
it lists as missing) and "Hardware BVH node test" (step 1, timed on the card).

1. RGP works on RDNA2 with a single Vulkan device

The capture ran on Mesa 26.3.1 without the #9 patch. The only Mesa change was the node-test patch, which does not touch
tracing. Settings:

  • MESA_VK_TRACE=rgp
  • MESA_VK_TRACE_TRIGGER=<file>: the present path checks for the file and deletes it, so each touch captures one frame
  • RADV_THREAD_TRACE_INSTRUCTION_TIMING=true for per-instruction timing

Touch the trigger at least 150 s after reaching the world; a run that ends before the trigger writes nothing. RADV
writes the .rgp to /tmp (0.5-0.9 GB per frame). Code objects can be cut out of the .rgp at their ELF magic and
read with llvm-readelf --notes (VGPRs, SGPRs, LDS) and llvm-objdump -d --mcpu=gfx1030.

2. Hardware BVH node test (TASKS step 1)

image_bvh64_intersect_ray emitted through a private SPIR-V op, mapped in vtn_amd.c onto RADV's existing intrinsic.
Execute #13 (the execute holding the RT walkers, frames.py --exec 13, world 90-190 s, run medians):

arm runs #13
emulated node test (with PR #22) 3 14.80-14.82 ms
hardware node test (with PR #22) 3 13.11-13.21 ms

That is -1.65 ms (-11 % of #13, about 4-5 % of the ~35 ms GPU frame). The arms ran one after the other, not
interleaved, and there were no GPU faults in any of the 6 runs. On its own, PR #22 moved emulated #13 from 15.03-15.08
to 14.80 ms. Whether that win counts as "large" for step 2 is your call; we stop at step 1 until you decide.

3. What the walker spends its time on (hardware node test on)

Shader f22a76fc (hash prefix; it is the top dispatch of the frame) has this profile under thread trace:

share of shader time emulated hardware
VALU 38.3 % 8.7 %
s_waitcnt 31.8 % 68.4 %
SALU 12.9 % 8.5 %
instructions 4967 3935
  • Once the node test's ALU work is gone, the walker is limited by memory latency.
  • About 37 % of its time is two waits on instance-node data. That data is loaded after the node test through
    Lower::memory's per-lane view loop (readfirstlane, then s_load_dwordx4, then buffer_load).
  • About 17 % is waiting on the node test itself.
  • Resources: 80 VGPRs, 108 SGPRs, 2 KB LDS, no spills, which allows 12 of 16 waves per SIMD.

4. Negative results (to save others the time)

  • Direct addressing for those loads does not help. I hand-patched f22a76fc's SPIR-V so the instance loads use
    buffer device addresses instead of the view loop. Over 3 interleaved pairs #13 moved -0.07 ms, with VGPRs unchanged.
    The cost is the dependent load after the node test, not the descriptor loop. This bears on the planned direct
    translator: BDA is right for other reasons, but expect no GPU time from it alone here.
  • Changing code generation hangs the GPU. Two unrelated compiler changes each failed on their first
    game run, with the same signature: one UTCL2 read fault at an address past the title window, then a gfx ring timeout
    and reset. The two changes:
    • (a) ACO's minimum waves raised for f22a76fc only: 64 VGPRs and 16 waves, 6 VGPRs spilled. ACO's IR, RA and
      liveness validators were clean. Fault at 0x0000e04494b83000, 17 s into the world.
    • (b) ACO_DEBUG=nosched-ilp for every shader. Fault at 0x0000e03f9384e000, 62 s into the world.
      Without either switch, 19 hardware node-test runs and 6 emulated runs the same day had no faults. My reading is that some translated program reads a
      value that is undefined on the console path, so its result depends on register allocation and scheduling; I have not
      located it. This was seen on the hardware node-test build only. It may belong under "DPP and swizzles reading inactive
      lanes" or "Loop limits".
  • Other cheap switches: the RADV SAM switches only move command buffers. wave64 is refused because vkback
    requires subgroup size 32.

Run data, scripts and the timing exports are on our side; I can attach any of them (no game images).

**@⁠just-another-dude84** on GitHub · 2026-12-01 01:04 UTC · [original](https://github.com/vktory6/VKtory/issues/35) Seen on: 3a0b738 plus the 4 commits of just-another-dude84:rdna2-fixes, PR #22 (LDS stack pops), and local experiment patches that are not proposed (translator switch for the hardware node test, a small Mesa 26.3.1 patch and a dxil-spirv patch for it, an ACO occupancy switch). RX 6800, RADV/ACO from Mesa 26.3.1, prison cell scene, 2560x1440. This issue reports findings for two items in `docs/TASKS.md`: "GPU time: ray tracing and GI compute" (the RGP capture it lists as missing) and "Hardware BVH node test" (step 1, timed on the card). ## 1. RGP works on RDNA2 with a single Vulkan device The capture ran on Mesa 26.3.1 without the #9 patch. The only Mesa change was the node-test patch, which does not touch tracing. Settings: - `MESA_VK_TRACE=rgp` - `MESA_VK_TRACE_TRIGGER=<file>`: the present path checks for the file and deletes it, so each touch captures one frame - `RADV_THREAD_TRACE_INSTRUCTION_TIMING=true` for per-instruction timing Touch the trigger at least 150 s after reaching the world; a run that ends before the trigger writes nothing. RADV writes the `.rgp` to `/tmp` (0.5-0.9 GB per frame). Code objects can be cut out of the `.rgp` at their ELF magic and read with `llvm-readelf --notes` (VGPRs, SGPRs, LDS) and `llvm-objdump -d --mcpu=gfx1030`. ## 2. Hardware BVH node test (TASKS step 1) `image_bvh64_intersect_ray` emitted through a private SPIR-V op, mapped in `vtn_amd.c` onto RADV's existing intrinsic. Execute #13 (the execute holding the RT walkers, `frames.py --exec 13`, world 90-190 s, run medians): | arm | runs | #13 | |---|---|---| | emulated node test (with PR #22) | 3 | 14.80-14.82 ms | | hardware node test (with PR #22) | 3 | 13.11-13.21 ms | That is -1.65 ms (-11 % of #13, about 4-5 % of the ~35 ms GPU frame). The arms ran one after the other, not interleaved, and there were no GPU faults in any of the 6 runs. On its own, PR #22 moved emulated #13 from 15.03-15.08 to 14.80 ms. Whether that win counts as "large" for step 2 is your call; we stop at step 1 until you decide. ## 3. What the walker spends its time on (hardware node test on) Shader f22a76fc (hash prefix; it is the top dispatch of the frame) has this profile under thread trace: | share of shader time | emulated | hardware | |---|---|---| | VALU | 38.3 % | 8.7 % | | s_waitcnt | 31.8 % | 68.4 % | | SALU | 12.9 % | 8.5 % | | instructions | 4967 | 3935 | - Once the node test's ALU work is gone, the walker is limited by memory latency. - About 37 % of its time is two waits on instance-node data. That data is loaded after the node test through `Lower::memory`'s per-lane view loop (readfirstlane, then s_load_dwordx4, then buffer_load). - About 17 % is waiting on the node test itself. - Resources: 80 VGPRs, 108 SGPRs, 2 KB LDS, no spills, which allows 12 of 16 waves per SIMD. ## 4. Negative results (to save others the time) - **Direct addressing for those loads does not help.** I hand-patched f22a76fc's SPIR-V so the instance loads use buffer device addresses instead of the view loop. Over 3 interleaved pairs #13 moved -0.07 ms, with VGPRs unchanged. The cost is the dependent load after the node test, not the descriptor loop. This bears on the planned direct translator: BDA is right for other reasons, but expect no GPU time from it alone here. - **Changing code generation hangs the GPU.** Two unrelated compiler changes each failed on their first game run, with the same signature: one UTCL2 read fault at an address past the title window, then a gfx ring timeout and reset. The two changes: - (a) ACO's minimum waves raised for f22a76fc only: 64 VGPRs and 16 waves, 6 VGPRs spilled. ACO's IR, RA and liveness validators were clean. Fault at `0x0000e04494b83000`, 17 s into the world. - (b) `ACO_DEBUG=nosched-ilp` for every shader. Fault at `0x0000e03f9384e000`, 62 s into the world. Without either switch, 19 hardware node-test runs and 6 emulated runs the same day had no faults. My reading is that some translated program reads a value that is undefined on the console path, so its result depends on register allocation and scheduling; I have not located it. This was seen on the hardware node-test build only. It may belong under "DPP and swizzles reading inactive lanes" or "Loop limits". - **Other cheap switches:** the RADV SAM switches only move command buffers. wave64 is refused because vkback requires subgroup size 32. Run data, scripts and the timing exports are on our side; I can attach any of them (no game images).
github-bot locked as GitHub sync and limited conversation to collaborators 2026-12-01 01:06:17 +00:00
Author
Owner

@⁠vktory6 on GitHub · 2026-12-01 07:34 UTC · original

Thank you, this is very useful. I added it to the tasks in github.com/vktory6/VKtory@5169307:

  • RGP: "GPU time: ray tracing and GI compute" now says RGP works on stock RADV with one device, and docs/learnings/gpu-time.md has your settings.
  • Walker profile: the memory-bound profile and the negative result for direct addressing are also in that item.
  • Hardware node test: your step 1 numbers are in its item. On step 2: we decide on the target hardware, so the next step is the same measurement on an RDNA4 card. That also answers whether RDNA4 runs the console's node format exactly. Until then, step 2 waits.
  • The two GPU hangs from code-generation changes: they're in that item as an open lead (a value the console leaves undefined, read by a translated program). If you ever narrow down which program, please post it here.
**@⁠vktory6** on GitHub · 2026-12-01 07:34 UTC · [original](https://github.com/vktory6/VKtory/issues/35#issuecomment-7304231302) Thank you, this is very useful. I added it to the tasks in https://github.com/vktory6/VKtory/commit/5169307: - **RGP:** "GPU time: ray tracing and GI compute" now says RGP works on stock RADV with one device, and `docs/learnings/gpu-time.md` has your settings. - **Walker profile:** the memory-bound profile and the negative result for direct addressing are also in that item. - **Hardware node test:** your step 1 numbers are in its item. On step 2: we decide on the target hardware, so the next step is the same measurement on an RDNA4 card. That also answers whether RDNA4 runs the console's node format exactly. Until then, step 2 waits. - **The two GPU hangs from code-generation changes:** they're in that item as an open lead (a value the console leaves undefined, read by a translated program). If you ever narrow down which program, please post it here.
This discussion has been locked. Commenting is limited to contributors.
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
github/vktory6--VKtory#35
No description provided.