[PR #1009] d3d12: immutable compute root-argument blocks (ROOT-SIG-SPILL-MODEL) #1047

Open
opened 2026-11-26 20:19:54 +01:00 by 4ld0 · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/ubiquitarianism/leonida/pull/1009
Author: @djrolfes
Created: 11/24/2026
Status: 🔄 Open

Base: main ← Head: djrolfes/root-sig-spill-safe


📝 Commits (2)

  • 23848bc root_signature: model the compute argument block instead of refusing a spill
  • 25e5c4e d3d12: snapshot compute arguments into submission-retained arena blocks

📊 Changes

19 files changed (+986 additions, -118 deletions)

View changed files

📝 docs/d3d12_vulkan.md (+50 -19)
📝 docs/design.md (+1 -0)
📝 runtime/CMakeLists.txt (+45 -0)
📝 runtime/shims/d3d12_com.cpp (+19 -24)
📝 runtime/shims/d3d12_com.h (+2 -0)
📝 runtime/shims/d3d12_vulkan_device.cpp (+24 -4)
📝 runtime/src/command_list.h (+4 -0)
📝 runtime/src/root_signature.cpp (+17 -15)
📝 runtime/src/root_signature.h (+24 -15)
📝 runtime/src/vulkan_backend.h (+24 -0)
📝 runtime/src/vulkan_replay.h (+28 -0)
➕ runtime/test/d3d12_root_arguments_test.cpp (+189 -0)
➕ runtime/test/glsl/cs_root_arguments.comp (+28 -0)
➕ runtime/test/queue_root_arguments_test.cpp (+151 -0)
➕ runtime/test/replay_root_arguments_test.cpp (+134 -0)
📝 runtime/test/root_signature_test.cpp (+86 -31)
➕ runtime/test/vk_root_arguments_test.cpp (+100 -0)
📝 tests/test_root_sig_contract.py (+44 -5)
📝 tools/root_sig_contract.py (+16 -5)

📄 Description

Claimed: ROOT-SIG-SPILL-MODEL (coordination).

Depends on: #974, #1547, #1723 (merged; their layouts, pipeline workers and post-story queue/indirect paths are retained).

What and why

Compute root arguments need a packed memory block even for some signatures that fit inline. This is the full argument block, not merely a tail spill.

  • Model full-block offsets, whole-parameter/sticky-tail inline spill and the 64-dword bound; reject malformed parameters even after spilling. Graphics spills remain unsupported.
  • Preserve partial constants and both address halves; snapshot direct, indirect and counted dispatch arguments at record time.
  • Allocate fresh immutable host-coherent arena storage per dispatch execution. Supply its bounded console VA in s[0:1], not raw BDA; the translator adds heap_base.
  • Retain storage through queue completion; release unsubmitted storage on preparation/submission failure. No shared signature-owned mutable buffer or transfer/shader synchronization gap.
  • Keep the Python contract tool compute-only and consistent with the C++ packer.

All 52 embedded builder headers already initialize s4 from WorkgroupId.x. No translator/system-value override is needed.

Tested rebase

Head 0cc10a1ec, based on 490f5b9ec, replaces previously tested 1a85aad9c. Earlier tested heads remain preserved. Clean merge-tree check against newer main 5da72d19f. Same PR and remote branch; updated with an explicit old-head lease.

Preserves main's graphics/mesh argument windows, heap-direct indexing, title-VA rebasing, table descriptor counts, asynchronous/skipped pipeline behavior and geometry retention. block_offset follows table_descriptors; a regression asserts they remain distinct. The rollback fixture now injects a genuine second-upload failure instead of assuming an unresolved pipeline must abort submission.

The newer rebase also keeps main's stateful indirect-draw recording, clamp preparation/emission and submission retention, and remember_table tracking. Compute snapshots follow the moved record_indirect helper. A regression resolves one deferred pipeline shared by direct/indirect dispatches and checks every root-block VA survives. The GPU fixture now retains main's unbacked-root-view zeroing control and uses an explicitly synthetic, never-dereferenced alias to probe both address halves.

  • Complete native (GCC 16.2.1) and clang-cl/xwin Windows builds passed; at most 14 heavy workers.
  • Native CTest with validation: 99 passed, 1 corpus-dependent skip / 100; includes root GPU readback and synchronization-validation self-test.
  • Network-isolated Windows/Wine targeted CTest, no retail mount: 62 passed, 1 explicit host-comparison skip / 63. Includes all six root tests, loader/TLS/tiny-game checks, pipeline workers, stateful indirect pixel tests, clamp/budget paths, GPU labels/list values, descriptor rebinding, title VA, geometry and page pins. d3d12_indirect_zero skips the Microsoft-host comparison under Wine; it is not counted as a pass.
  • d3d12_indirect_dispatch_count now passes with main's merged fix; its earlier failure is not being carried as a waived result.
  • Translator: 490 files / 6,310 tests, zero failed files, 2 jobs.
  • Contract and line endings: 68 passed. Diff checks and explicit-path no-game-data scan passed.

GPUs tested: NVIDIA RTX 3070 Ti 8 GiB, driver 620.73.04, Linux; Wine 11.22 for Windows tests. Windows validation layers are unavailable here; GPU validation ran natively. Native Windows/MSVC not tested. Independent native Windows RTX 4060 confirmation of the old head's six root tests remains historical evidence, not a test of this rebase.

Scope and limitations

No title RT correctness, world frame or gameplay is claimed. The separate retail validation tree testing #1558 and owned translator fixes does not contain this PR.

Spilling-table behavior extends the measured inline four-byte table width and remains unmeasured in a retail spilling-table program. Other driver-SGPR scalar conventions are not established by these tests. Graphics spill layout is unsupported.

The earlier incorrect CreateHeap attribution remains withdrawn in the correction; slot 61 belongs to #383, not this work.

AI-assisted: yes. No game content, shader listings, raw boot logs, captures, keys or decryption included.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/ubiquitarianism/leonida/pull/1009 **Author:** [@djrolfes](https://github.com/djrolfes) **Created:** 11/24/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `djrolfes/root-sig-spill-safe` --- ### 📝 Commits (2) - [`23848bc`](https://github.com/ubiquitarianism/leonida/commit/23848bcf5f24dfc791c9ecbebaab27c2f4abbe21) root_signature: model the compute argument block instead of refusing a spill - [`25e5c4e`](https://github.com/ubiquitarianism/leonida/commit/25e5c4e4aa29a9d152602a6d8eaafa87eeaedda0) d3d12: snapshot compute arguments into submission-retained arena blocks ### 📊 Changes **19 files changed** (+986 additions, -118 deletions) <details> <summary>View changed files</summary> 📝 `docs/d3d12_vulkan.md` (+50 -19) 📝 `docs/design.md` (+1 -0) 📝 `runtime/CMakeLists.txt` (+45 -0) 📝 `runtime/shims/d3d12_com.cpp` (+19 -24) 📝 `runtime/shims/d3d12_com.h` (+2 -0) 📝 `runtime/shims/d3d12_vulkan_device.cpp` (+24 -4) 📝 `runtime/src/command_list.h` (+4 -0) 📝 `runtime/src/root_signature.cpp` (+17 -15) 📝 `runtime/src/root_signature.h` (+24 -15) 📝 `runtime/src/vulkan_backend.h` (+24 -0) 📝 `runtime/src/vulkan_replay.h` (+28 -0) ➕ `runtime/test/d3d12_root_arguments_test.cpp` (+189 -0) ➕ `runtime/test/glsl/cs_root_arguments.comp` (+28 -0) ➕ `runtime/test/queue_root_arguments_test.cpp` (+151 -0) ➕ `runtime/test/replay_root_arguments_test.cpp` (+134 -0) 📝 `runtime/test/root_signature_test.cpp` (+86 -31) ➕ `runtime/test/vk_root_arguments_test.cpp` (+100 -0) 📝 `tests/test_root_sig_contract.py` (+44 -5) 📝 `tools/root_sig_contract.py` (+16 -5) </details> ### 📄 Description Claimed: **ROOT-SIG-SPILL-MODEL** ([coordination](https://github.com/ubiquitarianism/leonida/issues/14#issuecomment-7135191157)). Depends on: #974, #1547, #1723 (merged; their layouts, pipeline workers and post-story queue/indirect paths are retained). ### What and why Compute root arguments need a packed memory block even for some signatures that fit inline. This is the full argument block, not merely a tail spill. - Model full-block offsets, whole-parameter/sticky-tail inline spill and the 64-dword bound; reject malformed parameters even after spilling. Graphics spills remain unsupported. - Preserve partial constants and both address halves; snapshot direct, indirect and counted dispatch arguments at record time. - Allocate fresh immutable host-coherent arena storage per dispatch execution. Supply its bounded console VA in s[0:1], not raw BDA; the translator adds heap_base. - Retain storage through queue completion; release unsubmitted storage on preparation/submission failure. No shared signature-owned mutable buffer or transfer/shader synchronization gap. - Keep the Python contract tool compute-only and consistent with the C++ packer. All 52 embedded builder headers already initialize s4 from WorkgroupId.x. No translator/system-value override is needed. ### Tested rebase Head **`0cc10a1ec`**, based on **`490f5b9ec`**, replaces previously tested `1a85aad9c`. Earlier tested heads remain preserved. Clean merge-tree check against newer main **`5da72d19f`**. Same PR and remote branch; updated with an explicit old-head lease. Preserves main's graphics/mesh argument windows, heap-direct indexing, title-VA rebasing, table descriptor counts, asynchronous/skipped pipeline behavior and geometry retention. `block_offset` follows `table_descriptors`; a regression asserts they remain distinct. The rollback fixture now injects a genuine second-upload failure instead of assuming an unresolved pipeline must abort submission. The newer rebase also keeps main's stateful indirect-draw recording, clamp preparation/emission and submission retention, and `remember_table` tracking. Compute snapshots follow the moved `record_indirect` helper. A regression resolves one deferred pipeline shared by direct/indirect dispatches and checks every root-block VA survives. The GPU fixture now retains main's unbacked-root-view zeroing control and uses an explicitly synthetic, never-dereferenced alias to probe both address halves. - Complete native (GCC 16.2.1) and clang-cl/xwin Windows builds passed; at most 14 heavy workers. - Native CTest with validation: **99 passed, 1 corpus-dependent skip / 100**; includes root GPU readback and synchronization-validation self-test. - Network-isolated Windows/Wine targeted CTest, no retail mount: **62 passed, 1 explicit host-comparison skip / 63**. Includes all six root tests, loader/TLS/tiny-game checks, pipeline workers, stateful indirect pixel tests, clamp/budget paths, GPU labels/list values, descriptor rebinding, title VA, geometry and page pins. `d3d12_indirect_zero` skips the Microsoft-host comparison under Wine; it is not counted as a pass. - `d3d12_indirect_dispatch_count` now passes with main's merged fix; its earlier failure is not being carried as a waived result. - Translator: **490 files / 6,310 tests**, zero failed files, 2 jobs. - Contract and line endings: **68 passed**. Diff checks and explicit-path no-game-data scan passed. GPUs tested: NVIDIA RTX 3070 Ti 8 GiB, driver 620.73.04, Linux; Wine 11.22 for Windows tests. Windows validation layers are unavailable here; GPU validation ran natively. Native Windows/MSVC not tested. Independent native Windows RTX 4060 confirmation of the old head's six root tests remains historical evidence, not a test of this rebase. ### Scope and limitations No title RT correctness, world frame or gameplay is claimed. The separate retail validation tree testing #1558 and owned translator fixes does **not** contain this PR. Spilling-table behavior extends the measured inline four-byte table width and remains unmeasured in a retail spilling-table program. Other driver-SGPR scalar conventions are not established by these tests. Graphics spill layout is unsupported. The earlier incorrect CreateHeap attribution remains withdrawn in [the correction](https://github.com/ubiquitarianism/leonida/issues/14#issuecomment-7137686495); slot 61 belongs to #383, not this work. AI-assisted: **yes**. No game content, shader listings, raw boot logs, captures, keys or decryption included. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
Sign in to join this conversation.
No labels
bug
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
starred/leonida#1047
No description provided.