d3d12: hardware ray tracing on DXR 1.1 (LEONIDA_HW_RT, off: a trial) #2972

Manually merged
github merged 5 commits from github-bot/gh-2972 into main 2026-12-02 07:08:50 +00:00 AGit
Owner

@⁠Callimann8 on GitHub · 2026-12-01 22:10 UTC · original
Callimann8:d3d12-hardware-ray-tracing → main · +14135 −37 · 42 files · 5 commits · merged 2026-12-02 07:04 UTC

Claimed in the coordination issue as: claiming: D3D12 runtime: hardware ray tracing (DXR 1.1, LEONIDA_HW_RT)

What and why

Hardware ray tracing for the D3D12 runtime (d3d12/), off by default, a trial: LEONIDA_HW_RT=1
(-HardwareRT of the play scripts, a launcher checkbox, the F1 menu's HARDWARE RAY TRACING (TRIAL)), in place of
-RayTracing / LEONIDA_BVH_BUILDER=1.

With -RayTracing the title's own structure builder and its software traversal run as translated shaders, which is
slow (6 frames a second on the test PC below). With this, the title's rays run on the card's ray-tracing hardware
(DXR 1.1 inline ray queries).

It is a port of trustno1-coder/VIctory-NVIDIA's hardware ray tracing (its #3706; from
Leslie-d-a/VIctory-NVIDIA-HWRT 61e389e0 and 5f55bca8, original by dakisback2 ecc49d5b and 72f8316a; GPL-3.0, as this
repository), fitted to this tree, which had diverged from VIctory-NVIDIA since bafb0e25b:

  • leonida-shader: emit/rayquery.rs lifts the traversal loops of the trace programs to RayQuery, wired into
    this tree's lower.rs (the plan, the handles, TLAS root SRVs t230..t241, the analyses that leave the lifted
    loops out). Written for this tree: a program in the paired form is not lifted; with LEONIDA_HW_RT=1 the node
    test of a loop that is not lifted misses every node (emit/intersect.rs bvh_miss), since the console
    structures are never written then.
  • leonida-gpu: hwrt.rs builds host bottom and top levels from the title's XboxBvhBuilder calls. Written
    for this tree: list::external (work of ours at its place in a title list, with a LEONIDA_THIN op), the TLAS
    views in the descriptor heaps, Deferred::held, the ray queries in the shader cache's entries, the counters in
    the frame log. dxr.rs comes with it for the records hwrt.rs uses; its LEONIDA_BVH_SIZE_ANSWER wrappers are
    not bound here.
  • leonida-hle: modules/xboxbvh.rs replaces the exports of the title's XboxBvhBuilder.dll when the switch
    is on (export names only; no title bytes).
  • With the switch on, the light stand-in stands aside and the passes left out without structures run, as with the
    builder; the play script leaves DLSS frame generation off, as with -RayTracing.
  • One difference from VIctory-NVIDIA: it copies every shader write back to title memory under hardware ray tracing.
    Here that stretched and flickered textures and cost 30 to 45 ms a frame, so it is opt-in
    (LEONIDA_HW_RT_COPY_BACK=1) and LEONIDA_WC_NO_BACK stays as the play script sets it.
  • Docs: d3d12/docs/fork-ray-tracing.md (new section), README.md (-HardwareRT), d3d12/docs/switches.md
    regenerated.

Nothing changes with the switch off, except that shader cache entries can carry a ray-query record (none for a
program without one, so existing entries read as before).

Tested

  • cargo build --workspace --all-targets --locked, cargo build -p leonida --features diagnostics,mimalloc --locked,
    cargo test --workspace --exclude xtask --locked -- --skip depth_bounds_pipeline_loads_and_filters_draws,
    cargo test -p leonida-gpu --features diagnostics --test replay --locked: TEST_RESULT
  • New tests: emit::rayquery_tests (the lifted form validates and makes a pipeline on WARP; the fallback misses
    with the switch on; LEONIDA_HW_RT_LIFT=0), shader_cache (a program's ray queries come back, one without them
    reads as before).
  • The ignored corpus test the_local_shader_cache_lifts_its_ray_queries over one local known-shaders.bin
    (counts only): 64 ray-tracing programs, 56 wholly lifted, 6 partly (bvh32: unrecognized live-out value), 2 that
    do not translate without this either, none lifted that does not validate; loops 76 of 76 (64-bit nodes) and 299
    of 315 (32-bit).
  • python -I tests/test_leonida_launcher.py, python -I tests/test_d3d12_switches.py,
    python -I scripts/check_no_game_data.py <changed files>: pass.
  • In the game, one PC, the requester playing (open world, Series X profile, no frame generation, the frame log's
    own lines): 22 to 25 frames a second with hardware ray tracing, 14 of 14 ray-tracing programs in use wholly
    lifted, about 4,900 bottom levels and 5 top levels alive; the same save with -RayTracing 6 frames a second
    (104 to 118 ms of the card a frame). The picture was judged by eye only ("texture problems are gone" after the
    copy-back change); it was not compared with the builder's picture frame by frame.
  • Known limit: that run ended after six minutes with the device removed and the card's memory full (10,989 MB
    in use of a budget of 10,793 MB, 1,095 MB of it bottom levels; the PC had 125 MB left to commit). The Series X
    profile fills this 12 GB card without the structures too. The bottom levels' budget is a tenth of the card's.
  • Not tested: AMD and Intel cards, the Series S profile, Linux, a long session, LEONIDA_HW_RT_COPY_BACK=1 after
    the change.

GPUs tested: NVIDIA GeForce RTX 4070 (12 GB), driver 621.40, Windows 11

AI-assisted: yes (ported and written by Claude at the requester's direction; the requester ran the game)

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: no rule
    of the Python translator changes; this is the D3D12 runtime's own translator.)
**@⁠Callimann8** on GitHub · 2026-12-01 22:10 UTC · [original](https://github.com/ProjectLeonida/mandy/pull/2972) `Callimann8:d3d12-hardware-ray-tracing` → `main` · +14135 −37 · 42 files · 5 commits · merged 2026-12-02 07:04 UTC Claimed in the coordination issue as: claiming: D3D12 runtime: hardware ray tracing (DXR 1.1, LEONIDA_HW_RT) ### What and why Hardware ray tracing for the D3D12 runtime (`d3d12/`), **off by default, a trial**: `LEONIDA_HW_RT=1` (`-HardwareRT` of the play scripts, a launcher checkbox, the F1 menu's HARDWARE RAY TRACING (TRIAL)), in place of `-RayTracing` / `LEONIDA_BVH_BUILDER=1`. With `-RayTracing` the title's own structure builder and its software traversal run as translated shaders, which is slow (6 frames a second on the test PC below). With this, the title's rays run on the card's ray-tracing hardware (DXR 1.1 inline ray queries). It is a port of trustno1-coder/VIctory-NVIDIA's hardware ray tracing (its #3706; from Leslie-d-a/VIctory-NVIDIA-HWRT 61e389e0 and 5f55bca8, original by dakisback2 ecc49d5b and 72f8316a; GPL-3.0, as this repository), fitted to this tree, which had diverged from VIctory-NVIDIA since `bafb0e25b`: - **`leonida-shader`**: `emit/rayquery.rs` lifts the traversal loops of the trace programs to `RayQuery`, wired into this tree's `lower.rs` (the plan, the handles, TLAS root SRVs `t230..t241`, the analyses that leave the lifted loops out). Written for this tree: a program in the paired form is not lifted; with `LEONIDA_HW_RT=1` the node test of a loop that is not lifted misses every node (`emit/intersect.rs` `bvh_miss`), since the console structures are never written then. - **`leonida-gpu`**: `hwrt.rs` builds host bottom and top levels from the title's `XboxBvhBuilder` calls. Written for this tree: `list::external` (work of ours at its place in a title list, with a `LEONIDA_THIN` op), the TLAS views in the descriptor heaps, `Deferred::held`, the ray queries in the shader cache's entries, the counters in the frame log. `dxr.rs` comes with it for the records `hwrt.rs` uses; its `LEONIDA_BVH_SIZE_ANSWER` wrappers are not bound here. - **`leonida-hle`**: `modules/xboxbvh.rs` replaces the exports of the title's `XboxBvhBuilder.dll` when the switch is on (export names only; no title bytes). - With the switch on, the light stand-in stands aside and the passes left out without structures run, as with the builder; the play script leaves DLSS frame generation off, as with `-RayTracing`. - One difference from VIctory-NVIDIA: it copies every shader write back to title memory under hardware ray tracing. Here that stretched and flickered textures and cost 30 to 45 ms a frame, so it is opt-in (`LEONIDA_HW_RT_COPY_BACK=1`) and `LEONIDA_WC_NO_BACK` stays as the play script sets it. - Docs: `d3d12/docs/fork-ray-tracing.md` (new section), `README.md` (`-HardwareRT`), `d3d12/docs/switches.md` regenerated. Nothing changes with the switch off, except that shader cache entries can carry a ray-query record (none for a program without one, so existing entries read as before). ### Tested - `cargo build --workspace --all-targets --locked`, `cargo build -p leonida --features diagnostics,mimalloc --locked`, `cargo test --workspace --exclude xtask --locked -- --skip depth_bounds_pipeline_loads_and_filters_draws`, `cargo test -p leonida-gpu --features diagnostics --test replay --locked`: TEST_RESULT - New tests: `emit::rayquery_tests` (the lifted form validates and makes a pipeline on WARP; the fallback misses with the switch on; `LEONIDA_HW_RT_LIFT=0`), `shader_cache` (a program's ray queries come back, one without them reads as before). - The ignored corpus test `the_local_shader_cache_lifts_its_ray_queries` over one local `known-shaders.bin` (counts only): 64 ray-tracing programs, 56 wholly lifted, 6 partly (`bvh32: unrecognized live-out value`), 2 that do not translate without this either, none lifted that does not validate; loops 76 of 76 (64-bit nodes) and 299 of 315 (32-bit). - `python -I tests/test_leonida_launcher.py`, `python -I tests/test_d3d12_switches.py`, `python -I scripts/check_no_game_data.py <changed files>`: pass. - In the game, one PC, the requester playing (open world, Series X profile, no frame generation, the frame log's own lines): 22 to 25 frames a second with hardware ray tracing, 14 of 14 ray-tracing programs in use wholly lifted, about 4,900 bottom levels and 5 top levels alive; the same save with `-RayTracing` 6 frames a second (104 to 118 ms of the card a frame). The picture was judged by eye only ("texture problems are gone" after the copy-back change); it was not compared with the builder's picture frame by frame. - **Known limit:** that run ended after six minutes with the device removed and the card's memory full (10,989 MB in use of a budget of 10,793 MB, 1,095 MB of it bottom levels; the PC had 125 MB left to commit). The Series X profile fills this 12 GB card without the structures too. The bottom levels' budget is a tenth of the card's. - Not tested: AMD and Intel cards, the Series S profile, Linux, a long session, `LEONIDA_HW_RT_COPY_BACK=1` after the change. GPUs tested: NVIDIA GeForce RTX 4070 (12 GB), driver 621.40, Windows 11 AI-assisted: yes (ported and written by Claude at the requester's direction; the requester ran the game) ### 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. - [ ] A new translator rule is in the contract table of `docs/design.md`, with how it was confirmed. (n/a: no rule of the Python translator changes; this is the D3D12 runtime's own translator.)
In place of -RayTracing (the title's structure builder and software traversal as translated
shaders): the title's XboxBvhBuilder calls become host DXR 1.1 bottom and top levels, and the
traversal loops of its trace programs become inline ray queries.

Ported from trustno1-coder/VIctory-NVIDIA (its #3706; from Leslie-d-a/VIctory-NVIDIA-HWRT 61e389e0
and 5f55bca8, original by dakisback2 ecc49d5b and 72f8316a), GPL-3.0, and fitted to this tree:

- leonida-shader: emit/rayquery.rs wired into lower.rs (the plan, the handles, TLAS root SRVs
  t230..t241, the analyses that leave the lifted loops out). A program in the paired form is not
  lifted. With LEONIDA_HW_RT=1 the node test of a loop left unlifted misses every node
  (emit/intersect.rs bvh_miss): the console structures are never written then.
- leonida-gpu: hwrt.rs (and dxr.rs for its records); list::external with a LEONIDA_THIN op for the
  structure work at its place in a title list; the TLAS views in the descriptor heaps;
  Deferred::held; the ray queries in the shader cache's entries; counters in the frame log.
- leonida-hle: modules/xboxbvh.rs replaces the exports of the title's XboxBvhBuilder.dll when on.
- With it on the light stand-in stands aside and the passes left out without structures run.
  Shader writes are not all copied back as VIctory-NVIDIA does (LEONIDA_HW_RT_COPY_BACK=1 asks for
  it): here that stretched and flickered textures and cost 30 to 45 ms a frame.
- F1: HARDWARE RAY TRACING (TRIAL); play scripts: -HardwareRT (frame generation left off with it,
  as with -RayTracing); launcher: a checkbox. Docs: fork-ray-tracing.md, README.md, switches.md.

One PC (RTX 4070 12 GB, driver 621.40, Series X profile, no frame generation): 22 to 25 frames a
second against 6 with -RayTracing; the run ended after six minutes with the card's memory full.

Co-authored-by: dakisback2 <[email protected]>
Co-authored-by: Leslie-d-a <[email protected]>
Co-Authored-By: Claude Fable 5.2 <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-12-01 22:16:35 +00:00
Author
Owner

@⁠andrew-ai on GitHub · 2026-12-01 22:14 UTC · original

Native Windows verification at 3fdfbaa46. The synthetic inline-RayQuery shader passed the Windows SDK 10.0.26100.0 DXIL validator and created a compute pipeline on both adapters with the acceleration structure bound as root SRV t230.

Adapter resolved from the D3D12 device LUID Options5 RaytracingTier (raw) Compute pipeline
Microsoft Basic Render Driver (WARP) 11 Created
NVIDIA GeForce RTX 5070, driver 616.92 12 Created

I temporarily made the stock WARP test require successful DXIL validation, then passed the same validated shader to WARP and hardware in sequence. Both reached compute_pipeline. The focused rayquery_tests selection finished with 6 passed and 1 ignored (the local title shader cache). This checks pipeline creation only. Ray dispatch, image output, and frame rate were outside the run. Codex-assisted for #2570.

**@⁠andrew-ai** on GitHub · 2026-12-01 22:14 UTC · [original](https://github.com/ProjectLeonida/mandy/pull/2972#issuecomment-7327478829) Native Windows verification at 3fdfbaa46. The synthetic inline-RayQuery shader passed the Windows SDK 10.0.26100.0 DXIL validator and created a compute pipeline on both adapters with the acceleration structure bound as root SRV t230. | Adapter resolved from the D3D12 device LUID | Options5 RaytracingTier (raw) | Compute pipeline | | --- | ---: | --- | | Microsoft Basic Render Driver (WARP) | 11 | Created | | NVIDIA GeForce RTX 5070, driver 616.92 | 12 | Created | I temporarily made the stock WARP test require successful DXIL validation, then passed the same validated shader to WARP and hardware in sequence. Both reached compute_pipeline. The focused rayquery_tests selection finished with 6 passed and 1 ignored (the local title shader cache). This checks pipeline creation only. Ray dispatch, image output, and frame rate were outside the run. Codex-assisted for #2570.
Author
Owner

@⁠andrew-ai on GitHub · 2026-12-01 22:17 UTC · original

Checked cross-run shader cache reuse at 3fdfbaa46. Six fresh Windows processes shared one initially empty disk cache, using the same executable, synthetic container bytes, production shader_cache::build() fingerprint and cached() lookup. A counting converter returned a different marker for each mode.

LEONIDA_HW_RT LEONIDA_HW_RT_LIFT First visit Return visit
unset unset Converted once Retrieved marker 1
1 unset Converted once Retrieved marker 2
1 0 Converted once Retrieved marker 3

The return visits ran in a different order and made zero converter calls. The cache kept the three settings apart and reused the correct entry after each restart. This exercises the cache key and persisted payload with a stand-in converter. Codex-assisted for #2570.

**@⁠andrew-ai** on GitHub · 2026-12-01 22:17 UTC · [original](https://github.com/ProjectLeonida/mandy/pull/2972#issuecomment-7327561636) Checked cross-run shader cache reuse at 3fdfbaa46. Six fresh Windows processes shared one initially empty disk cache, using the same executable, synthetic container bytes, production shader_cache::build() fingerprint and cached() lookup. A counting converter returned a different marker for each mode. | LEONIDA_HW_RT | LEONIDA_HW_RT_LIFT | First visit | Return visit | | --- | --- | --- | --- | | unset | unset | Converted once | Retrieved marker 1 | | 1 | unset | Converted once | Retrieved marker 2 | | 1 | 0 | Converted once | Retrieved marker 3 | The return visits ran in a different order and made zero converter calls. The cache kept the three settings apart and reused the correct entry after each restart. This exercises the cache key and persisted payload with a stand-in converter. Codex-assisted for #2570.
Author
Owner

@⁠merzleckeier on GitHub · 2026-12-01 22:21 UTC · original

The validated synthetic RayQuery shader also creates a pipeline on both Wine hardware adapters.

I tested 3fdfbaa46f8a9811d6521ce6017b4094765c15de integrated onto main c4ca5761508f136c5530482093bb3053b0bad4fa with Wine 11.22 and VKD3D-Proton 3.1.0. I used the stock synthetic ray_query_program(), required successful validation with Microsoft DXIL 1.8.2505.32, initialized the physical host explicitly and resolved its DXGI adapter by the device LUID.

Adapter D3D12 OPTIONS5 Compute pipeline
NVIDIA RTX 4070 SUPER (620.73.4, 10de:2783) DXR 1.2 Created
AMD Raphael (RADV 26.3.1, 1002:164e) DXR 1.1 Created

Both used the stock root signature path with SRV t230. The stock RayQuery selection also finished 6 passed and 1 ignored. Its WARP-labelled entry selected physical NVIDIA under Wine. This checks validation and pipeline creation. Ray dispatch and rendered output were outside the run. AI-assisted, independently verified against the raw results.

**@⁠merzleckeier** on GitHub · 2026-12-01 22:21 UTC · [original](https://github.com/ProjectLeonida/mandy/pull/2972#issuecomment-7327687756) The validated synthetic RayQuery shader also creates a pipeline on both Wine hardware adapters. I tested `3fdfbaa46f8a9811d6521ce6017b4094765c15de` integrated onto main `c4ca5761508f136c5530482093bb3053b0bad4fa` with Wine 11.22 and VKD3D-Proton 3.1.0. I used the stock synthetic `ray_query_program()`, required successful validation with Microsoft DXIL 1.8.2505.32, initialized the physical host explicitly and resolved its DXGI adapter by the device LUID. | Adapter | D3D12 OPTIONS5 | Compute pipeline | | --- | --- | --- | | NVIDIA RTX 4070 SUPER (620.73.4, `10de:2783`) | DXR 1.2 | Created | | AMD Raphael (RADV 26.3.1, `1002:164e`) | DXR 1.1 | Created | Both used the stock root signature path with SRV `t230`. The stock RayQuery selection also finished 6 passed and 1 ignored. Its WARP-labelled entry selected physical NVIDIA under Wine. This checks validation and pipeline creation. Ray dispatch and rendered output were outside the run. AI-assisted, independently verified against the raw results.
Author
Owner

@⁠KelboLive on GitHub · 2026-12-01 22:33 UTC · original · requested changes

Not ready to merge. The default-off path is broadly inert and the checks pass — cargo check --workspace --all-targets, 6 rayquery tests including WARP DXIL validation and pipeline creation, 19 hwrt, 7 dxr, 6 cache, check_no_game_data, and the switch page — but there are two correctness blockers and a cleanup pass:

Blocker 1: wrong DXIL opcode for committed object-to-world. shader.rs:287-290 defines COMMITTED_OBJ_TO_WORLD_3X4 = 187 and CANDIDATE_WORLD_TO_OBJ_3X4 = 188; canonical DXIL is 186 CandidateObjectToWorld, 187 CandidateWorldToObject, 188 CommittedObjectToWorld, 189 CommittedWorldToObject. rayquery.rs:7378 uses 187 for committed post-loop attribute loads, so a committed hit reads the candidate world→object matrix. rayquery_tests.rs:207 repeats the wrong constant, which is why validation and WARP pipeline creation pass — it is semantically wrong, and "judged by eye" is not enough for transforms.

Blocker 2: LEONIDA_HW_RT=1 on a non-DXR GPU has no fallback. hwrt::requested() (hwrt.rs:55) checks only the env var, not supported(), and modules/mod.rs:87 plus pipeline/make.rs:71/84/130 use requested(). On a non-DXR device the title's XboxBvhBuilder.dll is already replaced and the software builder path disabled, so the run is broken, not degraded. Also requested() does std::env::set_var("LEONIDA_BVH_BUILDER", "0") inside a OnceLock (hwrt.rs:59-66), which is order-dependent and unsafe for concurrent env access — "builder off at load" is not enforced. Gate on active()/supported() and fall back to the software builder cleanly.

Cleanup:

  • dxr.rs is 714 lines with hook()/answers()/keep_answers() never called (keep_answers is the only new warning), yet switches.md:169 documents LEONIDA_BVH_SIZE_ANSWER as if the builder methods are wrapped. Wire it or remove both.
  • descriptor/host.rs:4140 adds || tlas_view_va(&view).is_some() without active(), so AS SRVs lose list views even with the switch off.
  • descriptor.rs:2181/2291 adds off16 instrumentation to create_srv/create_uav with a hardcoded heap address, and it is compiled under diagnostics — which is the default play/diag build, so it runs for normal players. off16::placed is also unused.
  • xmem.rs:218 and :1301 add unconditional renderer port 1: info logs, unrelated to RT and noisy in normal runs.

Coverage gaps to be honest about: AS allocation sizing has no test (halving need at hwrt.rs:2467 passes all 19 hwrt tests); execute_copy ignores mode (Serialize/Deserialize treated as Clone); only triangle candidates are committed (rayquery.rs:6941), so procedural/AABB geometry never hits; and the PR's own 6-minute OOM (10,989 MB vs 10,793 MB budget) shows TLAS allocations are outside the BLAS budget. Real BLAS/TLAS builds, remap dispatch, ray output and frame rate need a GPU run.

Merge is clean against current main. Overlap warnings: #2661 conflicts in draw.rs/emit/mod.rs, #2834 in switches.md, and #2580/#2581 overlap the shader emitter heavily, so semantic conflicts are likely whichever lands first.

**@⁠KelboLive** on GitHub · 2026-12-01 22:33 UTC · [original](https://github.com/ProjectLeonida/mandy/pull/2972#pullrequestreview-6141367334) · **requested changes** Not ready to merge. The default-off path is broadly inert and the checks pass — `cargo check --workspace --all-targets`, 6 rayquery tests including WARP DXIL validation and pipeline creation, 19 `hwrt`, 7 `dxr`, 6 cache, `check_no_game_data`, and the switch page — but there are two correctness blockers and a cleanup pass: **Blocker 1: wrong DXIL opcode for committed object-to-world.** `shader.rs:287-290` defines `COMMITTED_OBJ_TO_WORLD_3X4 = 187` and `CANDIDATE_WORLD_TO_OBJ_3X4 = 188`; canonical DXIL is 186 CandidateObjectToWorld, **187 CandidateWorldToObject**, **188 CommittedObjectToWorld**, 189 CommittedWorldToObject. `rayquery.rs:7378` uses 187 for committed post-loop attribute loads, so a committed hit reads the candidate world→object matrix. `rayquery_tests.rs:207` repeats the wrong constant, which is why validation and WARP pipeline creation pass — it is semantically wrong, and "judged by eye" is not enough for transforms. **Blocker 2: `LEONIDA_HW_RT=1` on a non-DXR GPU has no fallback.** `hwrt::requested()` (`hwrt.rs:55`) checks only the env var, not `supported()`, and `modules/mod.rs:87` plus `pipeline/make.rs:71/84/130` use `requested()`. On a non-DXR device the title's `XboxBvhBuilder.dll` is already replaced and the software builder path disabled, so the run is broken, not degraded. Also `requested()` does `std::env::set_var("LEONIDA_BVH_BUILDER", "0")` inside a `OnceLock` (`hwrt.rs:59-66`), which is order-dependent and unsafe for concurrent env access — "builder off at load" is not enforced. Gate on `active()`/`supported()` and fall back to the software builder cleanly. **Cleanup:** - `dxr.rs` is 714 lines with `hook()`/`answers()`/`keep_answers()` never called (`keep_answers` is the only new warning), yet `switches.md:169` documents `LEONIDA_BVH_SIZE_ANSWER` as if the builder methods are wrapped. Wire it or remove both. - `descriptor/host.rs:4140` adds `|| tlas_view_va(&view).is_some()` **without** `active()`, so AS SRVs lose list views even with the switch off. - `descriptor.rs:2181/2291` adds `off16` instrumentation to `create_srv`/`create_uav` with a hardcoded heap address, and it is compiled under `diagnostics` — which is the default play/diag build, so it runs for normal players. `off16::placed` is also unused. - `xmem.rs:218` and `:1301` add unconditional `renderer port 1:` info logs, unrelated to RT and noisy in normal runs. **Coverage gaps to be honest about:** AS allocation sizing has no test (halving `need` at `hwrt.rs:2467` passes all 19 `hwrt` tests); `execute_copy` ignores `mode` (Serialize/Deserialize treated as Clone); only triangle candidates are committed (`rayquery.rs:6941`), so procedural/AABB geometry never hits; and the PR's own 6-minute OOM (10,989 MB vs 10,793 MB budget) shows TLAS allocations are outside the BLAS budget. Real BLAS/TLAS builds, remap dispatch, ray output and frame rate need a GPU run. Merge is clean against current main. Overlap warnings: #2661 conflicts in `draw.rs`/`emit/mod.rs`, #2834 in `switches.md`, and #2580/#2581 overlap the shader emitter heavily, so semantic conflicts are likely whichever lands first.
Author
Owner

@⁠KelboLive on GitHub · 2026-12-01 22:51 UTC · original

Addendum after a deeper API pass — these are separate from the two blockers above and matter if the feature is ever to be default-on. The PR implements the inline RayQuery half of DXR 1.1 (no DispatchRays/state objects/SBT), so SBT checks are N/A by design; the remaining issues are capability, spec-cleanliness and portability:

  1. The capability decision is split. supported() checks tier 1.1 + ID3D12Device5 (hwrt.rs:110-113), but the HLE module is injected from requested() (env only, modules/mod.rs:85-88) and emit::hw_rt() parses the env independently. On a tier-1.0/no-list4/SM<6.6 device, or if HwRtManager::new() fails, XboxBvhBuilder.dll is still replaced: prebuild returns 256/256, execute_op no-ops, the lift still happens, and draw.rs:3320-3338 drops the trace dispatch — silent broken lighting, not a fallback. Gate everything on one runtime available() (tier, Device5, list4, SM 6.6, manager init).
  2. AABB stride: prepare_aabbs rejects stride 0 (hwrt.rs:3273), but DXR allows it (tightly packed 24-byte AABBs), so a legal input silently misses; it also accepts non-8-byte-aligned strides, which DXR forbids. Allow 0, require stride % 8 == 0, and use stride.max(24) only for the shadow range.
  3. TLAS DescsLayout is ignored: build_batched2 stores instance_descs_va but not inputs.descs_layout, and execute_build always reads NumDescs flat 64-byte instances. A valid ARRAY_OF_POINTERS TLAS would be read as raw instance structs — garbage transforms. Store and honour the layout, or reject it.
  4. WriteBufferImmediate state: the compacted-size answer is written into the title's shadow buffer (hwrt.rs:3941-3961) without transitioning it to COPY_DEST, and in DEFAULT mode. The debug layer on 621.01 tolerates it; it is not spec-clean, and the title reads the slot later.
  5. copy_as ignores its mode (hwrt.rs:4013, _mode): fine for CLONE/COMPACT, silently wrong for SERIALIZE/DESERIALIZE/VISUALIZATION_DECODE.
  6. Refit key is the index-buffer address only (hwrt.rs:1603), but DXR forbids changing index-buffer contents between build and PERFORM_UPDATE; clamp_ib re-copies current indices every refit, so a title that rewrites the same buffer gets a spec-invalid update.
  7. Smaller: refresh_tlas_views isn't called from execute_copy (TLAS clone leaves descriptor slots stale); remap dispatches div_ceil(64) with no 65,535-group cap; rehydrate_cpu/validate_rehydrate return S_OK without doing anything; Vec::with_capacity(num_descs) is unbounded; prebuild passes NULL pointers for non-zero counts (portable drivers may size differently); instance transforms aren't sanitised for non-finite values.

What is already right, and worth preserving: the ABI struct sizes/offsets, 64-byte instance descs with the src_bias remap, geometry ordering with inactive placeholders, 256-byte scratch alignment with disjoint slices, AS resources held in the AS state, legacy barriers used consistently, and the build-flag masking/refit parity. On this RTX 4070 Ti SUPER (621.01) the device reports tier 1.1 / SM 6.6, so the capability gate is satisfiable here — it just is not the gate the code uses.

**@⁠KelboLive** on GitHub · 2026-12-01 22:51 UTC · [original](https://github.com/ProjectLeonida/mandy/pull/2972#issuecomment-7328420915) Addendum after a deeper API pass — these are separate from the two blockers above and matter if the feature is ever to be default-on. The PR implements the **inline `RayQuery` half** of DXR 1.1 (no `DispatchRays`/state objects/SBT), so SBT checks are N/A by design; the remaining issues are capability, spec-cleanliness and portability: 1. **The capability decision is split.** `supported()` checks tier 1.1 + `ID3D12Device5` (`hwrt.rs:110-113`), but the HLE module is injected from `requested()` (env only, `modules/mod.rs:85-88`) and `emit::hw_rt()` parses the env independently. On a tier-1.0/no-list4/SM<6.6 device, or if `HwRtManager::new()` fails, `XboxBvhBuilder.dll` is still replaced: prebuild returns 256/256, `execute_op` no-ops, the lift still happens, and `draw.rs:3320-3338` drops the trace dispatch — silent broken lighting, not a fallback. Gate everything on one runtime `available()` (tier, Device5, list4, SM 6.6, manager init). 2. **AABB stride:** `prepare_aabbs` rejects stride 0 (`hwrt.rs:3273`), but DXR allows it (tightly packed 24-byte AABBs), so a legal input silently misses; it also accepts non-8-byte-aligned strides, which DXR forbids. Allow 0, require `stride % 8 == 0`, and use `stride.max(24)` only for the shadow range. 3. **TLAS `DescsLayout` is ignored:** `build_batched2` stores `instance_descs_va` but not `inputs.descs_layout`, and `execute_build` always reads `NumDescs` flat 64-byte instances. A valid `ARRAY_OF_POINTERS` TLAS would be read as raw instance structs — garbage transforms. Store and honour the layout, or reject it. 4. **`WriteBufferImmediate` state:** the compacted-size answer is written into the title's shadow buffer (`hwrt.rs:3941-3961`) without transitioning it to `COPY_DEST`, and in DEFAULT mode. The debug layer on 621.01 tolerates it; it is not spec-clean, and the title reads the slot later. 5. **`copy_as` ignores its `mode`** (`hwrt.rs:4013`, `_mode`): fine for CLONE/COMPACT, silently wrong for SERIALIZE/DESERIALIZE/VISUALIZATION_DECODE. 6. **Refit key is the index-buffer address only** (`hwrt.rs:1603`), but DXR forbids changing index-buffer *contents* between build and `PERFORM_UPDATE`; `clamp_ib` re-copies current indices every refit, so a title that rewrites the same buffer gets a spec-invalid update. 7. Smaller: `refresh_tlas_views` isn't called from `execute_copy` (TLAS clone leaves descriptor slots stale); `remap` dispatches `div_ceil(64)` with no 65,535-group cap; `rehydrate_cpu`/`validate_rehydrate` return `S_OK` without doing anything; `Vec::with_capacity(num_descs)` is unbounded; prebuild passes NULL pointers for non-zero counts (portable drivers may size differently); instance transforms aren't sanitised for non-finite values. What is already right, and worth preserving: the ABI struct sizes/offsets, 64-byte instance descs with the `src_bias` remap, geometry ordering with inactive placeholders, 256-byte scratch alignment with disjoint slices, AS resources held in the AS state, legacy barriers used consistently, and the build-flag masking/refit parity. On this RTX 4070 Ti SUPER (621.01) the device reports tier 1.1 / SM 6.6, so the capability gate is satisfiable here — it just is not the gate the code uses.
- rq_op: 187 is CandidateWorldToObject3x4 and 188 CommittedObjectToWorld3x4 (they were
  swapped; checked against dxc 10.0.26100). the_ray_query_opcodes_are_dxils pins all 35.
- Hardware ray tracing runs only where it can: hwrt::active() (asked for, and a DXR 1.1
  manager made) gates the HLE module, the left-out passes, the copy-back rule and the counters;
  the translator lifts loops only when the host says it runs inline ray tracing
  (set_host_inline_rt, in host_settings and so in the shader cache's key). Elsewhere the title
  keeps its own XboxBvhBuilder.dll and the software walk.
- No env write: builder_allowed() is LEONIDA_BVH_BUILDER=1 and not hwrt::active().
- dxr.rs removed (nothing bound its wrappers); TLAS views are kept out of the list views only
  with the path on; the off16 diagnostics and the xmem log lines are gone.
- as_sizes split out of alloc_or_reuse_as, with a test; the known gaps are in
  fork-ray-tracing.md.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Author
Owner

@⁠Callimann8 on GitHub · 2026-12-01 23:11 UTC · original

Thanks for the careful review. All points are addressed in 9cedb84c9:

Blocker 1 (transform opcodes): right, 187 and 188 were swapped. Checked against dxc 10.0.26100 (Windows SDK, -T cs_6_5) on an HLSL shader calling every RayQuery method: 186 CandidateObjectToWorld3x4, 187 CandidateWorldToObject3x4, 188 CommittedObjectToWorld3x4, 189 CommittedWorldToObject3x4; every other op in rq_op matched. Fixed in shader.rs, and rayquery_tests.rs the_ray_query_opcodes_are_dxils now pins all 35 against those numbers, since validation cannot catch a swap of two ops of the same shape.

Blocker 2 (no DXR fallback, set_var):

  • hwrt::active() (switch asked for and a DXR 1.1 manager made) now gates the HLE module (modules/mod.rs), the left-out passes (pipeline/make.rs), the copy-back rule (shadow.rs) and the dispatch counters (draw.rs). On a card without DXR 1.1 the title keeps its own XboxBvhBuilder.dll and the log says so.
  • The translator lifts loops only when the host says it runs inline ray tracing: set_host_inline_rt, called with hwrt::supported(device) where the host tells the translator its other capabilities. It is part of host_settings(), so it is in the shader cache's key.
  • The set_var is gone. pipeline::builder_allowed() is LEONIDA_BVH_BUILDER=1 && !hwrt::active(); requested() only reads the switch, and the warnings about the other switches are said once the manager is made.

Cleanup:

  • dxr.rs removed (and its two diagnostics calls in hwrt.rs); switches.md regenerated, so it no longer documents LEONIDA_BVH_SIZE_ANSWER as wrapped.
  • descriptor/host.rs: the TLAS view is kept out of the list views only with hwrt::active().
  • off16 removed from descriptor.rs; xmem.rs is as on main.

Coverage: hwrt a_structures_buffer_holds_its_prebuild_size_on_256_byte_steps tests the allocation sizing (as_sizes, split out of alloc_or_reuse_as): halving need fails it now. The other gaps are written down in d3d12/docs/fork-ray-tracing.md and the description: AABB candidates are never committed, execute_copy treats serialize and deserialize as clones, the budget covers bottom levels only, and no test dispatches a ray. They are not fixed here.

Tested after the changes: cargo build --workspace --all-targets, cargo build -p leonida --features diagnostics,mimalloc, cargo test --workspace --exclude xtask (leonida-shader 425 passed, leonida-gpu 663 passed; the one failure is texture::alias_cast_tests::committed_and_placed_r32_uint_textures_cast_to_r9g9b9e5_under_legacy_barriers, which fails at random on main here too and passes alone), the replay test, tests/test_d3d12_switches.py, and clippy on the changed files (nothing new). Not yet re-run in the game.

If #2661, #2834 or #2580/#2581 land first, I'll merge main into this branch and fix the conflicts.

**@⁠Callimann8** on GitHub · 2026-12-01 23:11 UTC · [original](https://github.com/ProjectLeonida/mandy/pull/2972#issuecomment-7328986136) Thanks for the careful review. All points are addressed in 9cedb84c9: **Blocker 1 (transform opcodes):** right, 187 and 188 were swapped. Checked against `dxc` 10.0.26100 (Windows SDK, `-T cs_6_5`) on an HLSL shader calling every `RayQuery` method: 186 `CandidateObjectToWorld3x4`, 187 `CandidateWorldToObject3x4`, 188 `CommittedObjectToWorld3x4`, 189 `CommittedWorldToObject3x4`; every other op in `rq_op` matched. Fixed in `shader.rs`, and `rayquery_tests.rs` `the_ray_query_opcodes_are_dxils` now pins all 35 against those numbers, since validation cannot catch a swap of two ops of the same shape. **Blocker 2 (no DXR fallback, `set_var`):** - `hwrt::active()` (switch asked for and a DXR 1.1 manager made) now gates the HLE module (`modules/mod.rs`), the left-out passes (`pipeline/make.rs`), the copy-back rule (`shadow.rs`) and the dispatch counters (`draw.rs`). On a card without DXR 1.1 the title keeps its own `XboxBvhBuilder.dll` and the log says so. - The translator lifts loops only when the host says it runs inline ray tracing: `set_host_inline_rt`, called with `hwrt::supported(device)` where the host tells the translator its other capabilities. It is part of `host_settings()`, so it is in the shader cache's key. - The `set_var` is gone. `pipeline::builder_allowed()` is `LEONIDA_BVH_BUILDER=1 && !hwrt::active()`; `requested()` only reads the switch, and the warnings about the other switches are said once the manager is made. **Cleanup:** - `dxr.rs` removed (and its two diagnostics calls in `hwrt.rs`); `switches.md` regenerated, so it no longer documents `LEONIDA_BVH_SIZE_ANSWER` as wrapped. - `descriptor/host.rs`: the TLAS view is kept out of the list views only with `hwrt::active()`. - `off16` removed from `descriptor.rs`; `xmem.rs` is as on `main`. **Coverage:** `hwrt` `a_structures_buffer_holds_its_prebuild_size_on_256_byte_steps` tests the allocation sizing (`as_sizes`, split out of `alloc_or_reuse_as`): halving `need` fails it now. The other gaps are written down in `d3d12/docs/fork-ray-tracing.md` and the description: AABB candidates are never committed, `execute_copy` treats serialize and deserialize as clones, the budget covers bottom levels only, and no test dispatches a ray. They are not fixed here. Tested after the changes: `cargo build --workspace --all-targets`, `cargo build -p leonida --features diagnostics,mimalloc`, `cargo test --workspace --exclude xtask` (`leonida-shader` 425 passed, `leonida-gpu` 663 passed; the one failure is `texture::alias_cast_tests::committed_and_placed_r32_uint_textures_cast_to_r9g9b9e5_under_legacy_barriers`, which fails at random on `main` here too and passes alone), the replay test, `tests/test_d3d12_switches.py`, and clippy on the changed files (nothing new). Not yet re-run in the game. If #2661, #2834 or #2580/#2581 land first, I'll merge `main` into this branch and fix the conflicts.
Author
Owner

@⁠andrew-ai on GitHub · 2026-12-01 23:28 UTC · original

Verified the new host inline-RT capability in the persisted shader cache key at 9cedb84c9. Four fresh Windows processes shared one empty cache and the same input bytes, with LEONIDA_HW_RT=1 and LEONIDA_HW_RT_LIFT=1 throughout. After initializing the host probe, the temporary test set the translator capability to off, on, off, on. The first two runs each converted once and wrote distinct markers. The last two made zero conversions and retrieved the marker for the matching capability.

The host probe matters for this reproduction: my first harness set the simulated capability before initializing the host, so the probe overwrote it and both runs saw the real adapter's setting. This tests cache separation with a stand-in converter; it does not exercise GPU ray dispatch. Codex-assisted.

**@⁠andrew-ai** on GitHub · 2026-12-01 23:28 UTC · [original](https://github.com/ProjectLeonida/mandy/pull/2972#issuecomment-7329382050) Verified the new host inline-RT capability in the persisted shader cache key at 9cedb84c9. Four fresh Windows processes shared one empty cache and the same input bytes, with LEONIDA_HW_RT=1 and LEONIDA_HW_RT_LIFT=1 throughout. After initializing the host probe, the temporary test set the translator capability to off, on, off, on. The first two runs each converted once and wrote distinct markers. The last two made zero conversions and retrieved the marker for the matching capability. The host probe matters for this reproduction: my first harness set the simulated capability before initializing the host, so the probe overwrote it and both runs saw the real adapter's setting. This tests cache separation with a stand-in converter; it does not exercise GPU ray dispatch. Codex-assisted.
- One gate for both halves: supported() also asks for shader model 6.6, and the translator is
  told inline ray tracing runs (set_host_inline_rt) only once the DXR manager is made.
- AABB geometries take stride 0 (packed 24-byte boxes) and multiples of 8 of 24 or more, as
  DXR does; others are refused.
- A TLAS of instances by pointer (ARRAY_OF_POINTERS) is not built: the remap reads 64-byte
  instances in a row.
- Structure copies other than clone and compact are not done (said once).
- A TLAS clone points the heap slots that view the destination at the shared structure.
- The points not fixed here are listed in fork-ray-tracing.md.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Author
Owner

@⁠andrew-ai on GitHub · 2026-12-01 23:43 UTC · original

One range calculation in the AABB update still includes padding after the final box. At 3a38a050d the shadow lookup and refresh request count * max(stride, 24) bytes. For two 24-byte AABBs at offsets 0 and 64, the final byte used is 87, so the required span is 88 bytes. The PR requests 128. Even a single AABB requests 64 bytes for a 24-byte record when stride is 64.

Please compute the span from the last indexed record with checked arithmetic and add a boundary case with the last AABB ending exactly at the buffer end. The existing predicate test accepts stride 64 but does not check the span handed to the shadow layer. This is a source-level range check. I did not observe a GPU failure. DXR geometry and AABB definitions

Codex-assisted follow-up to the #2570 verification.

**@⁠andrew-ai** on GitHub · 2026-12-01 23:43 UTC · [original](https://github.com/ProjectLeonida/mandy/pull/2972#issuecomment-7329704613) One range calculation in the AABB update still includes padding after the final box. At 3a38a050d the shadow lookup and refresh request count * max(stride, 24) bytes. For two 24-byte AABBs at offsets 0 and 64, the final byte used is 87, so the required span is 88 bytes. The PR requests 128. Even a single AABB requests 64 bytes for a 24-byte record when stride is 64. Please compute the span from the last indexed record with checked arithmetic and add a boundary case with the last AABB ending exactly at the buffer end. The existing predicate test accepts stride 64 but does not check the span handed to the shadow layer. This is a source-level range check. I did not observe a GPU failure. [DXR geometry and AABB definitions](https://microsoft.github.io/DirectX-Specs/d3d/Raytracing.html#d3d12_raytracing_geometry_aabbs_desc) Codex-assisted follow-up to the #2570 verification.
# Conflicts:
#	d3d12/crates/leonida-gpu/src/descriptor/host.rs
#	d3d12/docs/switches.md
The shadow lookup and refresh asked for count * max(stride, 24) bytes, past the last box
(two boxes at 0 and 64: 128 bytes where 88 are used). aabb_span takes (count - 1) * stride + 24
with checked arithmetic; a test covers the last box ending at a buffer's end and overflow.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Author
Owner

@⁠Callimann8 on GitHub · 2026-12-02 00:47 UTC · original

Thanks, right: the range ran to count * max(stride, 24). Fixed in 923a4e98f: aabb_span is (count - 1) * stride + 24 (stride 0: packed 24-byte boxes) with checked arithmetic, and the shadow lookup and refresh ask for exactly that. an_aabb_range_ends_with_its_last_box covers your two cases (two boxes at 0 and 64: 88 bytes; one box at stride 64: 24), the last box ending exactly at the end of a 4096-byte buffer, and overflow.

**@⁠Callimann8** on GitHub · 2026-12-02 00:47 UTC · [original](https://github.com/ProjectLeonida/mandy/pull/2972#issuecomment-7330969508) Thanks, right: the range ran to count * max(stride, 24). Fixed in 923a4e98f: aabb_span is (count - 1) * stride + 24 (stride 0: packed 24-byte boxes) with checked arithmetic, and the shadow lookup and refresh ask for exactly that. an_aabb_range_ends_with_its_last_box covers your two cases (two boxes at 0 and 64: 88 bytes; one box at stride 64: 24), the last box ending exactly at the end of a 4096-byte buffer, and overflow.
Author
Owner

@⁠andrew-ai on GitHub · 2026-12-02 00:52 UTC · original

Confirmed the positive-stride padding fix at 923a4e98f. I compiled the production aabb_span helper and compared its result with the last byte used by explicitly enumerated 24-byte boxes for 1 through 128 boxes and six strides from 24 through 256. All 768 matched. Two boxes starting at buffer offset 4008 with stride 64 end exactly at 4096. Both the shadow lookup and refresh receive that same span. One separate point remains for stride 0: the helper explicitly interprets it as packed (24 bytes apart), but the native descriptor still receives StrideInBytes = 0. A native multi-box test would establish whether the host interprets that layout the same way. This check covered CPU geometry math and call sites. Codex-assisted.

**@⁠andrew-ai** on GitHub · 2026-12-02 00:52 UTC · [original](https://github.com/ProjectLeonida/mandy/pull/2972#issuecomment-7331046380) Confirmed the positive-stride padding fix at 923a4e98f. I compiled the production aabb_span helper and compared its result with the last byte used by explicitly enumerated 24-byte boxes for 1 through 128 boxes and six strides from 24 through 256. All 768 matched. Two boxes starting at buffer offset 4008 with stride 64 end exactly at 4096. Both the shadow lookup and refresh receive that same span. One separate point remains for stride 0: the helper explicitly interprets it as packed (24 bytes apart), but the native descriptor still receives StrideInBytes = 0. A native multi-box test would establish whether the host interprets that layout the same way. This check covered CPU geometry math and call sites. Codex-assisted.
Author
Owner

@⁠OreoFR on GitHub · 2026-12-02 06:39 UTC · original

Carried onto current main in #3058, keeping all your commits and credits. The only conflicts were the launcher switch lists next to #2986's -PrecompileAll. Measured on an RTX 4070 Laptop: -HardwareRT gives 21.6 fps against 2.3 fps for -RayTracing over the same walk, the same scene renders, and there was no device lost. Thanks for the port! (oreofr-agent for OreoFR, AI-assisted)

**@⁠OreoFR** on GitHub · 2026-12-02 06:39 UTC · [original](https://github.com/ProjectLeonida/mandy/pull/2972#issuecomment-7337261080) Carried onto current main in #3058, keeping all your commits and credits. The only conflicts were the launcher switch lists next to #2986's `-PrecompileAll`. Measured on an RTX 4070 Laptop: `-HardwareRT` gives 21.6 fps against 2.3 fps for `-RayTracing` over the same walk, the same scene renders, and there was no device lost. Thanks for the port! (oreofr-agent for OreoFR, AI-assisted)
github manually merged commit daf7242f2e into main 2026-12-02 07:08:50 +00:00
Author
Owner

@⁠lerapeurdu62280-debug on GitHub · 2026-12-02 11:01 UTC · original

LEONIDA_HW_RT=1 on an 8 GB RDNA2 card, for the known limit above: the device goes in under two minutes, the card's memory over its budget.

PC: RX 6600 8 GB (driver 32.0.21045.29003), Ryzen 5 3600, 32 GB, Windows 11. Build: main 895c472fa with four local patches on top (#2670, the stretch unjitter, #2774, the FidelityFX redirect); none of them touches hwrt.rs or the shader lifting.
Run: -SeriesS -FsrFrameGen -HardwareRT, LEONIDA_SUBMIT_FRAMES=0, FSR 3.1; the same save and the same keys as a run without -HardwareRT just before, the frame log's own lines.

without -HardwareRT with -HardwareRT
fps (in game) 12.5 (8.7 to 14.3) 7.0 (6.3 to 8.1)
frames over 100 ms 5.4 % 7.6 %
preparing / copying back, ms a frame 44 / 52 81 / 71
draws a frame ~9,000 ~12,700
end 300 s, no error device removed 118 s after the window opened
  • hwrt: hardware DXR 1.1 RT manager initialized (LEONIDA_HW_RT=1) tier=11; ray queries lifted 1 of 1 (bvh32), none fell back.
  • Last memory lines before it went: BLAS memory: budget 692 MB, live 490 MB (1825 BLAS); the card's own budget 6942 MB, in use 7740 MB.
  • Then device-removed data; page fault at 0xa9913f000 (past the end of the view heap 0x10a600000+0x8000000), relay: fence ... did not reach 11431; device removed (0x887A0006).

So on 8 GB the BLAS add to a card already near its budget, and it fails the same way as the 11 GB run, sooner. Without -HardwareRT this PC stays in budget. Not tried: LEONIDA_HW_RT_REFIT=0, a lower BLAS budget, Series X.

Contribution : EI S.O.S INFO LUDO
AI-assisted (Claude Opus 5.5)

**@⁠lerapeurdu62280-debug** on GitHub · 2026-12-02 11:01 UTC · [original](https://github.com/ProjectLeonida/mandy/pull/2972#issuecomment-7343320129) `LEONIDA_HW_RT=1` on an 8 GB RDNA2 card, for the known limit above: the device goes in under two minutes, the card's memory over its budget. **PC:** RX 6600 8 GB (driver 32.0.21045.29003), Ryzen 5 3600, 32 GB, Windows 11. **Build:** `main` 895c472fa with four local patches on top (#2670, the stretch unjitter, #2774, the FidelityFX redirect); none of them touches `hwrt.rs` or the shader lifting. **Run:** `-SeriesS -FsrFrameGen -HardwareRT`, `LEONIDA_SUBMIT_FRAMES=0`, FSR 3.1; the same save and the same keys as a run without `-HardwareRT` just before, the frame log's own lines. | | without `-HardwareRT` | with `-HardwareRT` | |---|---|---| | fps (in game) | 12.5 (8.7 to 14.3) | 7.0 (6.3 to 8.1) | | frames over 100 ms | 5.4 % | 7.6 % | | preparing / copying back, ms a frame | 44 / 52 | 81 / 71 | | draws a frame | ~9,000 | ~12,700 | | end | 300 s, no error | device removed 118 s after the window opened | - `hwrt: hardware DXR 1.1 RT manager initialized (LEONIDA_HW_RT=1) tier=11`; ray queries lifted 1 of 1 (bvh32), none fell back. - Last memory lines before it went: `BLAS memory: budget 692 MB, live 490 MB (1825 BLAS)`; the card's own `budget 6942 MB, in use 7740 MB`. - Then `device-removed data; page fault at 0xa9913f000` (past the end of the view heap `0x10a600000+0x8000000`), `relay: fence ... did not reach 11431; device removed (0x887A0006)`. So on 8 GB the BLAS add to a card already near its budget, and it fails the same way as the 11 GB run, sooner. Without `-HardwareRT` this PC stays in budget. Not tried: `LEONIDA_HW_RT_REFIT=0`, a lower BLAS budget, Series X. Contribution : EI S.O.S INFO LUDO AI-assisted (Claude Opus 5.5)
This discussion has been locked. Commenting is limited to contributors.
No reviewers
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.

Dependencies

No dependencies set

Reference
github/ubiquitarianism--leonida!2972
No description provided.