d3d12-shader/gpu: view-address table for dynamically picked structure descriptors (D3D12-SHADER-SLOT-VIEW-ADDRESSES) #2661

Open
zmasi wants to merge 13 commits from upstream-pr/2661 into main
zmasi commented 2026-11-30 00:09:03 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by zmasi on 2026-11-30T00:09:03Z.


Claimed in the coordination issue as: D3D12-SHADER-SLOT-VIEW-ADDRESSES (https://github.com/ProjectLeonida/mandy/issues/2570#issuecomment-7249767838, https://github.com/ProjectLeonida/mandy/issues/2570#issuecomment-7264381245)

What and why

Implements D3D12-SHADER-SLOT-VIEW-ADDRESSES across leonida-shader and leonida-gpu, resolving the open d3d12/docs/fork-ray-tracing.md gap where ray-tracing shadow-mask trace programs read an acceleration structure's 64-bit title virtual address out of a descriptor picked from the view heap or a descriptor table by a computed index:

  1. SLOT_ADDRESSES Root SRV (t251, ROOT_CBV_SPACE) & USER_TABLE_BASE (0x10b):
    • Reserves root SRV slot 251 (SLOT_STRIDES_COUNT 64-bit (low, high) word pairs, 16 MiB upload buffer alongside SLOT_STRIDES at t252) and RootType::Other(USER_TABLE_BASE) (0x10b, un-snapshotted byte offset of a RootType::Table in the title's view heap) in d3d12/crates/leonida-shader/src/emit/{shader.rs,mod.rs} and wires SLOT_ADDRESSES lazily in d3d12/crates/leonida-shader/src/emit/diff_tests.rs.
  2. Computed-Index View-Address Lowering (d3d12/crates/leonida-shader/src/emit/lower.rs):
    • Adds Lower::slot_address(slot) clamping slot to SLOT_STRIDES_COUNT - 1 (UMIN tagged Tag::Clamp) and emitting a 2-dword rawBufferLoad at slot << 3 from SLOT_ADDRESSES.
    • Adds title_heap_index and title_fetched_index (unreplaced_table_word via USER_TABLE_BASE) so dynamic RootType::Table SLOT_ADDRESSES lookups index the title's view heap even when draw::State::tables snapshots the table's static CBV / half-format / capped-heap entries into dynamic slots or reuses content-addressed tables (LEONIDA_CONTENT_TABLES).
    • Adds slot_byte_mod32 / dynamic_mod32 to fold constant sub-slot byte offsets across s_or_b32, v_or_b32, v_lshl_or_b32, v_lshl_add_u32, s_lshl*_add_u32, shifts, additions, and phis (resolving +0 / +4 word starts accurately while rejecting +8..+28).
    • Updates Lower::descriptor_data and Lower::unused_descriptor_kind (read(k) checking both b.phis and b.insts, requiring slot_byte_mod32 == 0 and (2..5).any(read) on 8-dword 2D image dimension queries) so scalar s_load_dword..s_load_dwordx4 and address-only s_load_dwordx8 loads (including branch-joined phi loads and +4 high-dword reads) resolve (lo, hi) through view_address.
    • Extends Lower::flat so per-lane global_load_dword* (n <= 4, sub-slot byte 0 | 4) resolves fixed-offset Table reads via USER_VIEW_ADDRESS and computed-index ResourceHeap / Table reads via title_fetched_index + slot_address.
  3. Host View-Address Table & Structure Page Readiness (d3d12/crates/leonida-gpu/src/{descriptor/host.rs,draw.rs,pipeline/host.rs}):
    • Extends view_address (+ is_structure_view, plus make_twinned View::Placed acceleration-structure guard) to extract 48-bit title virtual addresses from both View::Shader and View::Placed (RAYTRACING_ACCELERATION_STRUCTURE desc[1] == 11 and buffer views).
    • Adds HostHeap::addresses (SLOT_STRIDES_COUNT * 8 bytes upload buffer written via single atomic 8-byte-aligned u64::write_volatile stores), title_count preservation for capped heaps, lock-free structure_count: AtomicU32 + structures: Mutex<HashMap<u32, u64>>, and write_address / note_structure / clear_structure across all static and dynamic slot lifecycle paths (including freeing dynamic slot ranges in HostHeap::release_many).
    • Supplies USER_TABLE_BASE in State::host_word, registers SLOT_ADDRESSES in pipeline::host, binds heap.addresses_gpu() in State::bind (State::heap_addresses) without triggering heap_buffer_pass, and includes heap.structure_addresses() in State::memory_ready (0 diff lines in d3d12/crates/leonida-gpu/src/host.rs).

Tested

  • Red (origin/main):
    • Computed-index structure-descriptor loads (HeapDwordx4, HeapDwordx8, HeapBranchPhiDwordx8, HeapSplitOffset4, TableDwordx4, HeapGlobalDwordx4) fail translation with Err("a descriptor read only as data") / unsupported global descriptor load.
  • Green:
    • cargo test --manifest-path d3d12/Cargo.toml -p leonida-shader --lib -- --test-threads=4 and cargo test --manifest-path d3d12/Cargo.toml -p leonida-shader --features host -- --test-threads=4 -> 369 passed; 0 failed on NVIDIA GeForce RTX 3090 D3D12, Microsoft WARP, and DXIL validation (including all 7 emit::intersect_tests PickedAddress shapes across 311 ray/node cases, loop-carried HeapLoopSplitOffset4, distinct per-parity 42-bit structure addresses, decoupled USER_TABLE_BASE, +8 / phi + 4 / unaligned v0 << 2 negative refusals, and fixed-offset Table global_load_dwordx4 -> USER_VIEW_ADDRESS).
    • cargo test --manifest-path d3d12/Cargo.toml -p leonida-gpu --lib descriptor:: -- --test-threads=4 -> 67 passed; 0 failed (including view_address_table dynamic AS cleanup across both uncapped and capped title_count-straddling runs and compatibility with QueueMarks, LEONIDA_SPANS_QUICK, and LEONIDA_KEEP_BY_LIST).
    • cargo test --manifest-path d3d12/Cargo.toml -p leonida-gpu --lib draw::tests -- --test-threads=4 -> 4 passed; 0 failed (including end-to-end RTX 3090 dispatch snapshotted_cbv_table_keeps_title_base_for_picked_view_addresses combining a CBV at table slot 0 with a dynamic TableDwordx4 structure-address read at table slot 19).
    • cargo test --manifest-path d3d12/Cargo.toml -p leonida-gpu --lib pipeline::host::tests -- --test-threads=4 -> 9 passed; 0 failed.
    • cargo clippy --manifest-path d3d12/Cargo.toml -p leonida-shader -p leonida-gpu --tests and --features diagnostics --tests -> 0 warnings on touched lines; python -I scripts/check_no_game_data.py clean.

GPUs tested: NVIDIA GeForce RTX 3090 (driver 610.88) and Microsoft WARP, Windows 11 Pro (26200)

AI-assisted: yes

Checklist

  • Based on current main and merges cleanly (a conflicting pull request is labeled needs rebase).
  • One topic; follow-up work goes in a new pull request.
  • No game data, keys or decryption (CONTRIBUTING.md), including in logs or reports quoted here.
  • A new translator rule is in the contract table of docs/design.md, with how it was confirmed. (n/a: d3d12/crates/leonida-shader DXIL backend; docs/design.md covers tools/rdna2spirv.py)
<!-- greyfinch-sync:ubiquitarianism/leonida:issue:5556644455 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2661). Originally posted by [zmasi](https://github.com/zmasi) on 2026-11-30T00:09:03Z. --- Claimed in the coordination issue as: D3D12-SHADER-SLOT-VIEW-ADDRESSES (https://github.com/ProjectLeonida/mandy/issues/2570#issuecomment-7249767838, https://github.com/ProjectLeonida/mandy/issues/2570#issuecomment-7264381245) ### What and why Implements `D3D12-SHADER-SLOT-VIEW-ADDRESSES` across `leonida-shader` and `leonida-gpu`, resolving the open `d3d12/docs/fork-ray-tracing.md` gap where ray-tracing shadow-mask trace programs read an acceleration structure's 64-bit title virtual address out of a descriptor picked from the view heap or a descriptor table by a computed index: 1. **`SLOT_ADDRESSES` Root SRV (`t251`, `ROOT_CBV_SPACE`) & `USER_TABLE_BASE` (`0x10b`)**: - Reserves root SRV slot `251` (`SLOT_STRIDES_COUNT` 64-bit `(low, high)` word pairs, `16 MiB` upload buffer alongside `SLOT_STRIDES` at `t252`) and `RootType::Other(USER_TABLE_BASE)` (`0x10b`, un-snapshotted byte offset of a `RootType::Table` in the title's view heap) in `d3d12/crates/leonida-shader/src/emit/{shader.rs,mod.rs}` and wires `SLOT_ADDRESSES` lazily in `d3d12/crates/leonida-shader/src/emit/diff_tests.rs`. 2. **Computed-Index View-Address Lowering (`d3d12/crates/leonida-shader/src/emit/lower.rs`)**: - Adds `Lower::slot_address(slot)` clamping `slot` to `SLOT_STRIDES_COUNT - 1` (`UMIN` tagged `Tag::Clamp`) and emitting a 2-dword `rawBufferLoad` at `slot << 3` from `SLOT_ADDRESSES`. - Adds `title_heap_index` and `title_fetched_index` (`unreplaced_table_word` via `USER_TABLE_BASE`) so dynamic `RootType::Table` `SLOT_ADDRESSES` lookups index the title's view heap even when `draw::State::tables` snapshots the table's static CBV / half-format / capped-heap entries into dynamic slots or reuses content-addressed tables (`LEONIDA_CONTENT_TABLES`). - Adds `slot_byte_mod32` / `dynamic_mod32` to fold constant sub-slot byte offsets across `s_or_b32`, `v_or_b32`, `v_lshl_or_b32`, `v_lshl_add_u32`, `s_lshl*_add_u32`, shifts, additions, and phis (resolving `+0` / `+4` word starts accurately while rejecting `+8..+28`). - Updates `Lower::descriptor_data` and `Lower::unused_descriptor_kind` (`read(k)` checking both `b.phis` and `b.insts`, requiring `slot_byte_mod32 == 0` and `(2..5).any(read)` on 8-dword 2D image dimension queries) so scalar `s_load_dword`..`s_load_dwordx4` and address-only `s_load_dwordx8` loads (including branch-joined phi loads and `+4` high-dword reads) resolve `(lo, hi)` through `view_address`. - Extends `Lower::flat` so per-lane `global_load_dword*` (`n <= 4`, sub-slot byte `0 | 4`) resolves fixed-offset `Table` reads via `USER_VIEW_ADDRESS` and computed-index `ResourceHeap` / `Table` reads via `title_fetched_index` + `slot_address`. 3. **Host View-Address Table & Structure Page Readiness (`d3d12/crates/leonida-gpu/src/{descriptor/host.rs,draw.rs,pipeline/host.rs}`)**: - Extends `view_address` (+ `is_structure_view`, plus `make_twinned` `View::Placed` acceleration-structure guard) to extract 48-bit title virtual addresses from both `View::Shader` and `View::Placed` (`RAYTRACING_ACCELERATION_STRUCTURE` `desc[1] == 11` and buffer views). - Adds `HostHeap::addresses` (`SLOT_STRIDES_COUNT * 8` bytes upload buffer written via single atomic 8-byte-aligned `u64::write_volatile` stores), `title_count` preservation for capped heaps, lock-free `structure_count: AtomicU32` + `structures: Mutex<HashMap<u32, u64>>`, and `write_address` / `note_structure` / `clear_structure` across all static and dynamic slot lifecycle paths (including freeing dynamic slot ranges in `HostHeap::release_many`). - Supplies `USER_TABLE_BASE` in `State::host_word`, registers `SLOT_ADDRESSES` in `pipeline::host`, binds `heap.addresses_gpu()` in `State::bind` (`State::heap_addresses`) without triggering `heap_buffer_pass`, and includes `heap.structure_addresses()` in `State::memory_ready` (`0` diff lines in `d3d12/crates/leonida-gpu/src/host.rs`). ### Tested - **Red (`origin/main`)**: - Computed-index structure-descriptor loads (`HeapDwordx4`, `HeapDwordx8`, `HeapBranchPhiDwordx8`, `HeapSplitOffset4`, `TableDwordx4`, `HeapGlobalDwordx4`) fail translation with `Err("a descriptor read only as data")` / unsupported global descriptor load. - **Green**: - `cargo test --manifest-path d3d12/Cargo.toml -p leonida-shader --lib -- --test-threads=4` and `cargo test --manifest-path d3d12/Cargo.toml -p leonida-shader --features host -- --test-threads=4` -> `369 passed; 0 failed` on NVIDIA GeForce RTX 3090 D3D12, Microsoft WARP, and DXIL validation (including all 7 `emit::intersect_tests` `PickedAddress` shapes across 311 ray/node cases, loop-carried `HeapLoopSplitOffset4`, distinct per-parity 42-bit structure addresses, decoupled `USER_TABLE_BASE`, `+8` / `phi + 4` / unaligned `v0 << 2` negative refusals, and fixed-offset `Table` `global_load_dwordx4` -> `USER_VIEW_ADDRESS`). - `cargo test --manifest-path d3d12/Cargo.toml -p leonida-gpu --lib descriptor:: -- --test-threads=4` -> `67 passed; 0 failed` (including `view_address_table` dynamic AS cleanup across both uncapped and capped `title_count`-straddling runs and compatibility with `QueueMarks`, `LEONIDA_SPANS_QUICK`, and `LEONIDA_KEEP_BY_LIST`). - `cargo test --manifest-path d3d12/Cargo.toml -p leonida-gpu --lib draw::tests -- --test-threads=4` -> `4 passed; 0 failed` (including end-to-end RTX 3090 dispatch `snapshotted_cbv_table_keeps_title_base_for_picked_view_addresses` combining a CBV at table slot `0` with a dynamic `TableDwordx4` structure-address read at table slot `19`). - `cargo test --manifest-path d3d12/Cargo.toml -p leonida-gpu --lib pipeline::host::tests -- --test-threads=4` -> `9 passed; 0 failed`. - `cargo clippy --manifest-path d3d12/Cargo.toml -p leonida-shader -p leonida-gpu --tests` and `--features diagnostics --tests` -> `0` warnings on touched lines; `python -I scripts/check_no_game_data.py` clean. GPUs tested: NVIDIA GeForce RTX 3090 (driver 610.88) and Microsoft WARP, Windows 11 Pro (26200) AI-assisted: yes ### Checklist - [x] Based on current `main` and merges cleanly (a conflicting pull request is labeled `needs rebase`). - [x] One topic; follow-up work goes in a new pull request. - [x] No game data, keys or decryption (CONTRIBUTING.md), including in logs or reports quoted here. - [x] A new translator rule is in the contract table of `docs/design.md`, with how it was confirmed. (n/a: `d3d12/crates/leonida-shader` DXIL backend; `docs/design.md` covers `tools/rdna2spirv.py`)
merzleckeier commented 2026-11-30 01:01:44 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by merzleckeier on 2026-11-30T01:01:44Z.


Independent Wine check of the computed descriptor addresses on 272aaec05 merged into b8bd37111 (tree 6c658aa8e). Win64 with leonida-gpu/diagnostics and leonida-shader/host, Wine 11.22, VKD3D-Proton 71cae091, RTX 4070 SUPER (620.73.04) and Radeon Raphael (RADV 26.3.1).

  • MEASURED draw::tests::snapshotted_cbv_table_keeps_title_base_for_picked_view_addresses returned [0, 0, 0, 0] in 3/3 RADV runs with VK_EXT_descriptor_heap enabled. The same binary passed 3/3 after setting only VKD3D_DISABLE_EXTENSIONS=VK_EXT_descriptor_heap; the log then showed VK_EXT_descriptor_buffer bindings. NVIDIA passed 3/3 with each backend. A logging-only follow-up confirmed the four-dword readback assertion was reached in every passing mode. Setting the output buffer’s initial state to UNORDERED_ACCESS alone repeated the same RADV split in one run per mode.
  • MEASURED All seven intersect_tests passed on each GPU. The new test compiled all seven address shapes and executed them with its synthetic memory stand-in. In three compiler-only controls on main with the same input generator, six shapes were rejected and HeapBranchPhiDwordx8 lowered.
  • MEASURED view_address_table_tracks_structures_buffers_and_clears reached its final capped-heap cleanup assertion on both GPUs with each backend. The two failures in the wider descriptor:: filter also reproduced on plain main with both backends (halves_cross_an_unsigned_buffer_view_unchanged and views_are_made_beside_the_heap_and_copied_in).

Synthetic fixtures only. AI-assisted with OpenAI Codex.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7265779497 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2661#issuecomment-7265779497). Originally posted by [merzleckeier](https://github.com/merzleckeier) on 2026-11-30T01:01:44Z. --- Independent Wine check of the computed descriptor addresses on `272aaec05` merged into `b8bd37111` (tree `6c658aa8e`). Win64 with `leonida-gpu/diagnostics` and `leonida-shader/host`, Wine 11.22, VKD3D-Proton `71cae091`, RTX 4070 SUPER (620.73.04) and Radeon Raphael (RADV 26.3.1). - **MEASURED** `draw::tests::snapshotted_cbv_table_keeps_title_base_for_picked_view_addresses` returned `[0, 0, 0, 0]` in 3/3 RADV runs with `VK_EXT_descriptor_heap` enabled. The same binary passed 3/3 after setting only `VKD3D_DISABLE_EXTENSIONS=VK_EXT_descriptor_heap`; the log then showed `VK_EXT_descriptor_buffer` bindings. NVIDIA passed 3/3 with each backend. A logging-only follow-up confirmed the four-dword readback assertion was reached in every passing mode. Setting the output buffer’s initial state to `UNORDERED_ACCESS` alone repeated the same RADV split in one run per mode. - **MEASURED** All seven `intersect_tests` passed on each GPU. The new test compiled all seven address shapes and executed them with its synthetic memory stand-in. In three compiler-only controls on `main` with the same input generator, six shapes were rejected and `HeapBranchPhiDwordx8` lowered. - **MEASURED** `view_address_table_tracks_structures_buffers_and_clears` reached its final capped-heap cleanup assertion on both GPUs with each backend. The two failures in the wider `descriptor::` filter also reproduced on plain `main` with both backends (`halves_cross_an_unsigned_buffer_view_unchanged` and `views_are_made_beside_the_heap_and_copied_in`). Synthetic fixtures only. AI-assisted with OpenAI Codex.
zmasi commented 2026-11-30 01:14:04 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by zmasi on 2026-11-30T01:14:04Z.


Thanks for the thorough multi-backend run across RTX 4070 SUPER and Radeon Raphael!

Good observation on the VK_EXT_descriptor_heap RADV split: snapshotted_cbv_table_keeps_title_base_for_picked_view_addresses creates its CBV and raw UAV via HostHeap::put (descriptor/host.rs), which creates descriptors in the thread-local CPU staging heap (staged()) and copies them into the shader-visible heap with CopyDescriptorsSimple — the exact same path exercised by the two main tests (views_are_made_beside_the_heap_and_copied_in and halves_cross_an_unsigned_buffer_view_unchanged) that showed the same VK_EXT_descriptor_heap vs VK_EXT_descriptor_buffer behavior on RADV 26.3.1.

AI-assisted.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7265960486 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2661#issuecomment-7265960486). Originally posted by [zmasi](https://github.com/zmasi) on 2026-11-30T01:14:04Z. --- Thanks for the thorough multi-backend run across RTX 4070 SUPER and Radeon Raphael! Good observation on the `VK_EXT_descriptor_heap` RADV split: `snapshotted_cbv_table_keeps_title_base_for_picked_view_addresses` creates its CBV and raw UAV via `HostHeap::put` (`descriptor/host.rs`), which creates descriptors in the thread-local CPU staging heap (`staged()`) and copies them into the shader-visible heap with `CopyDescriptorsSimple` — the exact same path exercised by the two `main` tests (`views_are_made_beside_the_heap_and_copied_in` and `halves_cross_an_unsigned_buffer_view_unchanged`) that showed the same `VK_EXT_descriptor_heap` vs `VK_EXT_descriptor_buffer` behavior on RADV 26.3.1. AI-assisted.
merzleckeier commented 2026-11-30 01:19:27 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by merzleckeier on 2026-11-30T01:19:27Z.


Follow-up on the descriptor staging hypothesis. I reran the exact draw test on 272aaec05 merged into 0eab02a8b (tree 520444fa7), with fresh Wine processes for LEONIDA_VIEW_COPY=1 and 0. staged() returns None with 0, so HostHeap::at writes into the final slot and copy_to skips the staging copy.

MEASURED On RADV, the descriptor-heap backend still returned [0, 0, 0, 0] in 3/3 runs with staging and 3/3 runs with direct writes. The descriptor-buffer backend passed 3/3 with each setting. NVIDIA passed 3/3 in all four combinations. The heap/buffer backend was confirmed in the VKD3D logs.

For clarity on the earlier controls, the two wider descriptor-suite failures also occurred on plain b8bd37111 with both backends. The all-zero draw readback is the result that depends on the backend in this matrix.

Synthetic fixtures only. AI-assisted with OpenAI Codex.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7266039544 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2661#issuecomment-7266039544). Originally posted by [merzleckeier](https://github.com/merzleckeier) on 2026-11-30T01:19:27Z. --- Follow-up on the descriptor staging hypothesis. I reran the exact draw test on `272aaec05` merged into `0eab02a8b` (tree `520444fa7`), with fresh Wine processes for `LEONIDA_VIEW_COPY=1` and `0`. `staged()` returns `None` with `0`, so `HostHeap::at` writes into the final slot and `copy_to` skips the staging copy. **MEASURED** On RADV, the descriptor-heap backend still returned `[0, 0, 0, 0]` in 3/3 runs with staging and 3/3 runs with direct writes. The descriptor-buffer backend passed 3/3 with each setting. NVIDIA passed 3/3 in all four combinations. The heap/buffer backend was confirmed in the VKD3D logs. For clarity on the earlier controls, the two wider descriptor-suite failures also occurred on plain `b8bd37111` with both backends. The all-zero draw readback is the result that depends on the backend in this matrix. Synthetic fixtures only. AI-assisted with OpenAI Codex.
ammonium231 commented 2026-11-30 05:59:54 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by ammonium231 on 2026-11-30T05:59:54Z.


RTX 3090 / 621.40, validation on, b6e498923 merged onto main 1d22590b9: leonida-shader --lib and --features host 371 pass, 4 ignored (main 370); descriptor:: 67 (main 66) incl. view_address_table_tracks_structures_buffers_and_clears; draw::tests 4 (main 3) incl. snapshotted_cbv_table_keeps_title_base_for_picked_view_addresses. No validation errors.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7270202728 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2661#issuecomment-7270202728). Originally posted by [ammonium231](https://github.com/ammonium231) on 2026-11-30T05:59:54Z. --- RTX 3090 / 621.40, validation on, b6e498923 merged onto main 1d22590b9: leonida-shader --lib and --features host 371 pass, 4 ignored (main 370); descriptor:: 67 (main 66) incl. view_address_table_tracks_structures_buffers_and_clears; draw::tests 4 (main 3) incl. snapshotted_cbv_table_keeps_title_base_for_picked_view_addresses. No validation errors.
ammonium231 commented 2026-11-30 11:42:05 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by ammonium231 on 2026-11-30T11:42:05Z.


RTX 3090 / 621.40, validation on, 19e23c2ae merged onto main 0568cd62e: shader --lib and host 386 pass, 4 ignored (main 385); descriptor:: 68 (main 67) and draw::tests 4 (main 3), incl. both new tests. No validation errors.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7277392331 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2661#issuecomment-7277392331). Originally posted by [ammonium231](https://github.com/ammonium231) on 2026-11-30T11:42:05Z. --- RTX 3090 / 621.40, validation on, 19e23c2ae merged onto main 0568cd62e: shader --lib and host 386 pass, 4 ignored (main 385); descriptor:: 68 (main 67) and draw::tests 4 (main 3), incl. both new tests. No validation errors.
KelboLive commented 2026-12-01 14:41:09 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by KelboLive on 2026-12-01T14:41:09Z.

Review: COMMENTED


Reviewed b05875ff7 and the merge with current main (81ff5e1b1). The computed-index claim holds: view_address / slot_byte_mod32 (lower.rs:4985-5026, :4725-4746) split fixed-Table from dynamic/ResourceHeap lookups, USER_TABLE_BASE returns handle - heap.start (draw.rs:2836-2838) and unreplaced_table_word adds the snapshot delta (lower.rs:10554-10566), so a table picked at a computed index still addresses the title's heap after tables() copies static entries into dynamic slots. The e2e draw test reads back exactly [0x13572468, tlas_lo, tlas_hi, 0xcafebabe], and the 311-case intersect test checks per-lane addresses across all seven shapes.

The sub-slot guard is live: reverting the 0 | 4 acceptance makes a_structure_address_picked_by_computed_index fail with Unsupported { offset: 164, what: "a descriptor read only as data" }. Tests here: shader 405/405 (also --features host), descriptor 69/69, draw 4/4, pipeline 9/9, check_no_game_data clean, and a locally merged tree compiles and passes the targeted tests — so the clean merge-tree is not merely textual.

Two non-blocking notes:

  1. The View::Placed acceleration-structure fallback at descriptor/host.rs:5206-5214 (desc[4..5] else desc[10..11]) has no test: the placed case sets desc[4..5] and leaves [10..11] zero, although the test comment calls it the "placed-base fallback".
  2. Every non-sampler heap now allocates a 16 MiB address upload table (descriptor/host.rs:2383-2394) even when no shader asks for SLOT_ADDRESSES — consistent with the existing 8 MiB SLOT_STRIDES table, but it doubles the fixed per-heap upload cost, which is worth knowing on a 16 GB card.

The branch is 271 commits behind and main has since touched lower.rs, mod.rs, draw.rs and descriptor/host.rs, so rebase before merging even though the merge is clean.

<!-- greyfinch-sync:ubiquitarianism/leonida:review:6133520843 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2661#pullrequestreview-6133520843). Originally posted by [KelboLive](https://github.com/KelboLive) on 2026-12-01T14:41:09Z. **Review:** COMMENTED --- Reviewed `b05875ff7` and the merge with current main (`81ff5e1b1`). The computed-index claim holds: `view_address` / `slot_byte_mod32` (`lower.rs:4985-5026`, `:4725-4746`) split fixed-`Table` from dynamic/`ResourceHeap` lookups, `USER_TABLE_BASE` returns `handle - heap.start` (`draw.rs:2836-2838`) and `unreplaced_table_word` adds the snapshot delta (`lower.rs:10554-10566`), so a table picked at a computed index still addresses the title's heap after `tables()` copies static entries into dynamic slots. The e2e draw test reads back exactly `[0x13572468, tlas_lo, tlas_hi, 0xcafebabe]`, and the 311-case intersect test checks per-lane addresses across all seven shapes. The sub-slot guard is live: reverting the `0 | 4` acceptance makes `a_structure_address_picked_by_computed_index` fail with `Unsupported { offset: 164, what: "a descriptor read only as data" }`. Tests here: shader 405/405 (also `--features host`), descriptor 69/69, draw 4/4, pipeline 9/9, `check_no_game_data` clean, and a locally merged tree compiles and passes the targeted tests — so the clean `merge-tree` is not merely textual. Two non-blocking notes: 1. The `View::Placed` acceleration-structure fallback at `descriptor/host.rs:5206-5214` (`desc[4..5]` else `desc[10..11]`) has **no test**: the placed case sets `desc[4..5]` and leaves `[10..11]` zero, although the test comment calls it the "placed-base fallback". 2. Every non-sampler heap now allocates a 16 MiB address upload table (`descriptor/host.rs:2383-2394`) even when no shader asks for `SLOT_ADDRESSES` — consistent with the existing 8 MiB `SLOT_STRIDES` table, but it doubles the fixed per-heap upload cost, which is worth knowing on a 16 GB card. The branch is 271 commits behind and main has since touched `lower.rs`, `mod.rs`, `draw.rs` and `descriptor/host.rs`, so rebase before merging even though the merge is clean.
KelboLive commented 2026-12-01 14:56:59 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by KelboLive on 2026-12-01T14:56:59Z.


Second pass on the same head, adding three things the first review did not cover (the core claim and the 0 | 4 mutation both still check out):

  1. The docs still call this an open gap. d3d12/docs/fork-ray-tracing.md:128-131 lists the five shadow-mask programs as needing "a table of addresses by slot", while the body says this PR provides it. The PR touches no docs, so the page will contradict the code after merge.
  2. A semantic change that contradicts the commit message. unused_descriptor_kind goes from 8 if (1..5).any(read) to 8 if aligned && (2..5).any(read) (lower.rs:9339), but aligned uses is_none_or (:9327-9332), so an unproven dynamic mod-32 still counts as a descriptor start — the opposite of "no defaulting unproven offsets". It may be right (the width spans dwords 1–2), but it is unverified: a corpus count or a test would settle it.
  3. Question on page readiness: structure_addresses() returns only RTAS views (host.rs:2695, is_structure_view :5218), so a buffer address picked through the same table gets no memory_ready treatment (draw.rs:2947). The intersect test covers buffers only through the TEST_MEMORY fixture. Intentional?

Also, for anyone reusing cargo-target-2661: a stale LEONIDA_SHADER_SOURCE_HASH from an earlier mutation run makes source_hash_tests::the_source_hash_leaves_the_test_modules_out fail with a mismatched hash until build.rs is touched — it is the shared target dir, not the PR.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7315090964 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2661#issuecomment-7315090964). Originally posted by [KelboLive](https://github.com/KelboLive) on 2026-12-01T14:56:59Z. --- Second pass on the same head, adding three things the first review did not cover (the core claim and the `0 | 4` mutation both still check out): 1. **The docs still call this an open gap.** `d3d12/docs/fork-ray-tracing.md:128-131` lists the five shadow-mask programs as needing "a table of addresses by slot", while the body says this PR provides it. The PR touches no docs, so the page will contradict the code after merge. 2. **A semantic change that contradicts the commit message.** `unused_descriptor_kind` goes from `8 if (1..5).any(read)` to `8 if aligned && (2..5).any(read)` (`lower.rs:9339`), but `aligned` uses `is_none_or` (`:9327-9332`), so an **unproven** dynamic mod-32 still counts as a descriptor start — the opposite of "no defaulting unproven offsets". It may be right (the width spans dwords 1–2), but it is unverified: a corpus count or a test would settle it. 3. **Question on page readiness:** `structure_addresses()` returns only RTAS views (`host.rs:2695`, `is_structure_view` `:5218`), so a **buffer** address picked through the same table gets no `memory_ready` treatment (`draw.rs:2947`). The intersect test covers buffers only through the `TEST_MEMORY` fixture. Intentional? Also, for anyone reusing `cargo-target-2661`: a stale `LEONIDA_SHADER_SOURCE_HASH` from an earlier mutation run makes `source_hash_tests::the_source_hash_leaves_the_test_modules_out` fail with a mismatched hash until `build.rs` is touched — it is the shared target dir, not the PR.
merzleckeier commented 2026-12-01 15:09:47 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by merzleckeier on 2026-12-01T15:09:47Z.


I ran a two-vendor synthetic dispatch verification on b05875ff merged into edf7d01f8, with Win64 MSVC-target binaries under Wine 11.22 and VKD3D-Proton 3.1.0. All seven intersect_tests and the two GPU descriptor/draw tests passed on Radeon Raphael (RADV 26.3.1) and RTX 4070 SUPER (620.73.04).

The computed-index test actually needs an SM 6.6 device to pass. It dispatches the seven synthetic address forms, including the branch/loop offsets and per-lane global load, with a CPU oracle and different 42-bit structure addresses per lane parity. Its rejection cases and fixed-table-offset path passed as part of the same test. The descriptor tests also exercised listed-view cache hits and clears and the retained title base for a snapshotted CBV table. DXVK reported no WARP adapter, so this is physical-GPU coverage. The dispatch fixture uses its synthetic node-memory stand-in. MEASURED, AI-assisted (Codex).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7315449204 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2661#issuecomment-7315449204). Originally posted by [merzleckeier](https://github.com/merzleckeier) on 2026-12-01T15:09:47Z. --- I ran a two-vendor synthetic dispatch verification on b05875ff merged into edf7d01f8, with Win64 MSVC-target binaries under Wine 11.22 and VKD3D-Proton 3.1.0. All seven intersect_tests and the two GPU descriptor/draw tests passed on Radeon Raphael (RADV 26.3.1) and RTX 4070 SUPER (620.73.04). The computed-index test actually needs an SM 6.6 device to pass. It dispatches the seven synthetic address forms, including the branch/loop offsets and per-lane global load, with a CPU oracle and different 42-bit structure addresses per lane parity. Its rejection cases and fixed-table-offset path passed as part of the same test. The descriptor tests also exercised listed-view cache hits and clears and the retained title base for a snapshotted CBV table. DXVK reported no WARP adapter, so this is physical-GPU coverage. The dispatch fixture uses its synthetic node-memory stand-in. MEASURED, AI-assisted (Codex).
MoonEyes commented 2026-12-02 12:23:53 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by MoonEyes on 2026-12-02T12:23:53Z.


This pull request touches the render path, so it needs an in-game run before it can be merged: unit tests and CI do not catch rendering regressions (a device loss after an earlier merge is why this gate exists).

Could you, or anyone with a working setup, post a run report on the current head merged onto current main:

  • the head SHA and the main SHA it was merged onto;
  • GPU, driver and OS;
  • at least 300 s in the world after loading;
  • device lost / crashes (count), and rendered fps (median) if you have them;
  • the same run on main alone for comparison, if you can.

Please do not attach logs or screenshots that show game content. If a run on this exact head is already posted, a link to it in a reply is enough.

AI-assisted (Claude Code).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7345277857 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2661#issuecomment-7345277857). Originally posted by [MoonEyes](https://github.com/MoonEyes) on 2026-12-02T12:23:53Z. --- This pull request touches the render path, so it needs an in-game run before it can be merged: unit tests and CI do not catch rendering regressions (a device loss after an earlier merge is why this gate exists). Could you, or anyone with a working setup, post a run report on the **current head** merged onto current `main`: - the head SHA and the `main` SHA it was merged onto; - GPU, driver and OS; - at least 300 s in the world after loading; - device lost / crashes (count), and rendered fps (median) if you have them; - the same run on `main` alone for comparison, if you can. Please do not attach logs or screenshots that show game content. If a run on this exact head is already posted, a link to it in a reply is enough. AI-assisted (Claude Code).
Kal0s-design commented 2026-12-02 15:04:09 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by Kal0s-design on 2026-12-02T15:04:09Z.


Ran natively on Windows 11, head 1b3f3dee0 merged into current main (69cd4106c, clean merge), debug test profile. This head is the SLOT_TLAS_* reconcile merge, which the earlier reports don't cover.

PR tests and suites on the merge

Check Result
emit::intersect_tests (--features host, debug layer on, run twice) 7/7 both times
descriptor:: + draw::tests + pipeline::host::tests, card, debug layer on 107 passed, 5 ignored
same, WARP, debug layer on 107 passed, 5 ignored
leonida-shader --lib --features host, full 429 passed, 6 ignored
leonida-gpu --lib --features diagnostics, full, WARP 779 passed, 59 ignored

The intersect tests pick the hardware adapter and WARP themselves. a_structure_address_picked_by_computed_index_translates_and_runs_on_the_card loops over both and prints "no SM 6.6 ... device; skipped" when one is missing. That line never appeared, so both dispatches ran. view_address_table_tracks_structures_buffers_and_clears and snapshotted_cbv_table_keeps_title_base_for_picked_view_addresses ran on both the card and WARP and passed with the debug layer enabled. Clippy on both crates (--tests, diagnostics, host): nothing in the files this PR touches. d3d12_switches.py --check is clean.

On the reconcile: SLOT_ADDRESSES (251) and SLOT_TLAS_BASE..=SLOT_TLAS_MAX (230 to 241) don't overlap. Both are in the ours list in pipeline/host.rs, and the bind loop in draw.rs checks them one after the other. Lowering fills them from separate places: tlas_srvs comes from lifted ray queries in rayquery.rs, and SLOT_ADDRESSES comes from the software-traversal loads in lower.rs. The new 2,048-slot sampler-heap branch allocates no address table (addresses is None for samplers, checked).

Extra throwaway host tests on the address table (not pushed), 1 run on the card and 2 on WARP, all passed

Case Result
Writes at title slots 0 and 7 of an 8-slot heap, and at the first and last dynamic slot correct values; neighbours and the slot after the last stay 0
write_address(SLOT_STRIDES_COUNT, ..) no crash (the index guard skips it)
20,000 dynamic structure views, then release_many in two runs structure_count 20,000, then 0; sampled entries correct
Released run reallocated and nulled entry 0, no structure comes back
Heap dropped and a new one made the slot written in the old heap reads 0 in the new one, no structures
8 writer threads flip 64 dynamic slots between two addresses whose low and high dwords both differ, plus make_null, against a 1.5 s CPU reader 9.5 M (card) / 62.8 M (WARP) reads, 0 torn values, structure_count equal to the map size at the end

Two observations, neither blocking:

  1. release_many removes freed dynamic slots from structures, but their table entries keep the old address until the slot is reused (0x12345678aa0 was still there after the release). This matches the descriptors themselves, which are also left in place, and reallocating the run and nulling a slot rewrote its entry (the only reuse path I tried). A shader would only see the stale value if it read a freed slot.
  2. On a capped heap every dynamic slot can sit below title_count. On the card, asking for 1,000,000 or 2,000,000 slots gave count 737,855 with dynamic slots 737,855 to 999,998, all below title_count, so update_dynamic_address never writes them and their entries hold the title's own slots. That looks like the intended behaviour (shaders index title slots through USER_TABLE_BASE). I mention it because the PR's straddle test only covers the case where title_count falls inside the dynamic range. The largest heaps I could make ended at slot 999,998 on the card and 2,097,150 on WARP, inside the 2,097,152-entry table. Only a title count above 2,097,152 clamps (title_count 2,097,152 for a 4,000,000 request).

Small doc nit: the merged switches.md row for LEONIDA_LATE_WAIT now names leonida-gpu/descriptor/host.rs +3 instead of leonida-gpu/host.rs +2. The switch lives in host.rs (13 mentions). The new write_address comment is the only mention in descriptor/host.rs, but the generator picks that file. --check still passes.

Not checked: an in-game run (the gate asked for above), GPU-side reads racing CPU table writes in flight (only a CPU reader was used), debug-layer messages beyond what a failure would surface, red on main (already shown by others), and AMD.

GPUs tested: one NVIDIA desktop card + WARP.
AI-assisted: yes (Claude Code).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7349657236 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2661#issuecomment-7349657236). Originally posted by [Kal0s-design](https://github.com/Kal0s-design) on 2026-12-02T15:04:09Z. --- Ran natively on Windows 11, head `1b3f3dee0` merged into current `main` (`69cd4106c`, clean merge), debug test profile. This head is the `SLOT_TLAS_*` reconcile merge, which the earlier reports don't cover. **PR tests and suites on the merge** | Check | Result | |---|---| | `emit::intersect_tests` (`--features host`, debug layer on, run twice) | 7/7 both times | | `descriptor::` + `draw::tests` + `pipeline::host::tests`, card, debug layer on | 107 passed, 5 ignored | | same, WARP, debug layer on | 107 passed, 5 ignored | | `leonida-shader --lib --features host`, full | 429 passed, 6 ignored | | `leonida-gpu --lib --features diagnostics`, full, WARP | 779 passed, 59 ignored | The intersect tests pick the hardware adapter and WARP themselves. `a_structure_address_picked_by_computed_index_translates_and_runs_on_the_card` loops over both and prints "no SM 6.6 ... device; skipped" when one is missing. That line never appeared, so both dispatches ran. `view_address_table_tracks_structures_buffers_and_clears` and `snapshotted_cbv_table_keeps_title_base_for_picked_view_addresses` ran on both the card and WARP and passed with the debug layer enabled. Clippy on both crates (`--tests`, `diagnostics`, `host`): nothing in the files this PR touches. `d3d12_switches.py --check` is clean. On the reconcile: `SLOT_ADDRESSES` (251) and `SLOT_TLAS_BASE..=SLOT_TLAS_MAX` (230 to 241) don't overlap. Both are in the `ours` list in `pipeline/host.rs`, and the bind loop in `draw.rs` checks them one after the other. Lowering fills them from separate places: `tlas_srvs` comes from lifted ray queries in `rayquery.rs`, and `SLOT_ADDRESSES` comes from the software-traversal loads in `lower.rs`. The new 2,048-slot sampler-heap branch allocates no address table (`addresses` is `None` for samplers, checked). **Extra throwaway host tests on the address table (not pushed), 1 run on the card and 2 on WARP, all passed** | Case | Result | |---|---| | Writes at title slots 0 and 7 of an 8-slot heap, and at the first and last dynamic slot | correct values; neighbours and the slot after the last stay 0 | | `write_address(SLOT_STRIDES_COUNT, ..)` | no crash (the index guard skips it) | | 20,000 dynamic structure views, then `release_many` in two runs | `structure_count` 20,000, then 0; sampled entries correct | | Released run reallocated and nulled | entry 0, no structure comes back | | Heap dropped and a new one made | the slot written in the old heap reads 0 in the new one, no structures | | 8 writer threads flip 64 dynamic slots between two addresses whose low and high dwords both differ, plus `make_null`, against a 1.5 s CPU reader | 9.5 M (card) / 62.8 M (WARP) reads, 0 torn values, `structure_count` equal to the map size at the end | Two observations, neither blocking: 1. `release_many` removes freed dynamic slots from `structures`, but their table entries keep the old address until the slot is reused (`0x12345678aa0` was still there after the release). This matches the descriptors themselves, which are also left in place, and reallocating the run and nulling a slot rewrote its entry (the only reuse path I tried). A shader would only see the stale value if it read a freed slot. 2. On a capped heap every dynamic slot can sit below `title_count`. On the card, asking for 1,000,000 or 2,000,000 slots gave `count` 737,855 with dynamic slots 737,855 to 999,998, all below `title_count`, so `update_dynamic_address` never writes them and their entries hold the title's own slots. That looks like the intended behaviour (shaders index title slots through `USER_TABLE_BASE`). I mention it because the PR's straddle test only covers the case where `title_count` falls inside the dynamic range. The largest heaps I could make ended at slot 999,998 on the card and 2,097,150 on WARP, inside the 2,097,152-entry table. Only a title count above 2,097,152 clamps (`title_count` 2,097,152 for a 4,000,000 request). Small doc nit: the merged `switches.md` row for `LEONIDA_LATE_WAIT` now names `leonida-gpu/descriptor/host.rs +3` instead of `leonida-gpu/host.rs +2`. The switch lives in `host.rs` (13 mentions). The new `write_address` comment is the only mention in `descriptor/host.rs`, but the generator picks that file. `--check` still passes. Not checked: an in-game run (the gate asked for above), GPU-side reads racing CPU table writes in flight (only a CPU reader was used), debug-layer messages beyond what a failure would surface, red on `main` (already shown by others), and AMD. GPUs tested: one NVIDIA desktop card + WARP. AI-assisted: yes (Claude Code).
enlight3d commented 2026-12-02 17:07:56 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by enlight3d on 2026-12-02T17:07:56Z.


RUN (in game, gate-style, as asked by MoonEyes): head 1b3f3dee0 tested in a batch with #2643 (2cea6871c), #3031 (a47b86855), #2789 (4bd128a8c) and #2661 (1b3f3dee0), all merged with git merge --no-ff onto main 23a51c494 (no conflict; the only file the four share is d3d12/docs/switches.md). Built with diagnostics,mimalloc, target x86_64-pc-windows-msvc. RTX 3090 24 GB, NVIDIA 621.40, Windows 11 Pro (build 26300).

Launcher defaults, Series S settings, -NoDlss -NoFrameGen, standing at the save; a warm-up run first (the batch changes the translator, so everything was re-translated), then one run of 420 s with the memory safety stop:

Reached the world 71 s
Time in the world 349 s
Device losses 0
Crashes 0
Frame median 29.4 ms (33.6 fps rendered)
Card busy 95 %
Private memory, max 26.6 GB

Verdict: PASS for the batch (a pass covers each of the four; a failure would not have said which). Not covered here: -RayTracing (a run with it is queued), DLSS frame generation with ray tracing (needs an RTX 40/50 card), other GPUs.

AI-assisted: Claude Code (Claude Opus 5.5)

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7352943601 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2661#issuecomment-7352943601). Originally posted by [enlight3d](https://github.com/enlight3d) on 2026-12-02T17:07:56Z. --- RUN (in game, gate-style, as asked by MoonEyes): head 1b3f3dee0 tested **in a batch** with #2643 (2cea6871c), #3031 (a47b86855), #2789 (4bd128a8c) and #2661 (1b3f3dee0), all merged with `git merge --no-ff` onto `main` 23a51c494 (no conflict; the only file the four share is `d3d12/docs/switches.md`). Built with `diagnostics,mimalloc`, target `x86_64-pc-windows-msvc`. RTX 3090 24 GB, NVIDIA 621.40, Windows 11 Pro (build 26300). Launcher defaults, Series S settings, `-NoDlss -NoFrameGen`, standing at the save; a warm-up run first (the batch changes the translator, so everything was re-translated), then one run of 420 s with the memory safety stop: | | | |---|---| | Reached the world | 71 s | | Time in the world | 349 s | | Device losses | 0 | | Crashes | 0 | | Frame median | 29.4 ms (33.6 fps rendered) | | Card busy | 95 % | | Private memory, max | 26.6 GB | Verdict: **PASS** for the batch (a pass covers each of the four; a failure would not have said which). Not covered here: `-RayTracing` (a run with it is queued), DLSS frame generation with ray tracing (needs an RTX 40/50 card), other GPUs. AI-assisted: Claude Code (Claude Opus 5.5)
MoonEyes commented 2026-12-02 18:03:23 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by MoonEyes on 2026-12-02T18:03:23Z.


Light code review only, not built (Windows-only leonida-shader and leonida-gpu). Ready, on the runs already posted on this head.

  • Head: 1b3f3dee0, merge base 229d352ee, 188 behind current main 45dc41f95. A trial merge is clean. CI on the head: all 6 checks pass.
  • Already verified on this exact head, with no commits since:
    • Kal0s-design (15:04, Windows 11):
      • emit::intersect_tests with the debug layer: 7/7, twice.
      • descriptor::, draw::tests and pipeline::host::tests on the card and on WARP with the debug layer: 107 passed each.
      • leonida-shader --features host: 429 passed.
      • leonida-gpu --features diagnostics: 779 passed.
      • Both dispatches ran (no "no SM 6.6" skip).
    • enlight3d (17:07): in-game batch with #2643, #3031 and #2789, 349 s in the world, 0 device losses, PASS, without -RayTracing.

Review notes (1,578 added across emit/lower.rs, emit/shader.rs, descriptor/host.rs, draw.rs, pipeline/host.rs):

  • Structure descriptors picked by a dynamic index now go through a view-address table, SLOT_TLAS_*, kept in step with the heap. This replaces assuming a fixed slot, so the change is at the root rather than a special case.
  • Kal0s's probe of write_address(SLOT_STRIDES_COUNT, ..) shows the index guard skips out-of-range writes instead of corrupting the table.
  • Docs gap. This closes the gap listed at d3d12/docs/fork-ray-tracing.md:186-189 ("Five shadow-mask trace programs do not translate ... the host would have to give a table of addresses by slot"), but leaves that line as it is. Only d3d12/docs/switches.md is updated. Please update or remove that bullet so the docs match.
  • What the gate covered. The same doc says "The title did not create them in any run so far". The batch also ran without -RayTracing, and #3031 in that batch is under an author "do not merge" for ray-tracing hangs. So the in-game PASS most likely never ran the new lowering. Its evidence is the unit and debug-layer dispatches above. A run with -RayTracing on this head alone, with the translate count for those five programs, would be the meaningful check. enlight3d has a -RayTracing run queued.

Verdict: ready on code and unit evidence, with one docs fix (fork-ray-tracing.md:186-189). I would wait for the queued -RayTracing run before merging.

AI-assisted verification: Claude Opus (Claude Code), separate agent per batch.


Generated by Claude Code

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7353899552 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2661#issuecomment-7353899552). Originally posted by [MoonEyes](https://github.com/MoonEyes) on 2026-12-02T18:03:23Z. --- **Light code review only, not built (Windows-only `leonida-shader` and `leonida-gpu`). Ready, on the runs already posted on this head.** - Head: `1b3f3dee0`, merge base `229d352ee`, 188 behind current `main` `45dc41f95`. A trial merge is clean. CI on the head: all 6 checks pass. - Already verified on this exact head, with no commits since: - Kal0s-design (15:04, Windows 11): - `emit::intersect_tests` with the debug layer: 7/7, twice. - `descriptor::`, `draw::tests` and `pipeline::host::tests` on the card and on WARP with the debug layer: 107 passed each. - `leonida-shader --features host`: 429 passed. - `leonida-gpu --features diagnostics`: 779 passed. - Both dispatches ran (no "no SM 6.6" skip). - enlight3d (17:07): in-game batch with #2643, #3031 and #2789, 349 s in the world, 0 device losses, PASS, without `-RayTracing`. **Review notes (1,578 added across `emit/lower.rs`, `emit/shader.rs`, `descriptor/host.rs`, `draw.rs`, `pipeline/host.rs`):** - Structure descriptors picked by a dynamic index now go through a view-address table, `SLOT_TLAS_*`, kept in step with the heap. This replaces assuming a fixed slot, so the change is at the root rather than a special case. - Kal0s's probe of `write_address(SLOT_STRIDES_COUNT, ..)` shows the index guard skips out-of-range writes instead of corrupting the table. - **Docs gap.** This closes the gap listed at `d3d12/docs/fork-ray-tracing.md:186-189` ("Five shadow-mask trace programs do not translate ... the host would have to give a table of addresses by slot"), but leaves that line as it is. Only `d3d12/docs/switches.md` is updated. Please update or remove that bullet so the docs match. - **What the gate covered.** The same doc says "The title did not create them in any run so far". The batch also ran without `-RayTracing`, and #3031 in that batch is under an author "do not merge" for ray-tracing hangs. So the in-game PASS most likely never ran the new lowering. Its evidence is the unit and debug-layer dispatches above. A run with `-RayTracing` on this head alone, with the translate count for those five programs, would be the meaningful check. enlight3d has a `-RayTracing` run queued. Verdict: **ready** on code and unit evidence, with one docs fix (`fork-ray-tracing.md:186-189`). I would wait for the queued `-RayTracing` run before merging. AI-assisted verification: Claude Opus (Claude Code), separate agent per batch. --- _Generated by [Claude Code](https://claude.ai/code)_
fiestorra commented 2026-12-03 05:59:19 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by fiestorra on 2026-12-03T05:59:19Z.


VERIFY-2661 — 428 tests del shader en verde, y el cambio es el más grande de emit/lower.rs

d3d12/crates/leonida-shader/src/emit/lower.rs   +494
d3d12/crates/leonida-shader/src/emit/shader.rs  +13
d3d12/crates/leonida-shader/src/emit/mod.rs     +4
d3d12/docs/switches.md                          +2/−1
9 files changed, 1 578 insertions(+), 36 deletions(-)

cargo test -p leonida-shader --lib
  428 passed; 0 failed; 6 ignored   (448 s)

El título: «view-address table for dynamically picked structure…» — una tabla de direcciones para estructuras elegidas dinámicamente, y lower.rs +494 es donde vive.

Y es el tercero de la familia que ya he visto tres veces esta noche: #2800 (cadenas canónicas), #2686 (latches para dxil-spirv), #2698 (mad_legacy) — y ahora #2661: el emisor tiene que producir una forma que el consumidor sepa leer, y la tabla de direcciones es el contrato.

Lo que verifiqué: 428 tests del crate con el cambio.
Lo que no: que un shader que elige una estructura en tiempo de ejecución se traduzca al DXIL correcto — el test comprueba la emisión, no el consumo por dxil-spirv.

Y una observación sobre estas cuatro: son de tres autores, tocan el mismo emit/ y ninguna se ha fusionado. Si las cuatro entran por separado, lower.rs y bitcode.rs van a chocar cuatro veces — la misma aritmética que tests/test_win_launchers.py, en el otro fichero más disputado del repositorio.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7369329637 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2661#issuecomment-7369329637). Originally posted by [fiestorra](https://github.com/fiestorra) on 2026-12-03T05:59:19Z. --- ## VERIFY-2661 — 428 tests del shader en verde, y el cambio es el más grande de `emit/lower.rs` ``` d3d12/crates/leonida-shader/src/emit/lower.rs +494 d3d12/crates/leonida-shader/src/emit/shader.rs +13 d3d12/crates/leonida-shader/src/emit/mod.rs +4 d3d12/docs/switches.md +2/−1 9 files changed, 1 578 insertions(+), 36 deletions(-) cargo test -p leonida-shader --lib 428 passed; 0 failed; 6 ignored (448 s) ``` **El título**: **«view-address table for dynamically picked structure…»** — **una tabla de direcciones para estructuras elegidas dinámicamente**, **y `lower.rs` +494 es donde vive.** **Y es el tercero de la familia que ya he visto tres veces esta noche**: **`#2800` (cadenas canónicas), `#2686` (latches para `dxil-spirv`), `#2698` (`mad_legacy`)** — **y ahora `#2661`: el emisor tiene que producir una forma que el consumidor sepa leer, y la tabla de direcciones es el contrato.** **Lo que verifiqué**: **428 tests del crate con el cambio.** **Lo que no**: **que un shader que elige una estructura en tiempo de ejecución se traduzca al DXIL correcto** — **el test comprueba la emisión, no el consumo por `dxil-spirv`.** **Y una observación sobre estas cuatro**: **son de tres autores, tocan el mismo `emit/` y ninguna se ha fusionado.** **Si las cuatro entran por separado, `lower.rs` y `bitcode.rs` van a chocar cuatro veces** — **la misma aritmética que `tests/test_win_launchers.py`, en el otro fichero más disputado del repositorio.**
MoonEyes commented 2026-12-03 18:03:54 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by MoonEyes on 2026-12-03T18:03:54Z.


In-game gate run on an RTX 4060 8 GB (driver 610.88, Windows 11), in a batch of #2822, #2800, #2664 and #2661 merged into main 09273248c; this PR tested at its current head 1b3f3dee0. Series S 1080, DLSS FG 2x, play-nvidia.ps1 -SeriesS -Resolution 1080 -FrameGen 2 -PrecompileUsed, scripted walk, 330 s, screen kept on.

  • Result: PASS. No device lost, no crash, no unhandled exception; the run ended on its time limit.
  • Median over the last 240 s: 16.8 fps (main alone today: 15.8-17.5); 19.1 frames per 1000 over 100 ms; 6 pauses over 1 s (usual: 1-4).
  • Precompilation took 896 s, against ~160 s for the batches before it on the same cache. Something in this batch changes the translated shaders' cache keys (likely #2822 or #2800, which change the shader optimizer), so every player would rebuild the whole cache once. Not yet isolated per PR.
  • Covered: a normal launch and walk with this PR's code in the build. It does not isolate this PR's own change from the three others in the batch.

AI-assisted (Claude Opus 5.5), run and read by MoonEyes' agent.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7387540974 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2661#issuecomment-7387540974). Originally posted by [MoonEyes](https://github.com/MoonEyes) on 2026-12-03T18:03:54Z. --- In-game gate run on an RTX 4060 8 GB (driver 610.88, Windows 11), in a batch of #2822, #2800, #2664 and #2661 merged into main `09273248c`; this PR tested at its current head `1b3f3dee0`. Series S 1080, DLSS FG 2x, `play-nvidia.ps1 -SeriesS -Resolution 1080 -FrameGen 2 -PrecompileUsed`, scripted walk, 330 s, screen kept on. - Result: **PASS**. No device lost, no crash, no unhandled exception; the run ended on its time limit. - Median over the last 240 s: 16.8 fps (main alone today: 15.8-17.5); 19.1 frames per 1000 over 100 ms; 6 pauses over 1 s (usual: 1-4). - Precompilation took **896 s, against ~160 s** for the batches before it on the same cache. Something in this batch changes the translated shaders' cache keys (likely #2822 or #2800, which change the shader optimizer), so every player would rebuild the whole cache once. Not yet isolated per PR. - Covered: a normal launch and walk with this PR's code in the build. It does not isolate this PR's own change from the three others in the batch. AI-assisted (Claude Opus 5.5), run and read by MoonEyes' agent.
This pull request cannot be merged automatically due to conflicts.
Merge manually to resolve the conflicts.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin 'upstream-pr/2661:upstream-pr/2661'
git switch 'upstream-pr/2661'

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch 'main'
git merge --no-ff 'upstream-pr/2661'
git switch 'upstream-pr/2661'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/2661'
git switch 'upstream-pr/2661'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/2661'
git switch 'main'
git merge --squash 'upstream-pr/2661'
git switch 'main'
git merge --ff-only 'upstream-pr/2661'
git switch 'main'
git merge 'upstream-pr/2661'
git push origin 'main'
Sign in to join this conversation.
No reviewers
No labels
No milestone
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.

Reference
ProjectLeonida/mandy!2661
No description provided.