Repository navigation
docs: the AMD driver took 34 minutes on LeafRehydration's dispatch-loop module; the current translation compiles in 3 s (SHADER-995) - #6739
Conversation
…k>/shaders/spirv/bvh (D3D-557) On the Vulkan device XboxBvhBuilder's constructor stopped at its first compute PSO: nothing put the DLL's 52 embedded FSSM programs into the shader library. The shaders stage now runs, after the FidelityFX step, the recipe of docs/embedded_shaders.md section 4: pe_shader_containers.py --extract, fssm_unpack.py, shader_disasm.py and rdna2spirv.py, into <work>/shaders/bvh and <work>/shaders/spirv/bvh. Modelled on fspx_shaders: redone as a whole, bvh_build.json written last, and the game's shaders are never translated again for it. The entries are keyed by fssm_sha256 like the game's shaders (shader_meta.py finds the blob beside the listings), so no second key. The step clears the run before first: pe_shader_containers.py never overwrites a container, so a second extraction would leave <module>_NN.dxbc beside the first and those would be translated as more programs. No skip list: the step compares the extraction index with the translation index and logs the counts and every program the runtime cannot find, on every run, also a reused one. Today: 51 of 52, Box16Rehydration (buffer_store_short, ItsNotRexed#1864). None translated fails the step and keeps no index. --max-shared-memory 32768: the constructor throws at the first pipeline that fails, and the runtime refuses a module over maxComputeSharedMemorySize. Measured on 1.0.2.1: with --wave64-emulate RadixAlloc is 37,084 B at the default cap and 22,236 B with this one; no other module changes, natively none does, and the same 51 translate either way. tests/test_bvh_shaders_stage.py: 12 tests on a synthetic DLL (hand-built containers around a made-up FSSM blob, no game data); the extracting, unpacking and disassembling tools are the repository's own. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…rams (D3D-557) ShaderLibrary::load reads <dir>/bvh/index.json after the FSPX index, when it is there. Its entries are named bvh/<name> and go into the table of the game's shaders, by fssm_sha256, so create_compute finds the module for the container XboxBvhBuilder.dll passes to slot 62 through the lookup it already had. A missing or unreadable index leaves the others loaded. bvh_size() counts the entries; shader_library_corpus_test leaves them out of what a carved container must reach, like the FSPX ones. shader_library_test: the bvh/ index found by the container's program hash, counted apart, the same program in both indexes, a broken or missing index beside the others. d3d12_compute_test: a pipeline through slot 62 whose only translation is in <library>/bvh. Both fail with the read taken out. Measured on 1.0.2.1 with the step's output, LEONIDA_BVH_DEVICE=vulkan bvh_builder_test: before, creation ItsNotRexed#1 failed (0x80004005 with no library, 0x80070057 with the game's corpus). Now 49 of 50 creations return S_OK on an RTX 3070 (610.74) and on a Radeon integrated GPU (AMD 32.0.21042.62) with the emulated translation, and the constructor throws at ItsNotRexed#50, Box16Rehydration, which has no module until ItsNotRexed#1864. With that rule applied locally: 53 of 53, constructor and destructor return. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…builder_test measures on the Vulkan device (D3D-557) embedded_shaders.md gets section 7: the step and its four tools, why the key is fssm_sha256, how an untranslated program is reported, what --max-shared-memory 32768 changes (one module, in an emulated build), and the measured runs per GPU and translation, as counts. Section 5's 32,780 B is marked as from before SHADER-579. d3d12_vulkan.md A.2 and the docs index point at it. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Conflicts: - runtime/src/shader_library.h: ItsNotRexed#4333 made load()'s directory a std::filesystem::path; the loop over the fspx and bvh folders now builds its paths with it. - docs/README.md: this branch's embedded_shaders.md row, main's new shader_library.md row and its shader_inputs.md row. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…er run (D3D-557) bvh_shaders() returned at once when the game folder has no XboxBvhBuilder.dll. A work folder used before with a package that had the DLL kept <work>/shaders/spirv/bvh/index.json, and the shader library loads that index whenever it exists, so the modules of the earlier run stayed reachable. The index and bvh_build.json are now removed on that path. Found in review of ItsNotRexed#5680. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…rent translation does not (SHADER-995) The native Radeon stop recorded for the BVH builder step was measured with the translator of main 3faac55, whose structured-depth bound was 16: LeafRehydration's tree nests 18 deep, so it was emitted in the dispatch-loop form, and AMD's Windows driver 32.0.21042.62 (gfx1036) takes 34 minutes of one busy thread to create that pipeline. With the bound at 64 (SHADER-427) the module is structured and is created in 2.9 s; all 51 native modules compile there and the builder's constructor gets 49 of 50, as with the emulated modules. - embedded_shaders.md section 7: the native Radeon row re-measured, the cause, the measurements and the probes (subgroup operations, subgroup size, switch size, spirv-opt, Volatile dispatch variables, reachable cases). - design.md "Control flow": the AMD data point for the dispatch-loop form. - testing.md "Known problems": a row for a pipeline creation that takes tens of minutes on that driver. No code change: the build step needs none. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
|
Tested 447b60b merged with main 1cc6e3c on Linux/Python 3.12.16: fail (a docs check that passes on main fails with this PR) Scope: I ran only the Python/docs side. The C++ changes (runtime/src/shader_library.h, the three runtime/test/*.cpp files) need a Windows runtime build, which I did not do. Commands (fresh worktree of upstream/main with the PR head merged,
Negative control for the new Python test: replacing the |
shayderrr
left a comment
There was a problem hiding this comment.
Summary
- Documents the BVH shader pipeline end to end:
make_game.pybuilds<shaders>/bvh/index.jsonfromXboxBvhBuilder.dll,ShaderLibrary::load()reads it at runtime, and slot 62 creation reaches 49/50 programs beforeBox16Rehydration. - Updates
docs/embedded_shaders.md,docs/d3d12_vulkan.md,docs/design.mdanddocs/README.mdwith the build step, caching,fssm_sha256key and--max-shared-memory 32768measurements.
Why merge
This records a substantial, measured runtime capability and its remaining gap, giving the RT-5 owners reproducible findings on both NVIDIA and AMD. Documentation-only, so no code risk.
Verdict: Approve
Summary
Why mergeThis records a substantial, measured runtime capability and its remaining gap, giving the RT-5 owners reproducible findings on both NVIDIA and AMD. Documentation-only, so no code risk. Verdict: Approve |
Conflict in the stage list of make_game.py (main reworded it; the shaders line keeps the two DLL steps). One stage test follows main: the FidelityFX step now keeps its output only when its index names a program whose module exists, so the stand-in translator writes one. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…-leaf-compile No conflicts. docs/embedded_shaders.md section 7: with ItsNotRexed#1864 on main the step translates 52 of 52 and bvh_builder_test passes on the Vulkan device (Radeon, emulated modules). Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
|
Merged #5680's new head (which has AI-assisted. |
SHADER-995, claimed in the coordination issue: #5581 (comment)
Depends on: #5680
Docs only: no code, tool or test changes. Three files:
docs/embedded_shaders.md(section 7),docs/design.md("Control flow" row) and
docs/testing.md("Known problems", one new row).What and why
#5680 recorded that on the Radeon iGPU the native module of
XboxBvhBuilder.dll'sLeafRehydrationdid not comeback from the AMD driver's pipeline compile (15 minutes in
vk_pipeline_check, 16 through the D3D12 layer, creation 49of the builder's constructor), and asked why. This is the answer, and it changes what #5680's section 7 says:
main3faac557, not the one make_game, shader library: XboxBvhBuilder.dll's embedded programs are translated and found on the Vulkan device (D3D-557) #5680 has now. ThereMAX_STRUCTURED_DEPTHwas 16 (SHADER-299) and this program's structured tree nests 18 deep, so it was emitted inthe dispatch-loop form: one loop around an
OpSwitchwith 581 cases. Since SHADER-427 (bound 64, inmain561b65a8, which make_game, shader library: XboxBvhBuilder.dll's embedded programs are translated and found on the Vulkan device (D3D-557) #5680 has merged) all 51 native modules are structured (47) or barrier rounds (4), and theRadeon creates
LeafRehydration's pipeline in 2.9 s. A default build on an AMD-only PC does not stop there anymore:
bvh_builder_teston the Vulkan device gets 49 of 50S_OKwith the native modules, as with the emulatedones (creation 50 is
Box16Rehydration, which has no module until rdna2spirv: 8/16-bit MUBUF loads and stores (buffer_load_ubyte/ushort/d16, buffer_store_byte/short) #1864).spirv-optpass, no emulation for the builder's programs, noexception in
wave64_settings. The translator files are the same at0dca189band0784e367.dispatch-loop form, which the translator still emits for a graph it cannot make reducible, for a tree deeper than
64 and with
--dispatch-loop.docs/testing.mdhas the row,docs/design.md's "Control flow" row the data point.Measured
Radeon integrated graphics of a Ryzen 7 9700X (gfx1036), AMD Windows driver 32.0.21042.62,
vk_pipeline_check --jobs 1, package 1.0.2.1. One module in the driver at a time, beside one long run. This driver keeps compiledshaders on disk and returns a module it has seen in 0.2 s, so each time is the first compile of a module, or of a
copy with another generator word in its header.
LeafRehydrationmodule3faac557OpSwitchwith 581 cases, 590OpGroupNonUniformAny--dispatch-loop, or--max-structured-depth 16: the same bytes)OpGroupNonUniformAny--wave64-emulate, translator of3faac557--wave64-emulate, current translatorAll 51 modules of the current translation, one thread: native 51 of 51 in 18.4 s (
LoadInstances8.6 s theslowest), emulated 51 of 51 in 26.9 s (
LeafRehydration11.6 s the slowest).Probes on the current translator's dispatch-loop module (limit per compile in brackets):
OpGroupNonUniformAnyreplaced byOpLogicalOr(not equivalent, a probe)spirv-opt -Ospirv-opt --eliminate-local-single-block --eliminate-local-single-store --ssa-rewrite --eliminate-dead-code-aggressivespirv-opt --eliminate-dead-branches --merge-blocks --cfg-cleanup%pcVolatile(equivalent module)%pcand%doneThe other programs in the dispatch-loop form (current translator,
--dispatch-loop), against their structuredmodule:
LoadInstances(5.35 MB)ReloadTrianglesConstructBVH4PT_ConstructBVH4LoadTrianglesSplitInstances(1.53 MB)RefitBVH4FindTreeletsBox32Rehydration(wave64)RadixAlloc(wave64)What that says, and how sure it is:
request: 2.9 s structured, tens of minutes in the dispatch loop.
module compiles in 40 s), and not something
spirv-opt -Oremoves.and 280 cases, nearly 2 times between 284 and 286), which looks like growth with the paths through the program. Of the eleven
programs it is the only one that is both large and has no loop of its own. Which pass of the driver's compiler
takes the time was not looked into, and whether that driver honours
Volatilewas not checked.Other people's data, not mine: @Jadiac5 ran
0dca189bon an RX 9070 XT (RDNA4, AMD 32.0.32029.2010) and got 51 of51 native and 51 of 51 emulated pipelines, the slowest module in 19 to 35 s
(comment). Those are the structured
modules as well, so it agrees with the Radeon result here and does not say how that driver treats the dispatch-loop
module. The RTX 3070 time (11 s for the dispatch-loop module) is #5680's.
Tested
bvh_builder_testwithLEONIDA_BVH_DEVICE=vulkan,LEONIDA_BVH_RECORD62=1and the native modules of thecurrent translation, on the Radeon: 50 creations, 49
S_OK(creation 49,LeafRehydration, among them), creation 500x80070057, as in the emulated row. The runtime and test programs were built from0dca189b; the translatorfiles are unchanged in
0784e367.python -I tests/test_docs_links.py(6 tests),tests/test_docs_repo_paths.py(3),tests/test_docs_list_items.py(2),
tests/test_docs_design_rows.py(4),tests/test_text_write_line_endings.py(3): OK.python -I tests/test_bvh_shaders_stage.py: 13 tests OK (unchanged, run because the section it documents is theone edited).
git diff --check: clean.No game data, keys or decryption (CONTRIBUTING.md), including in logs or reports quoted here.
Not checked
open.
vk_pipeline_check).shaders.rpfthe current translator still emits in the dispatch-loop form, and how thisdriver compiles those, was not counted.
spirv-opt -Os,--merge-returnand--scalar-replacementalone.AI-assisted.