Repository navigation
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>
|
Compared the disassemblers on For the Linux stage integration I ran One actionable resume case: I shortened a single indexed BVH module to 16 bytes in the scratch build and invoked the same shader stage again. The step reused the truncated file and continued to report 51 translated; Retested |
|
Independent Windows check of 0dca189b on 561b65a8. RTX 3080 Ti / 621.35, Windows 11, MSVC 19.44.35230, Vulkan SDK 1.4.363.0, CPython 3.12.8. Eight selected stock build-stage tests passed, covering the mocked stage, resume and rebuild. Focused The focused native fixtures used the exact PR runtime and synthetic inputs. No package files were used. AI-assisted. |
|
Tested 0dca189 on Intel UHD Graphics 770, driver 32.0.101.7088, with the validation layer loaded (VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation): shader_library_test exits 0 with "SHA-256, inflate (stored/fixed/dynamic), JSON, FSSM extraction, FSPX programs and index lookup OK". d3d12_compute_test exits 0 with "device: Intel(R) UHD Graphics 770 (validation on)", "64 elements matched in each of three dispatches" and 0 "Validation Error" lines. test_bvh_shaders_stage.py runs 12 tests OK. The log also has "slot 67 call 2 failed with 0x80070057", which I did not trace. shader_library_corpus_test, ctest and the checks that need the real XboxBvhBuilder.dll were not run. AI-assisted. |
|
I reproduced a stale-index case in Steps (synthetic fixture only, no game files):
I ran |
…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>
|
@Flyander thanks, reproduced and fixed in
On the red @gertify thanks for the Intel UHD 770 run. AI-assisted. |
|
Tested 0784e36 on NVIDIA GeForce RTX 4080, driver 617.42: shader_library_test exits 0 with "SHA-256, inflate (stored/fixed/dynamic), JSON, FSSM extraction, FSPX programs and index lookup OK" and d3d12_compute_test exits 0 with no summary line. The log does not name the bvh/ pipeline case, so its result is not shown separately. shader_library_corpus_test was not run. AI-assisted. |
|
Follow-up on the red AI-assisted. |
|
Tested 0dca189 on Windows 11, AMD Radeon RX 9070 XT (RDNA4), driver 32.0.32029.2010: pass for the BVH programs, one concern in
AI-assisted (Claude Code). |
|
@Jadiac5 thanks, that matches what I get, and the one failing creation is the expected stop, not a second problem:
The head moved to AI-assisted. |
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>
|
Merged
The merge itself: one conflict, in the stage list at the top of The docs of this PR still say 51 of 52 and name the stop at creation #50; that was true when measured and I will bring the numbers up to date in #6739, which rewrites that section anyway. AI-assisted. |
…-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>
|
Tested Base: main
RVAs and counts only. AI-assisted (Claude Code). |
|
Closing: everything in this pull request is on Checked by merging Thanks to everyone who tested it. AI-assisted. |
D3D-557, claimed in the coordination issue: #5256 (comment)
The branch has
main561b65a8merged in (round 44). #4333, which changed the same lines ofShaderLibrary::load, landed in that round; the loop over thefspxandbvhfolders now uses itsstd::filesystem::path. The measurements below were made on3faac557and repeated on the merged tree where the last paragraph of "Measured" says so.What and why
On the Vulkan device
XboxBvhBuilder's constructor stopped at its first compute PSO: no build step put the DLL's 52 embedded programs into the shader library, so slot 62 found no module. This adds the step and the index read.Build (
make_game.py,bvh_shaders)shadersstage runs the recipe ofdocs/embedded_shaders.mdsection 4 onXboxBvhBuilder.dll:pe_shader_containers.py --extract,fssm_unpack.py,shader_disasm.py,rdna2spirv.py, into<work>/shaders/bvhand<work>/shaders/spirv/bvh.fspx_shaders: one folder, redone as a whole,bvh_build.jsonwritten last, and it never makes the game's shaders translate again.pe_shader_containers.pynever overwrites a container, so a second extraction would write<module>_NN.dxbcbeside the first and those would be translated as more programs.The key is the one the game's shaders have
fssm_sha256fromshader_meta.py, andcompute_program()already gives an FSSM program for the container the DLL passes. No second key was added.ShaderLibrary::loadnow also reads<dir>/bvh/index.json. Its entries are namedbvh/<name>and go into the table of the game's shaders, socreate_computeis unchanged.bvh/index.jsonleaves the other indexes loaded.bvh_size()counts the entries, andshader_library_corpus_testleaves them out of what a carved container must reach, like the FSPX ones.The program without a rule is reported, not skipped
Box16Rehydrationstill stops atbuffer_store_short(rdna2spirv: 8/16-bit MUBUF loads and stores (buffer_load_ubyte/ushort/d16, buffer_store_byte/short) #1864). There is no skip list.--max-shared-memory 32768maxComputeSharedMemorySize.--wave64-emulate,RadixAllocdeclares 37,084 B at the default cap and 22,236 B with this one. No other module changes, and the same 51 translate either way.RadixAllocis refused (0x80004001) after 28 creations.Measured
Package 1.0.2.1, my own copy. Counts and sizes only.
spirv-val-valid, native and--wave64-emulateBox16Rehydration)rdna2spirv.pychange (headeeffc876) in a local copy of the toolsfssm_sha256, distinct keysshaders.rpfcorpus (26,501 entries)LEONIDA_BVH_DEVICE=vulkan bvh_builder_test,LEONIDA_BVH_RECORD62=1.LEONIDA_SHADERSis a folder with this step's output and an empty main index ({}), because only this step was run, not the whole stage. One more run had a 26,501-entry main index beside it (26,552 entries loaded) with the same result.main3faac557)--wave64-emulate0x80004005with no library,0x80070057with a 26,521-entry corpusS_OK; #50Box16RehydrationE_INVALIDARG, constructor throws0x80070057--wave64-emulateS_OK; #49LeafRehydration(native wave64, 1.66 MB module) did not come back from the driver's pipeline compile in 16 minutes and the run was stopped--wave64-emulateS_OK, constructor and destructor return,bvh_builder_test: OK (0 failures)So with the emulated modules the step takes the constructor from creation #1 to creation #50, and the one thing left is #1864's rule.
vk_pipeline_checkover the 51 modules, without the D3D12 layer: 51 of 51 pipelines on the RTX 3070 (native and emulated) and on the Radeon (emulated). On the Radeon with the native modules: 50 of 51, andLeafRehydrationwas still compiling when the check was stopped after 15 minutes. Its emulated module takes 12 s on that driver and its native module 11 s on the RTX 3070, so this is that driver's compile time for one module, not the lookup.On the merged tree (
0dca189b,main561b65a8). The step run again on the package: 52 containers, 52 listings, 51 translated andspirv-val-valid with--wave64-emulate, 51 index entries with a key, the same one program named.LEONIDA_BVH_DEVICE=vulkan bvh_builder_teston the Radeon and on the RTX 3070:calls: 50, succeeded 49, failed 1, the same stop at #50; on the PC device 53 of 53, OK. The ctest subset listed under "Tested" on both GPUs: 10 passed, the two package-gated ones skipped there and run by hand as above.tests/test_bvh_shaders_stage.py,test_fspx_shaders_stage.py, thetest_docs_*files andcompileall: OK. Not repeated on the merged tree: the native-translation runs, the run with #1864 applied,vk_pipeline_check, the negative control and the two whole test suites.Tested
python -I tests/test_bvh_shaders_stage.py: 12 tests, new. A synthetic DLL of hand-built containers around a made-up FSSM blob; the repository'spe_shader_containers.py,fssm_unpack.pyandshader_disasm.pyrun as the step runs them, with llvm-mc and the translator stood in for astest_fspx_shaders_stage.pydoes.shader_library_test: thebvh/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<shaders>/bvh/index.json. Passes on both GPUs.shader_library_corpus_teston a scratch folder with abvh/index: 52 containers, 52 reached, 52 builder entries counted apart, 0 failures. Read-only over an older translated corpus: 26,503 containers, 26,501 reached, 20 FSPX and 0 builder entries, 0 lookup failures (it exits 1 for 2 shaders that older translation left out).pipeline_cache_file,shader_library,bvh_builder,vk_pipeline_check_cli,d3d12_compute,d3d12_fspx_compute,d3d12_set0_compute,d3d12_pipeline_library,pipeline_cache_snapshot,subgroup_size: 10 passed,shader_library_corpusskipped, each time.python -m compileall -q make_game.py tools tests,python -I make_game.py --help.test_fspx_shaders_stage,test_pe_shader_containers,test_shader_stage_resume,test_shader_disasm,test_shader_meta, everytest_make_game_*,test_text_write_line_endings, everytest_docs_*): 572 tests, all pass.tests/test_*.pyfiles: 339 pass. The other 4 (test_joaat_agreement,test_missing_input_exit_codes,test_saves, andtest_rdna2_decodewithLLVM_MCset) fail the same way onmain3faac557on this PC.python -m unittest discover -s tests/semantic: 6,245 tests, 3 failures and 3 errors, intest_loop_ballot_barrierandtest_vcmp16_opsel; both files give the same result onmain3faac557. No translator file changed.bvhindex read taken out ofShaderLibrary::load,shader_library_testandd3d12_compute_testboth fail at the new checks.Not checked
make_game.pypipeline was not run. The step was run alone on the package (bvh_shaderscalled directly), and the stage order is tested with stand-in tools.pipelinesstage reads only<work>/shaders/spirv/index.json, so it checks neitherbvh/norfspx/;vk_pipeline_checkwas pointed at thebvhfolder by hand.LeafRehydrationmodule, and what--wave64-emulate autopicks on an AMD-only PC, were not looked into.Checklist
AI-assisted.