upleb.uk

Public git repos — served from a NIP-34 GRASP relay at git.upleb.uk

summaryrefslogtreecommitdiff
path: root/docs/embedded_shaders.md
diff options
context:
space:
mode:
authorDominik <55330408+Dom-in@users.noreply.github.com>2026-11-22 21:07:38 +0000
committerDominik <55330408+Dom-in@users.noreply.github.com>2026-11-22 21:07:38 +0000
commit6d458e4b05d52ab396ddbd09af32f40bcf5ceb19 (patch)
tree2441b7f1dc5216c981fddc0875ec855ee8edd33e /docs/embedded_shaders.md
parent3a94ab0c71b364ed20b4fb3d405d3665e24050be (diff)
bvh_gpu_smoke: run XboxBvhBuilder's translated programs on the GPU (TEST-594)
tools/bvh_gpu_smoke.py translates the 52 embedded programs from the package (the pipeline docs/embedded_shaders.md documents) and runs each through vk_compute_test twice, with a root table seeded by VKC_HEAP_INIT whose words point past it into zeros. A run passes when it exits 0, the validation layer reports nothing and both runs write the same heap bytes. On an RX 9070 all 49 non-rehydration programs pass; seven change heap words with these inputs. The wave64 bitonic sorts need --max-shared-memory set to the device's 32 KiB; docs/embedded_shaders.md records the run and what it does and doesn't show. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Diffstat (limited to 'docs/embedded_shaders.md')
-rw-r--r--docs/embedded_shaders.md25
1 files changed, 23 insertions, 2 deletions
diff --git a/docs/embedded_shaders.md b/docs/embedded_shaders.md
index a2aa99262..50bfa2981 100644
--- a/docs/embedded_shaders.md
+++ b/docs/embedded_shaders.md
@@ -143,13 +143,34 @@ python -I tools/rdna2spirv.py <work>/embedded/dxbc/disasm --out <work>/embedded/
143 `Box32Rehydration` and `LeafRehydration` are exactly the programs that would turn the dehydrated BVH packs 143 `Box32Rehydration` and `LeafRehydration` are exactly the programs that would turn the dehydrated BVH packs
144 into runtime trees ([bvh.md](bvh.md) §3.1). `LeafRehydration` translates since #1871, `Box32Rehydration` 144 into runtime trees ([bvh.md](bvh.md) §3.1). `LeafRehydration` translates since #1871, `Box32Rehydration`
145 translates since #1968 (`427c1376`), and only `Box16Rehydration` awaits #1864 (`buffer_store_short`). 145 translates since #1968 (`427c1376`), and only `Box16Rehydration` awaits #1864 (`buffer_store_short`).
146* **What is still open.** None of the 52 has been executed on a GPU; translation and `spirv-val` do not prove the 146* **They run on a GPU (TEST-594).** `tools/bvh_gpu_smoke.py` translates them from the package and runs each through
147 output. Which of them the game actually creates is a call-site question (RT-5). The module-to-pipeline order 147 `vk_compute_test`. Each program reads its root arguments from a table at `s[0:1]`, the heap base there, which the
148 tool seeds with `VKC_HEAP_INIT`: every table word points past the table into zeros. **All 49 that aren't
149 rehydration programs pass**: exit 0, no Khronos validation error, and the same heap bytes on a second run (AMD
150 Radeon RX 9070, Windows 11, `--max-shared-memory 32768`, package 1.0.2.1). With these inputs only seven change any
151 heap word (`InitHeaders`, `InitPartitionedHeaders`, `LoadInstances`, `LoadProceduralGeometry`, `LoadTriangles`,
152 `PT_BeginPass`, `PT_WriteInstances`); the others leave early. So this shows that the translated programs run
153 cleanly, not that their output is right. Two things found on the way:
154 * the wave64 bitonic sorts (`BitonicPreSort64CS`, `BitonicInnerSort64CS`) declare 32,780 bytes of workgroup memory
155 with the translator's default cap, 12 over the 32 KiB AMD's Windows driver allows
156 (`VUID-RuntimeSpirv-Workgroup-06530`). Their highest LDS offset is 8192, and `--max-shared-memory 32768` shrinks
157 the array to what they use;
158 * with every table word 0 instead, the descriptors point at the table itself, and `RadixCount` then writes into the
159 table that other waves are reading, so its output differs between runs. That is the test input, not the
160 translator; the tool's default avoids it.
161* **What is still open.** The programs' outputs are not checked against a reference yet (only the rehydration trio has
162 one, TEST-376: `tools/bvh_rehydrate.py`); `LeafRehydration` does not finish within 60 s with either table described
163 above. Which of them the game actually creates is a call-site question (RT-5). The module-to-pipeline order
148 above comes from `ILDN`, not from a runtime trace. The `STAT` bitcode and the `0x07 NOBC` record are not 164 above comes from `ILDN`, not from a runtime trace. The `STAT` bitcode and the `0x07 NOBC` record are not
149 explained. 165 explained.
150 166
151## 6. Tool and tests 167## 6. Tool and tests
152 168
169`tools/bvh_gpu_smoke.py --game-dir <package> [--max-shared-memory N] [--json report.json]` reproduces the GPU run
170above: the extraction and translation of §4, then two dispatches per program. Its report holds module names, statuses
171and counts only. `tests/test_bvh_gpu_smoke.py` checks the heap image, the word count and the judging of runs with a
172fake `vk_compute_test`, without a GPU or game files.
173
153`tools/pe_shader_containers.py` is standard library only and reads the file, never runs it. It accepts a 174`tools/pe_shader_containers.py` is standard library only and reads the file, never runs it. It accepts a
154container only when the chunk table is sorted, 4-byte aligned, entirely inside the declared total and its last 175container only when the chunk table is sorted, 4-byte aligned, entirely inside the declared total and its last
155chunk ends exactly at that total; that is what rejects the FSR DLL's `DXBC` immediate. The synthetic tests in 176chunk ends exactly at that total; that is what rejects the FSR DLL's `DXBC` immediate. The synthetic tests in