GPU: the heap clamp bound must fit what D3D12 gives #2315

Closed
github-bot wants to merge 1 commit from gh-pr/2315/head into gh-pr/2315/base
Owner

@⁠xiaotu030202 on GitHub · 2026-11-25 10:27 UTC · original
xiaotu030202:gpu/heap-clamp-bound-fits-host → main · +103 −20 · 2 files · 1 commits · closed without merging

What this fixes

victory-shader clamps every heap index a translated shader computes to HEAP_VIEWS - 1, and victory-gpu has to give it a heap holding those slots. The two disagreed, and the gap removed the host device.

HEAP_VIEWS was 1 << 21 — 2,097,152. D3D12 takes 1,000,000 descriptors in a shader-visible CBV/SRV/UAV heap on every resource binding tier and refuses one more. Measured on an RTX 5070 Ti, creating a shader-visible view heap at each size:

view   1000 -> OK
view   10000 -> OK
view   65536 -> OK
view   100000 -> OK
view   262144 -> OK
view   500000 -> OK
view   524288 -> OK
view  1000000 -> OK
view  1048576 -> FAIL 0x8007000E  (E_OUTOFMEMORY)
view  1310720 -> FAIL 0x8007000E
view  2097152 -> FAIL 0x8007000E
sampler   2048 -> OK
sampler   4096 -> FAIL 0x8007025D

So the first request in HostHeap::new:

} else if let Ok(heap) = make((count + DYNAMIC).max(views)) {

could never succeed — on any device, from any vendor. Every host fell into the fallback, which asked for count + MIN_DYNAMIC (65,536 + the title's) and got it: a heap of 65,540 slots in the host() test heap. Translated shaders still clamped to 2^21 - 1, so a shader reading a computed index past what the heap held handed the GPU a descriptor that did not exist. That is 0x887A0005 (DXGI_ERROR_DEVICE_REMOVED), and once the device was gone every later test in the process failed — one of them then took the whole test binary down with STATUS_STACK_BUFFER_OVERRUN.

The fallback's comment blamed NVIDIA:

// shortcut: a host that caps its heaps below `HEAP_VIEWS` (NVIDIA)
// faults on an index past them, as before the clamp.

It was every vendor; the comment was written from an AMD card, where the fallback path also gets taken but the tests that exercise it are the ones gated on hardware this project was developed against. It is also the same shape as #59 (device removal while loading the world on an RX 9070 XT).

What changed

Three things, all where the heap geometry is decided:

crates/victory-shader/src/emit/shader.rs — HEAP_VIEWS is 1 << 19. The clamp bound cannot take the whole 1,000,000 ceiling: the slots kept past it need room too.

crates/victory-gpu/src/descriptor/host.rs

  • MIN_DYNAMIC becomes PAIR_RESERVE (1 << 16): the slots HostHeap::pair hands a host copy's two views. This was a real second bug the first fix exposed — with a heap that exactly reaches the clamp bound, every pair went to a dynamic slot, and memory::tests::lists_share_a_table_and_copies_keep_their_views caught it (pairs = (2, 4), wanting >= 1 << 18).
  • extra counts the dynamic slots alone, so pairs starts past them and has room to the end of the heap.
  • The branch chain asks for one size — max(clamp bound, title count) + PAIR_RESERVE + DYNAMIC, capped at PORTABLE_VIEWS — and falls back to the same size minus the dynamic range, never below the clamp bound.

A const assertion holds the invariant that was violated:

const {
    assert!(victory_shader::emit::HEAP_VIEWS <= PORTABLE_VIEWS);
    assert!(
        victory_shader::emit::HEAP_VIEWS as u64 + DYNAMIC as u64 + PAIR_RESERVE as u64
            <= PORTABLE_VIEWS as u64
    );
}

Tests

New: the_clamp_bound_fits_in_a_host_heap — asks the device for a real heap and asserts NumDescriptors >= HEAP_VIEWS. That is exactly the property that was false, and it fails on the old code.

Measured here (Windows 11, RTX 5070 Ti, Rust 1.98.1 pinned, --test-threads=1), before → after:

group before after
descriptor:: 9 passed, 1 FAILED 11 passed
memory:: 2 passed, 1 FAILED 3 passed
draw:: 1 passed, 4 FAILED 4 passed, 1 FAILED
victory-shader 245 passed, 2 failed 245 passed, 2 failed (unchanged)

indirect::, list::, host::, pipeline::, device::, queue::, query::, fence::, frame::, dxgi::, bindless::, object::, primitive::, resource:: are all green.

What is left, and why it is not here

Two failures remain and neither comes from this patch — I stashed it and re-ran to confirm:

  1. draw::tests::a_texture_written_in_one_format_reads_in_another_through_a_placed_view fails at CreateRootSignature with 0x887A0005 on its own, isolated, with the patch stashed as well. It does not touch the heap geometry (it builds its own Slots::new(4) and a fixed root signature).
  2. victory-shader's stride_tests::a_heap_buffer_read_by_element_takes_the_views_stride and synthetic_tests::gathers_at_a_level_match_the_hardware compare shader output against RDNA2 hardware results. On a GeForce the first returns 11 of 32 lanes' worth (left: [101..131, 0, 0, ...], right: [200..231]). Both fail identically with the patch stashed. Judging them needs an AMD card, and they deserve their own issue rather than a patch from here.

I could not run the title (no game files), so this is not evidence that the world now renders. What it does establish is that a host heap can now hold every index the translator is allowed to name, and that the tests which check it pass — including on NVIDIA, where they could not before.

Environment

Windows 11, Ryzen 7 9800X3D, RTX 5070 Ti (driver 32.0.16.2140), MSVC 14.44.35207, Windows SDK 10.0.26100.0, VICTORY_DXIL pointed at that SDK's dxil.dll.

**@⁠xiaotu030202** on GitHub · 2026-11-25 10:27 UTC · [original](https://github.com/Marvisak/VIctory/pull/2315) `xiaotu030202:gpu/heap-clamp-bound-fits-host` → `main` · +103 −20 · 2 files · 1 commits · closed without merging ## What this fixes `victory-shader` clamps every heap index a translated shader computes to `HEAP_VIEWS - 1`, and `victory-gpu` has to give it a heap holding those slots. The two disagreed, and the gap removed the host device. `HEAP_VIEWS` was `1 << 21` — 2,097,152. D3D12 takes 1,000,000 descriptors in a shader-visible CBV/SRV/UAV heap on **every** resource binding tier and refuses one more. Measured on an RTX 5070 Ti, creating a shader-visible view heap at each size: ``` view 1000 -> OK view 10000 -> OK view 65536 -> OK view 100000 -> OK view 262144 -> OK view 500000 -> OK view 524288 -> OK view 1000000 -> OK view 1048576 -> FAIL 0x8007000E (E_OUTOFMEMORY) view 1310720 -> FAIL 0x8007000E view 2097152 -> FAIL 0x8007000E sampler 2048 -> OK sampler 4096 -> FAIL 0x8007025D ``` So the first request in `HostHeap::new`: ```rust } else if let Ok(heap) = make((count + DYNAMIC).max(views)) { ``` could never succeed — on any device, from any vendor. Every host fell into the fallback, which asked for `count + MIN_DYNAMIC` (65,536 + the title's) and got it: a heap of 65,540 slots in the `host()` test heap. Translated shaders still clamped to `2^21 - 1`, so a shader reading a computed index past what the heap held handed the GPU a descriptor that did not exist. That is `0x887A0005` (`DXGI_ERROR_DEVICE_REMOVED`), and once the device was gone every later test in the process failed — one of them then took the whole test binary down with `STATUS_STACK_BUFFER_OVERRUN`. The fallback's comment blamed NVIDIA: ```rust // shortcut: a host that caps its heaps below `HEAP_VIEWS` (NVIDIA) // faults on an index past them, as before the clamp. ``` It was every vendor; the comment was written from an AMD card, where the *fallback* path also gets taken but the tests that exercise it are the ones gated on hardware this project was developed against. It is also the same shape as #59 (device removal while loading the world on an RX 9070 XT). ## What changed Three things, all where the heap geometry is decided: **`crates/victory-shader/src/emit/shader.rs`** — `HEAP_VIEWS` is `1 << 19`. The clamp bound cannot take the whole 1,000,000 ceiling: the slots kept past it need room too. **`crates/victory-gpu/src/descriptor/host.rs`** - `MIN_DYNAMIC` becomes `PAIR_RESERVE` (`1 << 16`): the slots `HostHeap::pair` hands a host copy's two views. This was a real second bug the first fix exposed — with a heap that exactly reaches the clamp bound, every pair went to a dynamic slot, and `memory::tests::lists_share_a_table_and_copies_keep_their_views` caught it (`pairs = (2, 4)`, wanting `>= 1 << 18`). - `extra` counts the dynamic slots alone, so `pairs` starts past them and has room to the end of the heap. - The branch chain asks for one size — `max(clamp bound, title count) + PAIR_RESERVE + DYNAMIC`, capped at `PORTABLE_VIEWS` — and falls back to the same size minus the dynamic range, never below the clamp bound. **A `const` assertion** holds the invariant that was violated: ```rust const { assert!(victory_shader::emit::HEAP_VIEWS <= PORTABLE_VIEWS); assert!( victory_shader::emit::HEAP_VIEWS as u64 + DYNAMIC as u64 + PAIR_RESERVE as u64 <= PORTABLE_VIEWS as u64 ); } ``` ## Tests New: `the_clamp_bound_fits_in_a_host_heap` — asks the device for a real heap and asserts `NumDescriptors >= HEAP_VIEWS`. That is exactly the property that was false, and it fails on the old code. Measured here (Windows 11, RTX 5070 Ti, Rust 1.98.1 pinned, `--test-threads=1`), before → after: | group | before | after | |---|---|---| | `descriptor::` | 9 passed, 1 **FAILED** | **11 passed** | | `memory::` | 2 passed, 1 **FAILED** | **3 passed** | | `draw::` | 1 passed, 4 **FAILED** | **4 passed, 1 FAILED** | | `victory-shader` | 245 passed, 2 failed | 245 passed, 2 failed (unchanged) | `indirect::`, `list::`, `host::`, `pipeline::`, `device::`, `queue::`, `query::`, `fence::`, `frame::`, `dxgi::`, `bindless::`, `object::`, `primitive::`, `resource::` are all green. ## What is left, and why it is not here Two failures remain and neither comes from this patch — I stashed it and re-ran to confirm: 1. `draw::tests::a_texture_written_in_one_format_reads_in_another_through_a_placed_view` fails at `CreateRootSignature` with `0x887A0005` on its own, isolated, with the patch stashed as well. It does not touch the heap geometry (it builds its own `Slots::new(4)` and a fixed root signature). 2. `victory-shader`'s `stride_tests::a_heap_buffer_read_by_element_takes_the_views_stride` and `synthetic_tests::gathers_at_a_level_match_the_hardware` compare shader output against RDNA2 hardware results. On a GeForce the first returns 11 of 32 lanes' worth (`left: [101..131, 0, 0, ...]`, `right: [200..231]`). Both fail identically with the patch stashed. Judging them needs an AMD card, and they deserve their own issue rather than a patch from here. I could not run the title (no game files), so this is not evidence that the world now renders. What it does establish is that a host heap can now hold every index the translator is allowed to name, and that the tests which check it pass — including on NVIDIA, where they could not before. ## Environment Windows 11, Ryzen 7 9800X3D, RTX 5070 Ti (driver 32.0.16.2140), MSVC 14.44.35207, Windows SDK 10.0.26100.0, `VICTORY_DXIL` pointed at that SDK's `dxil.dll`.
`victory-shader` clamps every heap index a translated shader computes to
`HEAP_VIEWS - 1`, and `victory-gpu` must give it a heap that has those
slots. The two disagreed.

`HEAP_VIEWS` was `1 << 21` (2,097,152). D3D12 takes 1,000,000 descriptors
in a shader-visible CBV/SRV/UAV heap on every resource binding tier and
refuses one more with `E_OUTOFMEMORY` — measured on an RTX 5070 Ti, where
every size up to 1,000,000 succeeds and 1,048,576 fails:

    view   1000000 -> OK
    view   1048576 -> FAIL 0x8007000E (E_OUTOFMEMORY)
    view   2097152 -> FAIL 0x8007000E

So the first request, `make((count + DYNAMIC).max(views))`, could never
succeed on any device. Every host fell into the fallback, which asked for
`count + MIN_DYNAMIC` (65,536 + the title's) and got it — a heap smaller
than the index shaders were still allowed to name. A shader that read one
past it removed the device (`0x887A0005`, and one test then took the whole
test process down with `STATUS_STACK_BUFFER_OVERRUN`).

The comment on that fallback blamed NVIDIA; it was every vendor. The world
runs in #59 (a device removal on an RX 9070 XT) are the same shape.

Three changes, all in the one place the geometry is decided:

- `HEAP_VIEWS` is `1 << 19`. The bound has to share D3D12's 1,000,000 with
  the slots kept past it, not take the whole ceiling.
- `PAIR_RESERVE` (`1 << 16`) replaces `MIN_DYNAMIC`: the slots
  `HostHeap::pair` hands a host copy's two views. Without a reserve, a heap
  that exactly reaches the clamp bound sends every pair to a dynamic slot,
  which the clamp can then reach. `extra` counts the dynamic slots alone,
  so `pairs` starts past them and has room to the end.
- A `const` assertion holds the invariant: the clamp bound, the dynamic
  slots and the pair reserve together must fit in `PORTABLE_VIEWS`.

A test, `the_clamp_bound_fits_in_a_host_heap`, asserts the heap the device
actually gives holds every index the clamp reaches — the thing that was
false.

Measured on Windows 11, RTX 5070 Ti, Rust 1.98.1 (pinned), before → after,
single-threaded:

    descriptor::     9 passed, 1 FAILED  ->  11 passed
    memory::         2 passed, 1 FAILED  ->   3 passed
    draw::           1 passed, 4 FAILED  ->   4 passed, 1 FAILED
    victory-shader   (unchanged: 245 passed, 2 failed)

The remaining two are other faults, unchanged by this: `draw`'s
`a_texture_written_in_one_format_reads_in_another_through_a_placed_view`
fails the same way with this patch stashed, and `victory-shader`'s
`stride_tests::a_heap_buffer_read_by_element_takes_the_views_stride` and
`synthetic_tests::gathers_at_a_level_match_the_hardware` compare against
RDNA2 results a GeForce does not reproduce. Both stashed-and-rerun the
same, so they are not from here; the last two would need an AMD card to
judge and are worth their own report.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 05:02:01 +00:00
github-bot closed this pull request 2026-11-26 05:02:01 +00:00
Author
Owner

@⁠andrewpozdnakov7-jpg on GitHub · 2026-11-25 10:42 UTC · original

The NVIDIA ceiling is reproducible on the reported setup. Tier 3 also permits larger shader-visible view heaps when the driver accepts them, per the D3D12 Resource Binding specification.

I ran the same synthetic fixture on app-local WARP Tier 3. A direct CreateDescriptorHeap succeeded with 1,000,001 and 2,097,152 shader-visible CBV/SRV/UAV descriptors on all three heads. The VIctory entry point behaved differently:

Tree HostHeap::new(false, 4) HostHeap::new(false, 1_245_184)
upstream 940d32f 2,097,152 host slots 2,097,152 host slots, all title slots retained
this PR 43aa1b2 851,968 host slots None
#2177 1a3261f 2,097,152 host slots 2,097,152 host slots, all title slots retained

The same assertion passes on main and #2177 and fails on this PR. The early least > PORTABLE_VIEWS return replaces a successful larger allocation on this device. A capability probe with a capped fallback, as in #2177, addresses the NVIDIA ceiling while preserving the successful Tier 3 path here.

AI-assisted. Synthetic tests only.

**@⁠andrewpozdnakov7-jpg** on GitHub · 2026-11-25 10:42 UTC · [original](https://github.com/Marvisak/VIctory/pull/2315#issuecomment-7160072900) The NVIDIA ceiling is reproducible on the reported setup. Tier 3 also permits larger shader-visible view heaps when the driver accepts them, per the [D3D12 Resource Binding specification](https://microsoft.github.io/DirectX-Specs/d3d/ResourceBinding.html#levels-of-hardware-support). I ran the same synthetic fixture on app-local WARP Tier 3. A direct `CreateDescriptorHeap` succeeded with 1,000,001 and 2,097,152 shader-visible CBV/SRV/UAV descriptors on all three heads. The VIctory entry point behaved differently: | Tree | `HostHeap::new(false, 4)` | `HostHeap::new(false, 1_245_184)` | | --- | ---: | --- | | upstream `940d32f` | 2,097,152 host slots | 2,097,152 host slots, all title slots retained | | this PR `43aa1b2` | 851,968 host slots | `None` | | #2177 `1a3261f` | 2,097,152 host slots | 2,097,152 host slots, all title slots retained | The same assertion passes on main and #2177 and fails on this PR. The early `least > PORTABLE_VIEWS` return replaces a successful larger allocation on this device. A capability probe with a capped fallback, as in #2177, addresses the NVIDIA ceiling while preserving the successful Tier 3 path here. AI-assisted. Synthetic tests only.
Author
Owner

@⁠Dathinel on GitHub · 2026-11-25 14:55 UTC · original

Hardware data point for the heap ceiling on NVIDIA Ampere, with the D3D12 debug layer on (--features diagnostics, VICTORY_D3D12_DEBUG=1; the probe required ID3D12InfoQueue). RTX 3050 Laptop, driver 610.62, resource binding tier 3, Windows 11 26200.

Direct shader-visible CreateDescriptorHeap: views 1,000,000 OK; 1,000,001 / 1,048,576 / 2,097,152 fail with 0x80070057, with the layer saying "the limit for shader visible view heaps is 1000000". Samplers 2,049 OK, 4,096 fail (layer: limit 4080). With the layer on, the code is E_INVALIDARG rather than the E_OUTOFMEMORY in the description; I did not run without it.

HostHeap::new on the same card, one synthetic probe per head:

head shader clamp bound new(false, 4) new(false, 1_245_184)
main 940d32f 2,097,152 65,540 slots 1,000,000 slots
this PR 43aa1b2 524,288 851,968 slots None
#2185 9518df8 1,000,000 (runtime) 1,000,000 1,000,000 (934,461 title slots kept)
#2177 d15c68b 1,000,000 (runtime) 1,000,000 1,000,000 (844,349 title slots kept)

So on NVIDIA hardware main's mismatch is real (clamp above the heap in both cases), and this PR closes it for small titles. But a title that declares more than the ceiling now gets no view heap at all, where main, #2185 and #2177 cap it at 1,000,000. That matches the WARP result above. I did not test a shader read past the cap on any head.

AI-assisted; synthetic probe only. Probe source available on request.

**@⁠Dathinel** on GitHub · 2026-11-25 14:55 UTC · [original](https://github.com/Marvisak/VIctory/pull/2315#issuecomment-7166032577) Hardware data point for the heap ceiling on NVIDIA Ampere, with the D3D12 debug layer on (`--features diagnostics`, `VICTORY_D3D12_DEBUG=1`; the probe required `ID3D12InfoQueue`). RTX 3050 Laptop, driver 610.62, resource binding tier 3, Windows 11 26200. Direct shader-visible `CreateDescriptorHeap`: views 1,000,000 OK; 1,000,001 / 1,048,576 / 2,097,152 fail with `0x80070057`, with the layer saying "the limit for shader visible view heaps is 1000000". Samplers 2,049 OK, 4,096 fail (layer: limit 4080). With the layer on, the code is E_INVALIDARG rather than the E_OUTOFMEMORY in the description; I did not run without it. `HostHeap::new` on the same card, one synthetic probe per head: | head | shader clamp bound | `new(false, 4)` | `new(false, 1_245_184)` | |---|---|---|---| | main `940d32f` | 2,097,152 | 65,540 slots | 1,000,000 slots | | this PR `43aa1b2` | 524,288 | 851,968 slots | `None` | | #2185 `9518df8` | 1,000,000 (runtime) | 1,000,000 | 1,000,000 (934,461 title slots kept) | | #2177 `d15c68b` | 1,000,000 (runtime) | 1,000,000 | 1,000,000 (844,349 title slots kept) | So on NVIDIA hardware main's mismatch is real (clamp above the heap in both cases), and this PR closes it for small titles. But a title that declares more than the ceiling now gets no view heap at all, where main, #2185 and #2177 cap it at 1,000,000. That matches the WARP result above. I did not test a shader read past the cap on any head. AI-assisted; synthetic probe only. Probe source available on request.
Author
Owner

@⁠Marvisak on GitHub · 2026-11-25 15:26 UTC · original

Automated triage for the maintainers.

Proposed close. Thanks for the measurements; the mismatch on NVIDIA is real (the clamp bound is above the heap the host gives), but this fix makes things worse elsewhere:

  • HostHeap::new in descriptor/host.rs now returns None (no view heap at all) whenever max(count, HEAP_VIEWS) + PAIR_RESERVE > PORTABLE_VIEWS, i.e. for any title heap above about 934K slots, where main caps it at 1,000,000. The title is reported to use slots past 1,236,191 (#2185), so it would lose its heap entirely; two contributors reproduced this here, on WARP and an RTX 3050 (new(false, 1_245_184) gives None).
  • D3D12 does not give 1,000,000 on every binding tier: Tier 3 drivers may take more (WARP takes 2,097,152). Lowering HEAP_VIEWS to 1 << 19 for everyone clamps reachable title indices on hosts that work today.
  • The long rationale comments in shader.rs and host.rs go against the repo's short-docs rule.

#2177 and #2185 address the same ceiling with a runtime probe and a capped fallback that keeps the larger Tier 3 path; please continue there, or rework this to probe the host instead of fixing a smaller constant. CI: not run.

This PR will be closed in 48 hours unless the author pushes a change or a maintainer removes the label.


Generated by Claude Code

**@⁠Marvisak** on GitHub · 2026-11-25 15:26 UTC · [original](https://github.com/Marvisak/VIctory/pull/2315#issuecomment-7166846929) <!-- victory-triage v1 head=43aa1b2d80039432dbf052d00b87b86ff5de80dd verdict=proposed-close at=2026-11-25T15:26:00Z --> Automated triage for the maintainers. **Proposed close.** Thanks for the measurements; the mismatch on NVIDIA is real (the clamp bound is above the heap the host gives), but this fix makes things worse elsewhere: - `HostHeap::new` in `descriptor/host.rs` now returns `None` (no view heap at all) whenever `max(count, HEAP_VIEWS) + PAIR_RESERVE > PORTABLE_VIEWS`, i.e. for any title heap above about 934K slots, where `main` caps it at 1,000,000. The title is reported to use slots past 1,236,191 (#2185), so it would lose its heap entirely; two contributors reproduced this here, on WARP and an RTX 3050 (`new(false, 1_245_184)` gives `None`). - D3D12 does not give 1,000,000 on every binding tier: Tier 3 drivers may take more (WARP takes 2,097,152). Lowering `HEAP_VIEWS` to `1 << 19` for everyone clamps reachable title indices on hosts that work today. - The long rationale comments in `shader.rs` and `host.rs` go against the repo's short-docs rule. #2177 and #2185 address the same ceiling with a runtime probe and a capped fallback that keeps the larger Tier 3 path; please continue there, or rework this to probe the host instead of fixing a smaller constant. CI: not run. This PR will be closed in 48 hours unless the author pushes a change or a maintainer removes the label. --- _Generated by [Claude Code](https://claude.ai/code)_
Author
Owner

@⁠xiaotu030202 on GitHub · 2026-11-25 15:35 UTC · original

The triage is right on all three points, and I am closing this rather than reworking it.

I checked each claim against the diff before agreeing:

  1. None instead of a heap. HostHeap::new in descriptor/host.rs does:

    let least = needed.saturating_add(pair_room);
    if least > PORTABLE_VIEWS {
        tracing::warn!(count, views, "title view heap needs more slots than the host allows");
        return None;
    }
    

    A title declaring 1,245,184 slots gets least = 1,245,184 + 65,536 > 1,000,000, so it takes that branch and the process runs with no view heap at all. main caps the heap at 1,000,000 and keeps going. The WARP result and @⁠Dathinel's RTX 3050 result are both that branch, and I had not run either case.

  2. HEAP_VIEWS = 1 << 19 is a global loss. It was 1 << 21 = 2,097,152. On a Tier 3 driver that really does hand out 2,097,152 (WARP, per the table above), shaders can now name only a quarter of what the heap holds — so this "fix" clamps reachable indices on hosts that work today. That is worse than the mismatch it was aimed at.

  3. The comments. Fair. shader.rs and host.rs both carry multi-paragraph rationale that belongs in a PR description, not in the tree.

What I still think was worth measuring, and where it belongs.

The invariant this PR was trying to state is:

the index bound the translator clamps to must not exceed the number of title slots the host heap actually got

On main that is violated in both directions — new(false, 4) returns 65,540 slots against a bound of 2,097,152 — which is the NVIDIA fault I measured. But a fixed bound cannot satisfy it, because the number of slots is a runtime property of the driver and the binding tier. #2177 and #2185 set the bound from the heap at runtime, which is the only shape that satisfies it, and their own tables show a 1,000,000 heap with 934,461 and 844,349 title slots kept where mine returns None.

So I am not reworking this: a third runtime probe would duplicate #2177/#2185 rather than add to them, and that is the same mistake I made earlier on this account — opening a patch for something two other PRs had already covered.

Where the measurement goes. My original number (1,048,576 → E_OUTOFMEMORY 0x8007000E on an RTX 5070 Ti) is now confirmed three ways — @⁠andrewpozdnakov7-jpg on WARP Tier 3, @⁠Dathinel on Ampere with the debug layer naming the 1,000,000 limit explicitly, and this triage — so it needs no PR to be useful. I will put the invariant and the two-sided table on #2185 as a comment rather than a diff.

Thanks for reading it closely enough to find the regression; a synthetic-only patch that turns a clamp into a refusal should not have been opened without running the above-ceiling case, and I did not run it.

**@⁠xiaotu030202** on GitHub · 2026-11-25 15:35 UTC · [original](https://github.com/Marvisak/VIctory/pull/2315#issuecomment-7167069500) The triage is right on all three points, and I am closing this rather than reworking it. **I checked each claim against the diff before agreeing:** 1. **`None` instead of a heap.** `HostHeap::new` in `descriptor/host.rs` does: ```rust let least = needed.saturating_add(pair_room); if least > PORTABLE_VIEWS { tracing::warn!(count, views, "title view heap needs more slots than the host allows"); return None; } ``` A title declaring 1,245,184 slots gets `least = 1,245,184 + 65,536 > 1,000,000`, so it takes that branch and the process runs with **no view heap at all**. `main` caps the heap at 1,000,000 and keeps going. The WARP result and @⁠Dathinel's RTX 3050 result are both that branch, and I had not run either case. 2. **`HEAP_VIEWS = 1 << 19` is a global loss.** It was `1 << 21` = 2,097,152. On a Tier 3 driver that really does hand out 2,097,152 (WARP, per the table above), shaders can now name only a quarter of what the heap holds — so this "fix" clamps reachable indices on hosts that work today. That is worse than the mismatch it was aimed at. 3. **The comments.** Fair. `shader.rs` and `host.rs` both carry multi-paragraph rationale that belongs in a PR description, not in the tree. **What I still think was worth measuring, and where it belongs.** The invariant this PR was trying to state is: > the index bound the translator clamps to must not exceed the number of title slots the host heap actually got On `main` that is violated in both directions — `new(false, 4)` returns 65,540 slots against a bound of 2,097,152 — which is the NVIDIA fault I measured. But a **fixed** bound cannot satisfy it, because the number of slots is a runtime property of the driver and the binding tier. #2177 and #2185 set the bound from the heap at runtime, which is the only shape that satisfies it, and their own tables show a 1,000,000 heap with 934,461 and 844,349 title slots kept where mine returns `None`. So I am not reworking this: a third runtime probe would duplicate #2177/#2185 rather than add to them, and that is the same mistake I made earlier on this account — opening a patch for something two other PRs had already covered. **Where the measurement goes.** My original number (1,048,576 → `E_OUTOFMEMORY` 0x8007000E on an RTX 5070 Ti) is now confirmed three ways — @⁠andrewpozdnakov7-jpg on WARP Tier 3, @⁠Dathinel on Ampere with the debug layer naming the 1,000,000 limit explicitly, and this triage — so it needs no PR to be useful. I will put the invariant and the two-sided table on #2185 as a comment rather than a diff. Thanks for reading it closely enough to find the regression; a synthetic-only patch that turns a clamp into a refusal should not have been opened without running the above-ceiling case, and I did not run it.

Pull request closed

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/Marvisak--VIctory!2315
No description provided.