xdxr: a paired BLAS keeps one 64-byte leaf a pair (RT-XDXR-PAIR-DENSE) #690

Closed
kawaii-shakal wants to merge 21 commits from upstream-pr/690 into main
kawaii-shakal commented 2026-11-24 12:08:40 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by kawaii-shakal on 2026-11-24T12:08:40Z.


Claimed in the coordination issue as: RT-XDXR-PAIR-DENSE (claim)

Depends on: #626 (the same shader; this branch is on top of it, so the first commit here is #626's: the change is d0021a43e)

What and why

TRI1 pairing in the XDXR GPU builder left the sibling's leaf unused in the element region, so a paired BLAS was exactly as large as an unpaired one. README calls this "TRI1 pairing (no memory saved yet)"; docs/bvh.md §7a lists it under "Not done yet". Now a paired build keeps one 64-byte leaf record a pair, as the console's runtime BLASes do (§4a: one Leaf per entry, an entry holding the second primitive). The nodes follow directly. The build, COMPACTED_SIZE and a COMPACT copy are 64 bytes a pair smaller.

How (runtime/src/xdxr_build.comp, .h):

  • With FLAG_PAIR, MODE_TRIANGLES writes the leaves to scratch.
  • MODE_PAIR, split out of MODE_NODES, chooses the pairs once the tree is known (same rule as before). It records each pair and its rotation and marks the sibling's leaf as dropped; it writes no leaf (see the fix below).
  • A tile scan over the leaves that stay (MODE_LEAF_COUNT / SCAN / INDEX, sharing tile_index with the kept-node scan) gives each its place. MODE_LEAF_PLACE copies them densely into the element region, building a pair's leaf from the two staged ones.
  • MODE_NODES and everything after use nodes_off() = elements_off + 64 * kept, also written to the header's offsetToNodes. Pointers and parent table entries are written for the final places, so nothing moves afterwards.
  • numElements stays the triangle count, as tools/xdxr_bvh.py build_blas writes it.
  • The result room is unchanged: a leaf per triangle, since the pairs are not known at prebuild time.
  • The scratch grows by 80 bytes a triangle, only for a bottom-level build without ALLOW_UPDATE. This is XdxrLayout::compute(..., pairing), and record_blas pairs only with such a layout. GetRaytracingAccelerationStructurePrebuildInfo now maps ALLOW_UPDATE and asks for the same layout as the build.
  • The pairing arrays sit between the boxes and the accumulators, because every offset after the accumulators depends on pc.arg0, which is the vertex stride in MODE_TRIANGLES.

Checks:

  • check-build reports any 64-byte unit of a BLAS's element region that no triangle pointer names (unreferenced_leaves). A unit test shows it catches the old layout.

  • vk_xdxr_build_test:

    • builds the paired grid's mesh unpaired too (blas_grid_unpaired) and requires the sizes to differ by exactly 64 bytes per TRI1 child;
    • reads the paired build's COMPACTED_SIZE;
    • COMPACT-copies it (blas_paired_compacted, traced by check-build).
  • d3d12_xdxr_rt_test:

    • gives the paired BLAS its own prebuild scratch, which must be larger than the ALLOW_UPDATE one;
    • checks that the element region holds (triangles − pairs) records.

    It used to reuse the ALLOW_UPDATE build's scratch, which is now too small for a paired build.

Fix after review (1b859ca6d)

On an Apple M5 Pro (MoltenVK 1.4.2) the paired cases failed, and the counts changed between runs (thanks @GeorgiyDemo). MODE_PAIR rewrote the first triangle's staged leaf from vertices it had loaded from that same leaf in the same dispatch. The SPIRV-Cross in MoltenVK 1.4.2 can move such a load after the store, which is the rule at the top of xdxr_build.comp. Now MODE_PAIR only records the pair (FIRST | sibling and k | kd << 2 for the first triangle), and MODE_LEAF_PLACE builds the leaf word by word from the two unchanged staged leaves. Sizes are unchanged; the scratch takes 4 more bytes a triangle. On the RTX 5070 Ti, ctest -R "xdxr|khr_as_copy" passes 7/7 in three runs without and three with LEONIDA_VK_VALIDATION=1. Not re-run on Apple here.

Tested

Windows 11 Pro 26300, MSVC 19.50.35721.0, Vulkan SDK 1.4.363.0, shader regenerated with glslc --target-env=vulkan1.2 -O -mfmt=c (shaderc v2026.4), spirv-val clean.

  • ctest -R "xdxr|khr_as_copy": 7/7 passed, both without and with LEONIDA_VK_VALIDATION=1 (synchronization validation). Every xdxr_build_check and d3d12_xdxr_rt_check scene: 0 validation errors, 0 rays differing from brute force.

    case before now
    blas_paired_grid (288 triangles, 80 pairs) 39,168 bytes 34,048
    blas_paired_sort_tiles (7,200 triangles, 2,208 pairs) 988,160 846,848 (−14%)
    d3d12_blas_paired (428 triangles, 61 pairs) 58,368 54,464
    blas_paired_grid_box16 (162 triangles, 81 pairs) 17,344 12,160
  • Whole ctest -C RelWithDebInfo: 293 run, 292 passed. The one failure is d3d12_execute_indirect_validation, which fails on main too (#337 / #306).

  • python -I tests/test_xdxr_bvh.py (49 tests), python -I tools/xdxr_bvh.py selftest --seed 1 --rays 200, every tests/test_docs_*.py: OK.

  • python -I scripts/check_no_game_data.py on every changed file: clean.

Not measured: build time. A paired build adds five dispatches, and builds that do not pair are unchanged.

GPUs tested: NVIDIA GeForce RTX 5070 Ti (Blackwell, PCI 10de:2c05), driver 617.42, Vulkan 1.4.351, Windows 11 Pro 26300

AI-assisted: yes

Checklist

  • Based on current main and merges cleanly (a conflicting pull request is labeled needs rebase). (on top of #626, which merges cleanly with main)
  • 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: no translator change)

🤖 Generated with Claude Code

<!-- greyfinch-sync:ubiquitarianism/leonida:issue:5471845411 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/690). Originally posted by [kawaii-shakal](https://github.com/kawaii-shakal) on 2026-11-24T12:08:40Z. --- Claimed in the coordination issue as: RT-XDXR-PAIR-DENSE ([claim](https://github.com/ubiquitarianism/leonida/issues/14#issuecomment-7130477975)) Depends on: #626 (the same shader; this branch is on top of it, so the first commit here is #626's: the change is d0021a43e) ### What and why TRI1 pairing in the XDXR GPU builder left the sibling's leaf unused in the element region, so a paired BLAS was exactly as large as an unpaired one. README calls this "TRI1 pairing (no memory saved yet)"; `docs/bvh.md` §7a lists it under "Not done yet". Now a paired build keeps one 64-byte leaf record a pair, as the console's runtime BLASes do (§4a: one `Leaf` per entry, an entry holding the second primitive). The nodes follow directly. The build, `COMPACTED_SIZE` and a `COMPACT` copy are 64 bytes a pair smaller. How (`runtime/src/xdxr_build.comp`, `.h`): - With `FLAG_PAIR`, `MODE_TRIANGLES` writes the leaves to scratch. - `MODE_PAIR`, split out of `MODE_NODES`, chooses the pairs once the tree is known (same rule as before). It records each pair and its rotation and marks the sibling's leaf as dropped; it writes no leaf (see the fix below). - A tile scan over the leaves that stay (`MODE_LEAF_COUNT` / `SCAN` / `INDEX`, sharing `tile_index` with the kept-node scan) gives each its place. `MODE_LEAF_PLACE` copies them densely into the element region, building a pair's leaf from the two staged ones. - `MODE_NODES` and everything after use `nodes_off()` = `elements_off + 64 * kept`, also written to the header's `offsetToNodes`. Pointers and parent table entries are written for the final places, so nothing moves afterwards. - `numElements` stays the triangle count, as `tools/xdxr_bvh.py build_blas` writes it. - The result room is unchanged: a leaf per triangle, since the pairs are not known at prebuild time. - The scratch grows by 80 bytes a triangle, only for a bottom-level build without `ALLOW_UPDATE`. This is `XdxrLayout::compute(..., pairing)`, and `record_blas` pairs only with such a layout. `GetRaytracingAccelerationStructurePrebuildInfo` now maps `ALLOW_UPDATE` and asks for the same layout as the build. - The pairing arrays sit between the boxes and the accumulators, because every offset after the accumulators depends on `pc.arg0`, which is the vertex stride in `MODE_TRIANGLES`. Checks: - `check-build` reports any 64-byte unit of a BLAS's element region that no triangle pointer names (`unreferenced_leaves`). A unit test shows it catches the old layout. - `vk_xdxr_build_test`: - builds the paired grid's mesh unpaired too (`blas_grid_unpaired`) and requires the sizes to differ by exactly 64 bytes per TRI1 child; - reads the paired build's `COMPACTED_SIZE`; - `COMPACT`-copies it (`blas_paired_compacted`, traced by `check-build`). - `d3d12_xdxr_rt_test`: - gives the paired BLAS its own prebuild scratch, which must be larger than the `ALLOW_UPDATE` one; - checks that the element region holds (triangles − pairs) records. It used to reuse the `ALLOW_UPDATE` build's scratch, which is now too small for a paired build. ### Fix after review (1b859ca6d) On an Apple M5 Pro (MoltenVK 1.4.2) the paired cases failed, and the counts changed between runs (thanks @GeorgiyDemo). `MODE_PAIR` rewrote the first triangle's staged leaf from vertices it had loaded from that same leaf in the same dispatch. The SPIRV-Cross in MoltenVK 1.4.2 can move such a load after the store, which is the rule at the top of `xdxr_build.comp`. Now `MODE_PAIR` only records the pair (`FIRST | sibling` and `k | kd << 2` for the first triangle), and `MODE_LEAF_PLACE` builds the leaf word by word from the two unchanged staged leaves. Sizes are unchanged; the scratch takes 4 more bytes a triangle. On the RTX 5070 Ti, `ctest -R "xdxr|khr_as_copy"` passes 7/7 in three runs without and three with `LEONIDA_VK_VALIDATION=1`. Not re-run on Apple here. ### Tested Windows 11 Pro 26300, MSVC 19.50.35721.0, Vulkan SDK 1.4.363.0, shader regenerated with `glslc --target-env=vulkan1.2 -O -mfmt=c` (shaderc v2026.4), `spirv-val` clean. - `ctest -R "xdxr|khr_as_copy"`: 7/7 passed, both without and with `LEONIDA_VK_VALIDATION=1` (synchronization validation). Every `xdxr_build_check` and `d3d12_xdxr_rt_check` scene: 0 validation errors, 0 rays differing from brute force. | case | before | now | |---|---|---| | `blas_paired_grid` (288 triangles, 80 pairs) | 39,168 bytes | 34,048 | | `blas_paired_sort_tiles` (7,200 triangles, 2,208 pairs) | 988,160 | 846,848 (−14%) | | `d3d12_blas_paired` (428 triangles, 61 pairs) | 58,368 | 54,464 | | `blas_paired_grid_box16` (162 triangles, 81 pairs) | 17,344 | 12,160 | - Whole `ctest -C RelWithDebInfo`: 293 run, 292 passed. The one failure is `d3d12_execute_indirect_validation`, which fails on `main` too (#337 / #306). - `python -I tests/test_xdxr_bvh.py` (49 tests), `python -I tools/xdxr_bvh.py selftest --seed 1 --rays 200`, every `tests/test_docs_*.py`: OK. - `python -I scripts/check_no_game_data.py` on every changed file: clean. Not measured: build time. A paired build adds five dispatches, and builds that do not pair are unchanged. GPUs tested: NVIDIA GeForce RTX 5070 Ti (Blackwell, PCI 10de:2c05), driver 617.42, Vulkan 1.4.351, Windows 11 Pro 26300 AI-assisted: yes ### Checklist - [ ] Based on current `main` and merges cleanly (a conflicting pull request is labeled `needs rebase`). (on top of #626, which merges cleanly with `main`) - [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. - [ ] A new translator rule is in the contract table of `docs/design.md`, with how it was confirmed. (n/a: no translator change) 🤖 Generated with [Claude Code](https://claude.com/claude-code)
abnalstlll-byte commented 2026-11-24 12:21:38 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by abnalstlll-byte on 2026-11-24T12:21:38Z.

Review: APPROVED


Reviewed and verified RT-XDXR-PAIR-DENSE. Reclaiming unused 64-byte leaf units during TRI1 pairing in the GPU BVH builder produces densely packed element regions with zero unreferenced leaf gaps, reducing BLAS memory footprints. Cleanly validated by unreferenced_leaves in ools/xdxr_bvh.py and ests/test_xdxr_bvh.py. Approved.

<!-- greyfinch-sync:ubiquitarianism/leonida:review:6039099298 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/690#pullrequestreview-6039099298). Originally posted by [abnalstlll-byte](https://github.com/abnalstlll-byte) on 2026-11-24T12:21:38Z. **Review:** APPROVED --- Reviewed and verified RT-XDXR-PAIR-DENSE. Reclaiming unused 64-byte leaf units during TRI1 pairing in the GPU BVH builder produces densely packed element regions with zero unreferenced leaf gaps, reducing BLAS memory footprints. Cleanly validated by unreferenced_leaves in ools/xdxr_bvh.py and ests/test_xdxr_bvh.py. Approved.
GeorgiyDemo commented 2026-11-24 12:34:01 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by GeorgiyDemo on 2026-11-24T12:34:01Z.


Tested d0021a43e on Apple M5 Pro (16-core GPU), macOS 26.7.3 (25G342), MoltenVK 1.4.2 (subgroup 4..32). ctest -R xdxr on a build of this head: xdxr_build_check fails; on main d42773d07 the same two tests pass (4/4 with xdxr_build/xdxr_build_output/xdxr_descs), and on the parent commit 387cdbf94 (#626 alone, built separately here) xdxr_build_check passes with blas_paired_grid 80 TRI1 / 0 validation errors / 0 of 1000 rays differing and blas_paired_rotations 128 TRI1 / 0 / 0. So the failure is in this pairing change, not in its base.

Three runs of xdxr_build_check at this head, same binary:

case run 1 run 2 run 3
blas_paired_compacted 7 errors, 5/1000 rays differ 7, 5/1000 9, 14/1000
blas_paired_grid 7, 2/1000 7, 2/1000 9, 8/1000
blas_paired_grid_box16 7, 47/1000 7, 47/1000 4, 17/1000
blas_paired_rotations 7, 22/1000 8, 19/1000 10, 39/1000
blas_paired_sort_tiles 3, 0/200 3, 0/200 3, 0/200

The messages are child box N of 0x… is not inside its parent's box and built with pairing, but no TRI1 node is reachable, followed by N of 1000 rays differ from brute force (the test reported 36 problems in total). blas_paired_mixed (60 TRI1) and blas_paired_transform (20 TRI1) pass; blas_paired_sort_tiles loses its TRI1 nodes entirely.

The counts vary between identical runs on the same binary, which looks like a race in the pairing step rather than a fixed layout error, and it may be specific to this driver — I have no Windows or AMD GPU here to compare. Worth checking the ordering of the sibling/TRI1 publication in xdxr_build.comp.

Everything else on this head passed: xdxr_build, xdxr_build_output, xdxr_descs. Synthetic fixtures only, no game data. AI-assisted.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7131618380 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/690#issuecomment-7131618380). Originally posted by [GeorgiyDemo](https://github.com/GeorgiyDemo) on 2026-11-24T12:34:01Z. --- Tested `d0021a43e` on Apple M5 Pro (16-core GPU), macOS 26.7.3 (25G342), MoltenVK 1.4.2 (subgroup 4..32). `ctest -R xdxr` on a build of this head: **`xdxr_build_check` fails**; on `main` `d42773d07` the same two tests pass (4/4 with `xdxr_build`/`xdxr_build_output`/`xdxr_descs`), and on the parent commit `387cdbf94` (#626 alone, built separately here) `xdxr_build_check` passes with `blas_paired_grid` 80 TRI1 / 0 validation errors / 0 of 1000 rays differing and `blas_paired_rotations` 128 TRI1 / 0 / 0. So the failure is in this pairing change, not in its base. Three runs of `xdxr_build_check` at this head, same binary: | case | run 1 | run 2 | run 3 | |---|---|---|---| | `blas_paired_compacted` | 7 errors, 5/1000 rays differ | 7, 5/1000 | 9, 14/1000 | | `blas_paired_grid` | 7, 2/1000 | 7, 2/1000 | 9, 8/1000 | | `blas_paired_grid_box16` | 7, 47/1000 | 7, 47/1000 | 4, 17/1000 | | `blas_paired_rotations` | 7, 22/1000 | 8, 19/1000 | 10, 39/1000 | | `blas_paired_sort_tiles` | 3, 0/200 | 3, 0/200 | 3, 0/200 | The messages are `child box N of 0x… is not inside its parent's box` and `built with pairing, but no TRI1 node is reachable`, followed by `N of 1000 rays differ from brute force` (the test reported 36 problems in total). `blas_paired_mixed` (60 TRI1) and `blas_paired_transform` (20 TRI1) pass; `blas_paired_sort_tiles` loses its TRI1 nodes entirely. The counts vary between identical runs on the same binary, which looks like a race in the pairing step rather than a fixed layout error, and it may be specific to this driver — I have no Windows or AMD GPU here to compare. Worth checking the ordering of the sibling/TRI1 publication in `xdxr_build.comp`. Everything else on this head passed: `xdxr_build`, `xdxr_build_output`, `xdxr_descs`. Synthetic fixtures only, no game data. AI-assisted.
kawaii-shakal commented 2026-11-24 14:40:39 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by kawaii-shakal on 2026-11-24T14:40:39Z.


Thanks, that was a real bug, and your guess was right: it was the ordering in the pairing step. MODE_PAIR rewrote the first triangle's staged leaf (rotated vertices, slot 3) from values it had loaded from that same leaf earlier in the same dispatch. That is exactly what the note at the top of xdxr_build.comp forbids for MoltenVK 1.4.2's SPIRV-Cross, which can move such a load after the store. So the rotation read partly rewritten vertices, depending on scheduling.

Fixed in 1b859ca6d. MODE_PAIR now only records the pair: the sibling's partner, as before, and for the first triangle FIRST | sibling plus the rotation k | kd << 2. MODE_LEAF_PLACE then builds the pair's leaf word by word from the two staged leaves, which nothing writes after MODE_TRIANGLES, so no invocation stores to a word it loaded. Sizes are unchanged (34,048 / 846,848 / 12,160 bytes as before), and the scratch takes 4 more bytes a triangle.

On RTX 5070 Ti (driver 617.42): ctest -R "xdxr|khr_as_copy" 7/7 in three runs without and three with LEONIDA_VK_VALIDATION=1, 0 rays differing in every scene. I can't run it on Apple here; if you have a moment to re-run xdxr_build_check at 1b859ca6d, that would confirm it.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7134766732 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/690#issuecomment-7134766732). Originally posted by [kawaii-shakal](https://github.com/kawaii-shakal) on 2026-11-24T14:40:39Z. --- Thanks, that was a real bug, and your guess was right: it was the ordering in the pairing step. `MODE_PAIR` rewrote the first triangle's staged leaf (rotated vertices, slot 3) from values it had loaded from that same leaf earlier in the same dispatch. That is exactly what the note at the top of `xdxr_build.comp` forbids for MoltenVK 1.4.2's SPIRV-Cross, which can move such a load after the store. So the rotation read partly rewritten vertices, depending on scheduling. Fixed in 1b859ca6d. `MODE_PAIR` now only records the pair: the sibling's partner, as before, and for the first triangle `FIRST | sibling` plus the rotation `k | kd << 2`. `MODE_LEAF_PLACE` then builds the pair's leaf word by word from the two staged leaves, which nothing writes after `MODE_TRIANGLES`, so no invocation stores to a word it loaded. Sizes are unchanged (34,048 / 846,848 / 12,160 bytes as before), and the scratch takes 4 more bytes a triangle. On RTX 5070 Ti (driver 617.42): `ctest -R "xdxr|khr_as_copy"` 7/7 in three runs without and three with `LEONIDA_VK_VALIDATION=1`, 0 rays differing in every scene. I can't run it on Apple here; if you have a moment to re-run `xdxr_build_check` at 1b859ca6d, that would confirm it.
LewisCodesWebsites commented 2026-11-24 16:49:30 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by LewisCodesWebsites on 2026-11-24T16:49:30Z.


Tested 1b859ca6d (with #626 underneath, on main 21625bc) on AMD Radeon 660M (RDNA2 iGPU, ray query supported), Adrenalin 32.0.21045.1000, Windows 11 26200: ctest -R "xdxr|rt" passes 26/26 with this PR, including xdxr_build_check and d3d12_xdxr_rt_check, the same 26/26 as on main without it. No regressions on AMD. AI-assisted.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7138263188 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/690#issuecomment-7138263188). Originally posted by [LewisCodesWebsites](https://github.com/LewisCodesWebsites) on 2026-11-24T16:49:30Z. --- Tested 1b859ca6d (with #626 underneath, on main 21625bc) on AMD Radeon 660M (RDNA2 iGPU, ray query supported), Adrenalin 32.0.21045.1000, Windows 11 26200: `ctest -R "xdxr|rt"` passes 26/26 with this PR, including `xdxr_build_check` and `d3d12_xdxr_rt_check`, the same 26/26 as on main without it. No regressions on AMD. AI-assisted.
kawaii-shakal commented 2026-11-24 23:53:58 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by kawaii-shakal on 2026-11-24T23:53:58Z.


Rebased onto #626's new head f51ef5c85 (on main 364ab4eab) as 1700de85b. The only conflict was in tests/test_xdxr_bvh.py: main added test_nan_child_box_at_root_is_rejected next to this PR's dense-leaf tests, and both are kept. The file passes 56 of 56. xdxr_build.inc matches glslc output. On an RTX 5070 Ti (driver 617.42, Windows 11 26300), all 8 ctest -R xdxr tests pass, including xdxr_build_check, d3d12_xdxr_rt_check and vk_xdxr_postbuild_readback.

AI-assisted.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7147917269 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/690#issuecomment-7147917269). Originally posted by [kawaii-shakal](https://github.com/kawaii-shakal) on 2026-11-24T23:53:58Z. --- Rebased onto #626's new head `f51ef5c85` (on main `364ab4eab`) as `1700de85b`. The only conflict was in `tests/test_xdxr_bvh.py`: main added `test_nan_child_box_at_root_is_rejected` next to this PR's dense-leaf tests, and both are kept. The file passes 56 of 56. `xdxr_build.inc` matches `glslc` output. On an RTX 5070 Ti (driver 617.42, Windows 11 26300), all 8 `ctest -R xdxr` tests pass, including `xdxr_build_check`, `d3d12_xdxr_rt_check` and `vk_xdxr_postbuild_readback`. AI-assisted.
kawaii-shakal commented 2026-11-25 02:31:57 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by kawaii-shakal on 2026-11-25T02:31:57Z.


Rebased onto #626's new head dcac757ab (main 3ff2a2adc) as a98d67626. The only conflict was the README ray-tracing row; I kept this PR's version, which drops the 'no memory saved yet' note and keeps serialization. tests/test_xdxr_bvh.py passes 56 of 56 and xdxr_build.inc matches glslc. On an RTX 5070 Ti (617.42, Windows 11 26300), ctest -R 'xdxr|khr_as_copy' passes 9 of 9.

AI-assisted.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7150844421 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/690#issuecomment-7150844421). Originally posted by [kawaii-shakal](https://github.com/kawaii-shakal) on 2026-11-25T02:31:57Z. --- Rebased onto #626's new head `dcac757ab` (main `3ff2a2adc`) as `a98d67626`. The only conflict was the README ray-tracing row; I kept this PR's version, which drops the 'no memory saved yet' note and keeps serialization. `tests/test_xdxr_bvh.py` passes 56 of 56 and `xdxr_build.inc` matches `glslc`. On an RTX 5070 Ti (617.42, Windows 11 26300), `ctest -R 'xdxr|khr_as_copy'` passes 9 of 9. AI-assisted.
kawaii-shakal commented 2026-11-25 08:43:12 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by kawaii-shakal on 2026-11-25T08:43:12Z.


CI fix: runtime/test/replay_readback_stages_test.cpp (added on main in dfadf4ce5) assigned a three-argument lambda to xdxr_postbuild, which this branch gives a fourth (the postbuild type), so windows and linux-gpu-tools failed at Build. That case now takes the extra argument (489d2b285). replay_readback_stages_test and replay_khr_as_copy_postbuild_test build and pass on Windows 11 (MSVC 19.50).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7157384725 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/690#issuecomment-7157384725). Originally posted by [kawaii-shakal](https://github.com/kawaii-shakal) on 2026-11-25T08:43:12Z. --- CI fix: `runtime/test/replay_readback_stages_test.cpp` (added on main in dfadf4ce5) assigned a three-argument lambda to `xdxr_postbuild`, which this branch gives a fourth (the postbuild type), so `windows` and `linux-gpu-tools` failed at Build. That case now takes the extra argument (`489d2b285`). `replay_readback_stages_test` and `replay_khr_as_copy_postbuild_test` build and pass on Windows 11 (MSVC 19.50).
kawaii-shakal commented 2026-11-26 19:14:41 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by kawaii-shakal on 2026-11-26T19:14:41Z.


Merged current main in dbf2361e (Claude Code, AI-assisted). The conflict with #2222 needed more than a merge:

  • #2222's layout_node() bounds parent pointers by pc.nodes_off, but a paired build places its nodes at
    nodes_off(), right after the kept leaves. Every parent was rejected and no box was propagated, so all
    blas_paired_* cases of xdxr_build_check missed every ray. It now uses nodes_off(). Updates never pair, so
    refit_source_ok keeps pc.nodes_off.
  • #2222's SCRATCH_REFIT was byte 28, which here is SCRATCH_LEAF_COUNT. It moves to byte 32, and MODE_CHECK
    moves from 19 to 26, since 19-25 are taken here.

Full ctest, 113 of 113, on Mesa lavapipe, xdxr_build_check included. Worth a re-run on a hardware GPU.


Generated by Claude Code

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7201357958 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/690#issuecomment-7201357958). Originally posted by [kawaii-shakal](https://github.com/kawaii-shakal) on 2026-11-26T19:14:41Z. --- Merged current main in dbf2361e (Claude Code, AI-assisted). The conflict with #2222 needed more than a merge: - #2222's `layout_node()` bounds parent pointers by `pc.nodes_off`, but a paired build places its nodes at `nodes_off()`, right after the kept leaves. Every parent was rejected and no box was propagated, so all `blas_paired_*` cases of `xdxr_build_check` missed every ray. It now uses `nodes_off()`. Updates never pair, so `refit_source_ok` keeps `pc.nodes_off`. - #2222's `SCRATCH_REFIT` was byte 28, which here is `SCRATCH_LEAF_COUNT`. It moves to byte 32, and `MODE_CHECK` moves from 19 to 26, since 19-25 are taken here. Full ctest, 113 of 113, on Mesa lavapipe, `xdxr_build_check` included. Worth a re-run on a hardware GPU. --- _Generated by [Claude Code](https://claude.ai/code)_
MoonEyes commented 2026-11-28 17:57:34 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by MoonEyes on 2026-11-28T17:57:34Z.


Hi @kawaii-shakal, thanks for this pull request. It currently conflicts with main (conflicting file(s): runtime/src/xdxr_build.h), so it carries the needs rebase label. CONTRIBUTING.md asks authors to rebase their branch on main; once it merges cleanly the label goes within the hour, and reviews start with the pull requests that do. Could you update the branch when you have a moment? If you no longer plan to continue with it, please say so here.

AI-assisted (Claude Code, Claude Opus 5.5).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7243419113 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/690#issuecomment-7243419113). Originally posted by [MoonEyes](https://github.com/MoonEyes) on 2026-11-28T17:57:34Z. --- Hi @kawaii-shakal, thanks for this pull request. It currently conflicts with `main` (conflicting file(s): `runtime/src/xdxr_build.h`), so it carries the `needs rebase` label. CONTRIBUTING.md asks authors to rebase their branch on `main`; once it merges cleanly the label goes within the hour, and reviews start with the pull requests that do. Could you update the branch when you have a moment? If you no longer plan to continue with it, please say so here. AI-assisted (Claude Code, Claude Opus 5.5).
kawaii-shakal commented 2026-11-30 07:36:28 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by kawaii-shakal on 2026-11-30T07:36:28Z.


Updated: main is merged in (9d10175) and the runtime/src/xdxr_build.h conflict is resolved; the needs-rebase label is gone. I'm keeping the PR open, but I can't run the GPU tests myself for about a week. If someone with an RT-capable GPU can run the xdxr tests on the current head before then, that would help; otherwise I'll report back after that.


Generated by Claude Code

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7271921187 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/690#issuecomment-7271921187). Originally posted by [kawaii-shakal](https://github.com/kawaii-shakal) on 2026-11-30T07:36:28Z. --- Updated: main is merged in (9d10175) and the `runtime/src/xdxr_build.h` conflict is resolved; the needs-rebase label is gone. I'm keeping the PR open, but I can't run the GPU tests myself for about a week. If someone with an RT-capable GPU can run the xdxr tests on the current head before then, that would help; otherwise I'll report back after that. --- _Generated by [Claude Code](https://claude.ai/code)_
aslan2142 commented 2026-12-01 17:21:25 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by aslan2142 on 2026-12-01T17:21:25Z.


Closing this PR because the legacy C++ Vulkan runtime (and legacy Python shader compiler) is now considered deprecated in favor of the new Rust Vulkan runtime (in progress) and the Rust DX12 runtime (d3d12/) available now. Thank you for the contribution! If you believe this PR was closed by mistake (for example, if it still applies to active tools, d3d12/, or general docs), please feel free to reopen it.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7319168579 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/690#issuecomment-7319168579). Originally posted by [aslan2142](https://github.com/aslan2142) on 2026-12-01T17:21:25Z. --- Closing this PR because the legacy C++ Vulkan runtime (and legacy Python shader compiler) is now considered deprecated in favor of the new Rust Vulkan runtime (in progress) and the Rust DX12 runtime (`d3d12/`) available now. Thank you for the contribution! If you believe this PR was closed by mistake (for example, if it still applies to active tools, `d3d12/`, or general docs), please feel free to reopen it.

Pull request closed

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!690
No description provided.