Repository navigation
Runtime: D3D12 PSOs bind the --pc-tail-ubo set-1 block for 128-byte push-constant devices (3/3) - #2402
Runtime: D3D12 PSOs bind the --pc-tail-ubo set-1 block for 128-byte push-constant devices (3/3)#2402whoalin1 wants to merge 1 commit into
Conversation
|
Independent hardware check of 5fbd998 on Windows 11 build 26300, NVIDIA GeForce RTX 5070, driver 621.24. Synthetic fixtures only.
The indirect probe covered compute with no count buffer. I restored the test source after running it. AI-assisted test setup and review. |
|
Tested 5fbd998 on an RTX 3060 12 GB, NVIDIA 621.14, Vulkan 1.4.357, Windows 11 26H2: pass. Built and ran the stock d3d12_compute_test and d3d12_draw_test from this commit. Both exited 0. With the simulated 128-byte push-constant limit, the set-1 tail path matched 64/64 compute elements and 4,096/4,096 graphics pixels. The stock 4x MSAA resolve also matched 4,096/4,096 pixels. Build: clang-cl 23.1.6, Windows SDK 10.0.26100 via xwin, CMake 4.5.1, Ninja 1.13.2 and glslang 16.6.0. Vulkan validation layers were disabled. Synthetic inputs only. AI-assisted setup and verification; tests ran locally. |
|
Independent SwiftShader check of
The attached patch changes only the MSAA fixture and its CMake target. Synthetic inputs only. AI-assisted. |
|
Windows + GPU check: AMD Radeon RX 9070 (RDNA4), Windows 11, MSVC Release, Vulkan SDK 1.4.363. Tested head 5fbd998 merged onto AI-assisted (Claude Code); runs on my machine. |
|
Independent verification of head Hardware / environment. Windows 10 build 19045, VS 2026 Community (
A fresh build in a new build directory completed with 0 errors. I did not need to merge #2046: the runtime tests use the hand-written Full
The 8 AMD failures on Verbose runs of the two changed tests:
The extra NVIDIA failure, Bottom line: this is the first run of the D3D12 tail path on the coordinator's 7600X iGPU, and it confirms the compute and graphics tail paths work on real 128-byte hardware. The remaining six AMD failures need tail variants in their own synthetic shaders; that is outside this PR's stated scope. |
|
Tested
Synthetic inputs only. Tested with assistance from OpenAI Codex. |
|
Tested on Windows 11 with two GPUs on one machine (MSVC 14.51, llvm-mc 23.1.6): pass. |
|
Hardware validation on Radeon RX 580, Windows x64, driver 31.0.21924.61, actual maxPushConstantsSize=128: d3d12_compute_test and d3d12_draw_test both exit 0 on this PR's exact head 5fbd998. I built it via https://github.com/aidity1377/Leonida/actions/runs/45048617750 and downloaded its runtime-windows artifact. The artifact has CI-machine absolute shader paths. For this diagnostic I redirected only those fixture strings to the packaged generated/ directory in local copies of the two executables. This preserves their compiled test/runtime code and fixtures. Both tests then pass on the physical 128-byte device. Clean main's equivalent tests reach PSO creation and refuse the 144-byte push-constant requirement on the same device. The CI run's Windows job failed d3d12_msaa_draw; Linux succeeded. The artifact was still produced. This is a focused compute/draw hardware result, not a full-suite pass. No game files. AI-assisted with Codex. Related fixture-path draft: #2500. |
|
Tested the whole series (#2046
AI-assisted (Claude Code); no validation layers in these runs. |
5fbd998 to
d230040
Compare
|
Tested 5fbd998 (merged onto main 4947579, on its own: #2046 is not in this tree; the runtime tests build their
AI-assisted (Claude). |
Resolve runtime/test/d3d12_compute_test.cpp by keeping both sides: ItsNotRexed#2402's dispatch_once helper and 128-byte tail path, and main's CachedPSO helpers and host comparison. The CachedPSO block is nested in the fallback else branch with the right indentation. Rebuilt from scratch on VS 2026 x64: AMD 107/112 (main 100/112), NVIDIA 110/112 with the known d3d12_depth_resolve parallel flake (main 111/112). No game data. Co-Authored-By: Claude <noreply@anthropic.com>
|
Tested 5fbd998 on real 128-byte hardware: AMD Radeon(TM) Graphics, the Ryzen 9 7900X iGPU (RDNA2, gfx1036), AMD driver 24.10.24, Windows 11, Built the whole runtime with
The same machine's AI-assisted. No game files. |
|
Tested d230040 on an RX 9070 (RDNA4), AMD 26.11.1 (LLPC), Vulkan 1.4.359, Windows 11: pass Full ctest run: 129/129 passed ( AI-assisted |
ligmaSec
left a comment
There was a problem hiding this comment.
I tested d2300403 on top of 03b09a08 on Debian 13. The local conflict resolution keeps current main's arena accounting, draw pipeline variants, geometry capability checks, and the newer compute SRV and draw instance-step assertions.
One rebase detail is easy to miss. Main's graphics stage table now has VS, GS and PS in that order. The two-entry user_data_layout call applies cleanly but excludes the PS after the rebase. I passed vs_stage.entry, gs_stage.entry and ps_stage.entry. I also used DeviceState::arena_shader for the tail's allocation and release, and kept PreparedDraw's selected pipeline handle when applying the new user-data binding.
- Native
shader_libraryandvk_command_replayCTests passed. - Windows clang-cl/xwin build with a static C++ runtime, run under Wine 10.0 on Mesa llvmpipe 25.0.7 (LLVM 19.1.7).
shader_library_test,d3d12_draw_testandd3d12_compute_testall passed. The simulated 128-byte device refused the old 144-byte pipeline and accepted the tail path. The graphics tail fixture matched 4,096 pixels and the compute tail fixture matched 64 words, both on the simulated limit and the normal device. Khronos validation and synchronization validation reported zero errors. In the compute test I disabled Wine'sd3dcompiler_47to skip its separate host CachedPSO comparison. - As a compile-only check, Mesa 26.1.6 ANV accepted both the 144-byte and 128-byte-plus-UBO
cs_buf_fmt8translations on three Intel DRM-shim profiles (Alder Lake, DG2 and Battlemage). Those profiles reported 256 bytes. The constrained runtime result comes from the Wine tests above.
Synthetic fixtures only. Physical 128-byte hardware coverage is still pending. AI-assisted with Codex.
The test's two stages declared one 144-byte push-constant range, so a device whose maxPushConstantsSize is the 128-byte Vulkan minimum refused the PSO (E_NOTIMPL at make_context) and none of the nine input-assembler bounds cases ran there; the AMD Windows driver reports 128 bytes on RDNA2 iGPUs. The fixtures now also come as a --pc-tail-ubo twin: the same GLSL compiled with -DPC_TAIL, whose stages declare s0..s31 alone (128 bytes) and no set-1 tail, since neither stage reads a root argument. A device with room for both layouts runs both and their probes must agree; one whose maxPushConstantsSize is below 144 runs the twin alone, which is where the cases were measured on RDNA2 hardware. Case E is information only where the bounded and the unbounded layer pass draw alike and the host differs: AMD's driver reads a vertex attribute past its view instead of zeroing it, so the case is not the layer's to decide there. A16, A32 and C keep their pass/fail condition on that device. Stacked on ItsNotRexed#2402's head (d230040) with ItsNotRexed#2676 applied, because the test and the layer path it needs are not on main yet. Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
…sh-constant devices Both tests' shaders declared 144 push-constant bytes, so a device whose maxPushConstantsSize is the 128-byte Vulkan minimum refused their PSOs and neither reached its checks (d3d12_bundle_test.cpp:130 via make_pso). d3d12_bundle reuses d3d12_draw_test's --pc-tail-ubo twins (vs_draw/ps_draw compiled with -DPC_TAIL) from a second library folder, and runs every scenario and the layer-only checks on a layer device limited to 128 bytes as well as with the 144-byte shaders. d3d12_typeless_families gets a -DPC_TAIL build of vs_fullscreen.vert (its pixel shaders declare no push constants) and draws each case on both. A device below 144 bytes runs the twins alone. Both layouts are held to the same grids or host bytes. Tested with LEONIDA_VK_VALIDATION=1 on an RTX 5090 (NVIDIA 621.35) and an AMD Radeon iGPU (AMD 26.5.2): bundles 10 scenarios with both layouts, 20 host comparisons, 0 failures; typeless draws 16 of 16 equal the host; d3d12_draw_test still passes. Both devices report 256 bytes, so the 128-byte limit is simulated; a real 128-byte device has not run it. Stacked on ItsNotRexed#3013 (and ItsNotRexed#2402), which add the fallback the twins need. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
ItsNotRexed#2402's user_data_layout call took {stages[0], stages[1]}, written when a graphics PSO's stages were {vs, ps}. Since ItsNotRexed#2109 they are {vs, gs, ps}, so on main stages[1] is the (usually empty) GS slot: the PS's pc_tail never reached the pipeline layout, set 1 was left out, and a --pc-tail-ubo PS failed VUID-VkGraphicsPipelineCreateInfo-layout-07988 and drew nothing (d3d12_draw_test line 358, d3d12_bundle's twin run). All three stages are passed now; user_data_layout skips the absent ones. This is the same slip 81ec7f7 fixed for the f16 halves link. Found rebasing ItsNotRexed#3106 onto main f847748. With it, d3d12_draw_test, d3d12_bundle, d3d12_typeless_families, d3d12_ia_bounds and d3d12_compute pass with LEONIDA_VK_VALIDATION=1 and no validation error on an RTX 5090 (NVIDIA 621.35) and an AMD Radeon iGPU (AMD 26.5.2). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The test's two stages declared one 144-byte push-constant range, so a device whose maxPushConstantsSize is the 128-byte Vulkan minimum refused the PSO (E_NOTIMPL at make_context) and none of the nine input-assembler bounds cases ran there; the AMD Windows driver reports 128 bytes on RDNA2 iGPUs. The fixtures now also come as a --pc-tail-ubo twin: the same GLSL compiled with -DPC_TAIL, whose stages declare s0..s31 alone (128 bytes) and no set-1 tail, since neither stage reads a root argument. A device with room for both layouts runs both and their probes must agree; one whose maxPushConstantsSize is below 144 runs the twin alone, which is where the cases were measured on RDNA2 hardware. Case E is information only where the bounded and the unbounded layer pass draw alike and the host differs: AMD's driver reads a vertex attribute past its view instead of zeroing it, so the case is not the layer's to decide there. A16, A32 and C keep their pass/fail condition on that device. Stacked on ItsNotRexed#2402's head (d230040) with ItsNotRexed#2676 applied, because the test and the layer path it needs are not on main yet. Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
…sh-constant devices Both tests' shaders declared 144 push-constant bytes, so a device whose maxPushConstantsSize is the 128-byte Vulkan minimum refused their PSOs and neither reached its checks (d3d12_bundle_test.cpp:130 via make_pso). d3d12_bundle reuses d3d12_draw_test's --pc-tail-ubo twins (vs_draw/ps_draw compiled with -DPC_TAIL) from a second library folder, and runs every scenario and the layer-only checks on a layer device limited to 128 bytes as well as with the 144-byte shaders. d3d12_typeless_families gets a -DPC_TAIL build of vs_fullscreen.vert (its pixel shaders declare no push constants) and draws each case on both. A device below 144 bytes runs the twins alone. Both layouts are held to the same grids or host bytes. Tested with LEONIDA_VK_VALIDATION=1 on an RTX 5090 (NVIDIA 621.35) and an AMD Radeon iGPU (AMD 26.5.2): bundles 10 scenarios with both layouts, 20 host comparisons, 0 failures; typeless draws 16 of 16 equal the host; d3d12_draw_test still passes. Both devices report 256 bytes, so the 128-byte limit is simulated; a real 128-byte device has not run it. Stacked on ItsNotRexed#3013 (and ItsNotRexed#2402), which add the fallback the twins need. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
ItsNotRexed#2402's user_data_layout call took {stages[0], stages[1]}, written when a graphics PSO's stages were {vs, ps}. Since ItsNotRexed#2109 they are {vs, gs, ps}, so on main stages[1] is the (usually empty) GS slot: the PS's pc_tail never reached the pipeline layout, set 1 was left out, and a --pc-tail-ubo PS failed VUID-VkGraphicsPipelineCreateInfo-layout-07988 and drew nothing (d3d12_draw_test line 358, d3d12_bundle's twin run). All three stages are passed now; user_data_layout skips the absent ones. This is the same slip 81ec7f7 fixed for the f16 halves link. Found rebasing ItsNotRexed#3106 onto main f847748. With it, d3d12_draw_test, d3d12_bundle, d3d12_typeless_families, d3d12_ia_bounds and d3d12_compute pass with LEONIDA_VK_VALIDATION=1 and no validation error on an RTX 5090 (NVIDIA 621.35) and an AMD Radeon iGPU (AMD 26.5.2). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ush-constant devices A device whose maxPushConstantsSize is 128 (AMD Windows driver on RDNA2 iGPUs, some Intel Arc drivers; D3D-14's push_constants_need_fallback) cannot hold the 144-byte ShaderUserData push-constant block, so previously every D3D12 PSO was refused there with E_NOTIMPL. With --pc-tail-ubo (PR ItsNotRexed#2046), translated shaders keep s0..s31 in 128 push-constant bytes and move the 16-byte tail (heap base, code base) to a uniform block at set 1, binding 0 when a stage reads it. This wires that path through the D3D12 -> Vulkan layer: - runtime/src/shader_library.h: ShaderEntry parses pc_tail.bytes into pc_tail_bytes (tested in shader_library_test). - runtime/src/vulkan_replay.h: ComputePipeline and GraphicsPipeline carry push_bytes, tail_set and tail_offset; detail::bind_user_data binds set 0 (if present), set 1 with dynamic offset (if present), and pushes push_bytes at all three push sites (ExecuteIndirect dispatch, Dispatch, Draw); the three unsupported checks cover tail_set. - runtime/shims/d3d12_vulkan_device.cpp: DeviceState::pc_tail creates one UNIFORM_BUFFER_DYNAMIC descriptor over the arena (range 16) plus an empty set-0 layout once per device. PipelineState::user_data_layout sizes the push-constant range from each stage's push_constant_bytes / pc_tail_bytes (so a --pc-tail-ubo stage that reads neither heap nor code base still fits 128 bytes), adds set 1 when any stage has pc_tail, writes the 16-byte tail once into the arena, and releases it on destruction. 144-byte shaders remain refused on <144-byte devices with a log pointing to --pc-tail-ubo. - Tests: d3d12_compute_test and d3d12_draw_test verify 144-byte refusal and --pc-tail-ubo dispatch/draw (including VS without pc_tail + PS with set-1 tail) on both simulated 128-byte devices and the host GPU, and skip the 144-byte passes when run on a real 128-byte device. - Docs: docs/d3d12_vulkan.md (sections 3.2, 5.2, Q13) and d3d12_com.h comment updated. Step 3 of the uniform-buffer tail claimed in ItsNotRexed#1902. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Co-Authored-By: Gemini 4 Neon <noreply@google.com>
d230040 to
190e685
Compare
|
Rebased onto Thanks Rebuilt (
AI-assisted. |
The test's two stages declared one 144-byte push-constant range, so a device whose maxPushConstantsSize is the 128-byte Vulkan minimum refused the PSO (E_NOTIMPL at make_context) and none of the nine input-assembler bounds cases ran there; the AMD Windows driver reports 128 bytes on RDNA2 iGPUs. The fixtures now also come as a --pc-tail-ubo twin: the same GLSL compiled with -DPC_TAIL, whose stages declare s0..s31 alone (128 bytes) and no set-1 tail, since neither stage reads a root argument. A device with room for both layouts runs both and their probes must agree; one whose maxPushConstantsSize is below 144 runs the twin alone, which is where the cases were measured on RDNA2 hardware. Case E (partial vertex, vertex_extra_bytes != 0) is information only where the bounded and the unbounded layer pass draw alike and the host differs: AMD's driver reads a vertex attribute past its view instead of zeroing it, so the case is not the layer's to decide there. The informational rule is scoped to partial-vertex cases only so A16, A32, C and B1..B3 always fail if the sized index bind or whole-vertex bounds regress. Stacked on ItsNotRexed#2402's head (190e685) with ItsNotRexed#2676 (5547bbc) applied, because the test and the layer path it needs are not on main yet. Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
|
@whoalin1, a heads-up on how this PR interacts with #5128 (SHADER-67, mine). It is open, so it only matters for whichever of the two lands second. The fix is a few lines in either PR. What changes. After #5128, Where they meet. At
I merged your head with my local integration of #5128 on the same
Suggested resolution, whoever is second:
Under What I checked: the file-level merge above, and reading both diffs. I have not built or run the combination. If #2402 lands first, I'll make this change on #5128's side. AI-assisted (Claude Code). No game files. |
Claimed in the coordination issue as: new item, the uniform-buffer tail for devices with 128 bytes of push constants (#1902 (comment)). This is step 3 of 3.
Depends on: #2046 (the translator's
--pc-tail-ubo, which producespush_constant_bytes: 128andpc_tailmetadata). Independent of #2048 (the standalone GPU test harnesses); rebased onmain(49475796).What and why
A device whose
maxPushConstantsSizeis below 144 bytes — Vulkan's 128-byte minimum, reported by AMD's Windows driver on RDNA2 integrated GPUs and by some Intel Arc drivers (D3D-14'spush_constants_need_fallback) — cannot declare the 144-byteShaderUserDatapush-constant range, sod3d12_vulkan_device.cpppreviously refused every D3D12 PSO there withE_NOTIMPL.With
--pc-tail-ubo(#2046), translated shaders keeps0..s31in 128 push-constant bytes and move the 16-byte tail (heap base and code base) to a uniform block at set 1, binding 0 whenever a stage reads it. This wires that path through the D3D12 → Vulkan layer so 128-byte devices can build and run--pc-tail-ubocompute and graphics PSOs while still refusing 144-byte PSOs cleanly:runtime/src/shader_library.h:ShaderEntryparsespc_tail.bytesintopc_tail_bytes(0 when absent); tested inruntime/test/shader_library_test.cpp.runtime/src/vulkan_replay.h:ComputePipelineandGraphicsPipelinegainpush_bytes(default 144),tail_set(set 1, null when unused), andtail_offset.detail::bind_user_databinds set 0 (if present), set 1 with dynamic offsettail_offset(if present), and pushespush_bytesat all three push sites (ExecuteIndirectdispatch,Dispatch, andDraw). All threebind_descriptor_setscapability checks covertail_set.runtime/shims/d3d12_vulkan_device.cpp:DeviceState::pc_tailcreates oneUNIFORM_BUFFER_DYNAMICdescriptor over the arena (range 16, aligned tominUniformBufferOffsetAlignment) and one empty set-0 layout once per device (create_pc_tail(), destroyed in~Device), avoiding per-PSO descriptor pools.PipelineState::user_data_layout()replacespush_constants_fit(): sizes the push-constant range to 128 bytes when every stage fits in 128 bytes (including--pc-tail-ubostages that read neither heap base nor code base and therefore omitpc_tail), adds set 1 when any stage declarespc_tail(with the empty set-0 layout when the PSO has no bindless bindings), refusespc_tailsizes other than 16 bytes (--mesh-compute) orpush_constant_bytes > 144, and still refuses 144-byte pipelines on< 144-byte devices with a log pointing to--pc-tail-ubo.create_computeandcreate_graphicsallocate 16 bytes from the arena inwrite_tail()oncecode_baseis known, write{arena.address, code_base}, and release it in~PipelineState.runtime/shims/d3d12_com.hcomment.runtime/CMakeLists.txt,runtime/test/glsl/{cs_user_data.comp,vs_draw.vert,ps_draw.frag},runtime/test/d3d12_compute_test.cpp,runtime/test/d3d12_draw_test.cpp):-DPC_TAILvariants compiled alongside the 144-byte ones (cs_user_data_tail.spv,vs_draw_tail.spv,ps_draw_tail.spv).d3d12_compute_testchecks that a 128-byte device refuses the 144-byte PSO withE_NOTIMPL, builds and dispatches the--pc-tail-uboPSO (verifying heap base + code base + user data) on both a simulated 128-byte device and the host GPU, and skips the 144-byte passes when run on a real< 144-byte GPU.d3d12_draw_testchecks the graphics path the same way, pairing a--pc-tail-uboVS withoutpc_tail(push_constant_bytes: 128, no set 1) with a--pc-tail-uboPS that readsheap_basefrom set 1 (pc_tail: 16), verifying all 4,096 pixels on both a simulated 128-byte device and the host GPU, and skipping the 144-byte passes on a real< 144-byte GPU.docs/d3d12_vulkan.md(section 3.2 "Push constants", test descriptions, section 5.2, and Q13).Without
--pc-tail-ubo, 144-byte PSOs behave unchanged.Tested
AI-assisted (initial implementation by Claude Opus 5.5; review, tail-less stage fix in
user_data_layout, graphics tail test, rebase onto49475796, and verification by Gemini 4 Neon / Antigravity).Windows 11 (build 26200), MSVC 14.44, Windows SDK 10.0.26100, Vulkan SDK 1.4.363 (
glslangValidator,VK_LAYER_KHRONOS_validation, SPIRV-Tools v2026.4), Python 3.14.4,llvm-mc21.1.8 (WSL). No game files.scripts\build_runtime.ps1at head (49475796+ this commit): 266/266 targets built, 0 errors.shader_library_test.exe: pass (pc_tail_bytesparsed as 16 when present, 0 when absent).d3d12_compute_test.exe(LEONIDA_VK_VALIDATION=1):maxPushConstantsSize256): pass, 0 validation errors — simulated 128-byte device refused the 144-byte PSO (E_NOTIMPL), built and dispatched the--pc-tail-uboPSO (64/64 elements exact on both simulated 128-byte device and host GPU), plus all 3 144-byte dispatches and CBV checks.maxPushConstantsSize128): pass, 0 validation errors — real 128-byte device refused the 144-byte PSO (E_NOTIMPL, matching cleanmainwhered3d12_compute_testexits 1 at that refusal), built and dispatched the--pc-tail-uboPSO on the real 128-byte device (64/64 elements exact), skipped the 144-byte passes.d3d12_draw_test.exe(LEONIDA_VK_VALIDATION=1):E_NOTIMPL), built and drew the--pc-tail-uboVS (nopc_tail) + PS (set-1 tail) PSO (4096/4096 pixels exact on both simulated 128-byte device and host GPU), plus all M1 / B8G8R8X8 / strip-cut / 4x MSAA draws.E_NOTIMPL, matching cleanmainwhered3d12_draw_testexits 1 at that refusal), built and drew the--pc-tail-uboVS+PS PSO on the real 128-byte device (4096/4096 pixels exact), skipped the 144-byte passes.ctest --test-dir runtime\build -C RelWithDebInfo --output-on-failure(NVIDIA RTX 4070 SUPER): 100% passed out of 116 (109 passed, 7 skipped, 1 disabledgameinput, 0 failed).py -3.14 -I scripts\run_gpu_tests.py(regression check; harnesses unchanged):spirv-val; 139/185 passed, 46 skipped, 0 failed.spirv-val; 88/185 passed, 97 skipped, 0 failed.Checklist
docs/design.md, with how it was confirmed. (No translator change here; step 1 Translator: --pc-tail-ubo moves the push-constant tail to a uniform block (128-byte push-constant devices, 1/3) #2046 has the row.)🤖 Generated with Antigravity (Gemini 4 Neon) & Claude Code (Claude Opus 5.5)