Repository navigation
Conversation
…ase from dwords 38-39 A VS (or MS) and a PS in one pipeline can each read code-embedded data through s_getpc_b64, but the push-constant block had one code-base slot (dwords 34-35), so CreateGraphicsPipelineState refused every such pair with E_NOTIMPL (open question 14). - Translator: a PS that reads its code base takes it from dwords 38-39 (a 160-byte block); every other stage keeps 34-35. Dwords 36-37 stay --mesh-compute's output address. The index records code_base_dword and the real push_constant_bytes. Shaders without a code base are byte-identical. --pc-tail-ubo output is unchanged: every stage reads the tail block's dwords 2-3, since the runtime writes one 16-byte tail per pipeline. - Runtime: each code-base stage gets its own FSSM blob in the arena and its VA in its slot; the graphics layout's range is the stages' largest block (144, or 160 with a code-base PS). Compute PSOs, Dispatch and indirect dispatch keep pushing 144 bytes. Two stages naming the same slot (an index translated before this change) are refused with both names logged. - vk_harness: VKH_CODE=vs,ps fills both slots (not with --pc-tail-ubo). - Tests: tests/semantic/test_code_base_slot.py, including the --pc-tail-ubo case; test_pc_tail_ubo expects ps_m15's 160-byte block; d3d12_draw draws a VS and a PS that each read their own program. - Docs: design.md user-data row, d3d12_vulkan.md section 5.2 and question 14. Based on AGVibecoder's implementation in ItsNotRexed#1705, carried onto current main: kept beside D3D-309's D24-as-D32 depth path, the indirect dispatch push made 144 bytes, and --pc-tail-ubo left as it is. Co-Authored-By: Gino <ginoaelbrecht17@gmail.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Kam471
left a comment
There was a problem hiding this comment.
Built and ran at 473a33ef3 on Windows 11, RTX 5070 Ti:
tests/semantic/test_code_base_slot.py-> 5 tests, OK.pytest tests/test_pc_tail_ubo.py -q-> 1 passed, 7 skipped (skips need a translated shader set).d3d12_draw_test-> exit 0:M1: five draws and a culled triangle matched all 4096 pixels ... then an XOR logic op, a full-screen pass without vertex input and a VS and PS that each read their own code base.git diff --checkclean.
The per-stage code-base slots are now selected by stage: a pixel shader reads its code base from user-data dwords 38–39, while the vertex stage keeps the existing pair, and the new GLSL fixtures vs_code.vert/ps_code.frag each read their own base and pass the value through to the frame. The semantic test pins the slot choice, and pc_tail_ubo still passes. No blocking issue.
|
Independent check — pass, GPU + corpus verified (Windows 11, NVIDIA RTX 5090, driver 617.42, Vulkan SDK 1.4.363.0, native llvm-mc). Runtime (real GPU):
Translator on real game shaders (local corpus slice, 6 PS shaders containing
Code-reading notes (non-blocking): the per-stage arena blobs ( AI-assisted (Devin); corpus slice stayed local, counts only. |
|
Thanks @Kam471 and @Atomic258 for the independent runs. @Atomic258, your corpus slice answers the count question from the PR description: 6/6 PSs that read a code base translate, move to dwords 38–39 and pass The 7 skips in
The |
|
Tested 473a33e on NVIDIA GeForce RTX 4080, driver 617.42, Windows 11 (clang-cl cross-build): d3d12_draw_test exits 0. It prints no pass summary and no pixel lines, so the 4096/4096 pixel check and the refusal of an index whose PS still names 34-35 are not visible in this run; only the exit code is confirmed. The other D3D12 targets the PR lists were not run. AI-assisted. |
|
Independent Windows CPU verification on
|
|
Tested
|
|
Tested 473a33e on NVIDIA GeForce RTX 3070, driver 620.70.06, Linux (Bazzite, Fedora 45 base, kernel 7.3.4): pass
AI-assisted run (Claude Code); counts only, no game data. |
|
Thanks @ramenbellic for the full-corpus run. It's the only one on all 26,503 shaders so far. About the 93
So far the two numbers only agree. That isn't yet a match shader for shader, and I have no corpus here to check it myself. If you still have that run's output, three counts would settle it:
Counts only, please: no shader names, hashes or disassembly. Your run was on AI-assisted (Claude Code). No game files. |
SHADER-67 (claim, scope correction; listed in #5032). Open question 14 in
docs/d3d12_vulkan.md. No dependencies; based onmain3faac557.This is @AGVibecoder's implementation from #1705, which they closed after
--pc-tail-ubo(#2046) landed and invited someone to pick up. I carried it onto currentmainand settled the--pc-tail-uboquestion; their commit is credited as co-author.Why
A VS (or MS) and a PS in one pipeline can each read code-embedded constants through
s_getpc_b64. The corpus has 54 VS, 93 PS and 266 MS that do (tools/feature_scan.py, §5.2). The push-constant block had one code-base slot, at dwords 34–35. So onmain,CreateGraphicsPipelineStaterefuses every PSO in which two stages read their code base, withE_NOTIMPL("two stages read their code base; one push-constant slot holds one").What
tools/rdna2spirv.py,code_base_dword()):--mesh-compute's output address, which a mesh-compute draw pushes to the VS that runs next to the PS.code_base_dwordand the realpush_constant_bytes.--pc-tail-ubois unchanged. Every stage, the PS included, still reads its code base from dwords 2–3 of the tail block, and the tail stays 16 bytes. The runtime side of that flag (Runtime: D3D12 PSOs bind the --pc-tail-ubo set-1 block for 128-byte push-constant devices (3/3) #2402) writes one 16-byte tail per pipeline and accepts only that size. A PS slot at 6–7 would get today's working single-code-base PS refused on 128-byte devices. On those devices a pipeline keeps one code base, as onmain.d3d12_vulkan_device.cpp,vulkan_replay.h,shader_library.h):Dispatchand indirect dispatch keep their 144-byte range and push.vk_harness:VKH_CODE=vs,psfills both slots, with a 160-byte range. WithLEONIDA_PC_TAIL_UBOit exits 77.design.md, and §5.2 and question 14 ind3d12_vulkan.md.Tests
tests/semantic/test_code_base_slot.py(5 tests):--pc-tail-uboa PS reads the tail's dwords 2–3, with a 16-byte tail.tests/test_pc_tail_ubo.pynow expectsps_m15's 160-byte block without the flag.d3d12_draw:RelWithDebInfo (MSVC),
LEONIDA_VK_VALIDATION=1plus synchronization validation, implicit layers off. RTX 4060 Ti, driver 621.01, Windows 11 26200:main3faac557ctestshader_library)python -m unittest discover -s tests/semantic(6250 tests)The same tests skip as on
main(no game package, corpus,LEONIDA_FIRST_LIGHT_DIRor RGB9E5 RTVs on this adapter), andgameinputis disabled by default. The semantic failures are intest_loop_ballot_barrierandtest_vcmp16_opsel, and they matchmainname for name.Not run here, help welcome:
llvm-mc:d3d12_translated_draw, which runs the translator onps_m15, a PS that reads its code base; therequires_toolstests intests/test_pc_tail_ubo.py; andscripts/run_gpu_tests.py. This machine has nollvm-mc.spirv-val-valid counts over the shader corpus. Only PSs that read a code base should change.If you have either, please post counts and pass/fail. No game data, please.
Overlap
main. With this PR there's one textual conflict ind3d12_vulkan_device.cpp: Runtime: mesh-shader PSOs from pipeline state streams and DispatchMesh (D3D-29) #1712's mesh-limit check sits next to this PR'spush_bytesline. Both are needed, and they agree: an MS reads slot 34–35 and the PS 38–39, so MS+PS pipelines get two code bases, and the range already names the mesh stage.--pc-tail-uboruntime): no semantic conflict, since--pc-tail-ubooutput is unchanged. It already conflicts withmainin five files; this PR adds a textual one inruntime/CMakeLists.txt.No game files.
AI-assisted (Claude Code).
🤖 Generated with Claude Code