Shaders: the null-buffer reads of the heap skip a host that caps its heaps #1943

Open
github-bot wants to merge 2 commits from github-bot/gh-1943 into main AGit
Owner

@⁠kais7654 on GitHub · 2026-11-25 01:32 UTC · original
kais7654:shader/stride-heap-cap → main · +69 −6 · 4 files · 2 commits · open

a_heap_buffer_read_where_no_buffer_view_is_reads_zerosnever ran on real hardware here: when a test's views end inView::NullBuffersthe dispatch creates the wholeHEAP_VIEWS-slot (2^21) shader-visible heap, because the null views have to sit at NULL_BUFFER_VIEW and one below — and the RTX 5070 laptop's driver refuses that heap outright (E_INVALIDARG, dispatch failed before its first draw). victory-gpu knows the limit: the same device caps shader-visible heaps at a million (PORTABLE_VIEWS`), the
tier-1 ceiling, and the game path works around it with root-view tables.

The host now asks the device once (Host::takes_the_whole_heap) and a test
whose views reach the heap's end prints so and runs where the slots exist.
On a machine without a GPU the hardware label is already skipped (0a..., on
main), WARP takes the heap and runs the check, and every device that can
hold the whole heap — discrete desktop GPUs included — keeps it unchanged.

Local: RTX 5070 Laptop GPU (driver 616.87, heap refused → skipped) and
WARP (runs, passes); clippy -D warnings on both passes.

AI-assisted (Mistral Vibe).

**@⁠kais7654** on GitHub · 2026-11-25 01:32 UTC · [original](https://github.com/Marvisak/VIctory/pull/1943) `kais7654:shader/stride-heap-cap` → `main` · +69 −6 · 4 files · 2 commits · open a_heap_buffer_read_where_no_buffer_view_is_reads_zeros` never ran on real hardware here: when a test's views end in `View::NullBuffers` the dispatch creates the whole `HEAP_VIEWS`-slot (2^21) shader-visible heap, because the null views have to sit at `NULL_BUFFER_VIEW` and one below — and the RTX 5070 laptop's driver refuses that heap outright (`E_INVALIDARG`, dispatch failed before its first draw). `victory-gpu` knows the limit: the same device caps shader-visible heaps at a million (`PORTABLE_VIEWS`), the tier-1 ceiling, and the game path works around it with root-view tables. The host now asks the device once (`Host::takes_the_whole_heap`) and a test whose views reach the heap's end prints so and runs where the slots exist. On a machine without a GPU the hardware label is already skipped (0a..., on main), WARP takes the heap and runs the check, and every device that can hold the whole heap — discrete desktop GPUs included — keeps it unchanged. Local: RTX 5070 Laptop GPU (driver 616.87, heap refused → skipped) and WARP (runs, passes); clippy `-D warnings` on both passes. AI-assisted (Mistral Vibe).
A heap-buffer read of a slot that holds no view reads the host's null
views, which sit at the end of the whole HEAP_VIEWS-slot heap: a heap
the RTX 5070 laptop's driver refuses (Paramètre incorrect, its
shader-visible heaps stop at the million `victory-gpu` caps them to, the
game path short of the same limitation). The dispatch then died before
its first draw. The host now asks once whether the device takes the
whole heap, and a test whose views reach the heap's end says so and runs
where the slots exist; WARP and every other machine keeps the check.

Generated by Mistral Vibe.
Co-Authored-By: Mistral Vibe <[email protected]>
The descriptor and memory tests assert a host heap of every slot a
shader indexes (HEAP_VIEWS, HEAP_SAMPLERS) and a copy's views in the
pair range past the dynamic slots — both gone where the host caps its
shader-visible heaps (NVIDIA, HostHeap::new's shortcut): the heap is
smaller and the pair range is empty, so the pairs come from the
dynamic slots and both tests failed on a machine the runtime itself
runs fine on (#1744). The size and pair-range assertions say so and
skip there; WARP and every other machine keeps them.

Generated by Mistral Vibe.
Co-Authored-By: Mistral Vibe <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 04:49:35 +00:00
Author
Owner

@⁠Marvisak on GitHub · 2026-11-25 08:19 UTC · original · edited 2026-11-25 14:52 UTC

Automated triage for the maintainers.

Needs work. Re-reviewed at 9825382.

The first part is unchanged and still fine: Host::takes_the_whole_heap in crates/victory-shader/src/emit/host.rs tries a shader-visible heap of HEAP_VIEWS slots, and a_heap_buffer_read_where_no_buffer_view_is_reads_zeros (stride_tests.rs) skips a device that refuses it. That test harness really needs the whole heap for View::NullBuffers, and WARP still runs the check.

The new commit is the problem. It makes two victory-gpu tests skip their assertions on a capped host:

  • descriptor::host::tests::dynamic_slots_are_held_until_released no longer checks the heap sizes when the device caps its shader-visible heaps;
  • memory::tests::lists_share_a_table_and_copies_keep_their_views no longer checks that the copies' views sit in the pair range (pair_base).

Those two failures are a real runtime gap, not only a test-host limit. On a capped host, HostHeap::new falls back to MIN_DYNAMIC (your own run shows a 65,540-slot view heap: 4 title slots plus 65,536), and #1751 (open, merge candidate) fixes exactly that in HostHeap::new by trying PORTABLE_VIEWS with the full dynamic range, which makes both tests pass on NVIDIA. With this commit, the tests would go green on the hosts where that fix is missing, and they would conflict with #1751's own change to dynamic_slots_are_held_until_released.

What would change the verdict: drop the victory-gpu commit (descriptor/host.rs, memory.rs) and keep the victory-shader part, which was a merge candidate as it stood.

Reply to @⁠kais7654: thanks for extending it, and for the Arc B580 confirmation from @⁠borosf. The stride test skip is the right shape for the test harness; for the two victory-gpu tests, the fix belongs in the runtime (#1751), not in the tests.

CI: passing (check).


Generated by Claude Code

**@⁠Marvisak** on GitHub · 2026-11-25 08:19 UTC · [original](https://github.com/Marvisak/VIctory/pull/1943#issuecomment-7156894916) · edited 2026-11-25 14:52 UTC <!-- victory-triage v1 head=9825382ade8e41414053dc19c47d0502d43de069 verdict=needs-work at=2026-11-25T14:52:40Z --> Automated triage for the maintainers. **Needs work.** Re-reviewed at `9825382`. The first part is unchanged and still fine: `Host::takes_the_whole_heap` in `crates/victory-shader/src/emit/host.rs` tries a shader-visible heap of `HEAP_VIEWS` slots, and `a_heap_buffer_read_where_no_buffer_view_is_reads_zeros` (`stride_tests.rs`) skips a device that refuses it. That test harness really needs the whole heap for `View::NullBuffers`, and WARP still runs the check. The new commit is the problem. It makes two `victory-gpu` tests skip their assertions on a capped host: - `descriptor::host::tests::dynamic_slots_are_held_until_released` no longer checks the heap sizes when the device caps its shader-visible heaps; - `memory::tests::lists_share_a_table_and_copies_keep_their_views` no longer checks that the copies' views sit in the pair range (`pair_base`). Those two failures are a real runtime gap, not only a test-host limit. On a capped host, `HostHeap::new` falls back to `MIN_DYNAMIC` (your own run shows a 65,540-slot view heap: 4 title slots plus 65,536), and #1751 (open, merge candidate) fixes exactly that in `HostHeap::new` by trying `PORTABLE_VIEWS` with the full dynamic range, which makes both tests pass on NVIDIA. With this commit, the tests would go green on the hosts where that fix is missing, and they would conflict with #1751's own change to `dynamic_slots_are_held_until_released`. What would change the verdict: drop the `victory-gpu` commit (`descriptor/host.rs`, `memory.rs`) and keep the `victory-shader` part, which was a merge candidate as it stood. Reply to @⁠kais7654: thanks for extending it, and for the Arc B580 confirmation from @⁠borosf. The stride test skip is the right shape for the test harness; for the two `victory-gpu` tests, the fix belongs in the runtime (#1751), not in the tests. CI: passing (`check`). --- _Generated by [Claude Code](https://claude.ai/code)_
Author
Owner

@⁠sinan-cmyk on GitHub · 2026-11-25 11:16 UTC · original

Offline measurement on a retail dump

Result: no count change against main.

I merged head 7f67667c onto main 940d32f (clean merge) and ran victory translate --validate --list on shaders.rpf (1.0.2.1), with dxil.dll 1.8.2502.11. I compared the result with main program by program (25,889 programs). Validated: 23,918 on main, 23,918 with this PR.

No program changes its failure reason. The count shows that the change rejects nothing on this data. It does not show whether the output is right.

No shader names or data are included, per the asset policy. AI-assisted (Claude Code).

**@⁠sinan-cmyk** on GitHub · 2026-11-25 11:16 UTC · [original](https://github.com/Marvisak/VIctory/pull/1943#issuecomment-7160830089) ### Offline measurement on a retail dump **Result: no count change against `main`.** I merged head 7f67667c onto `main` 940d32f (clean merge) and ran `victory translate --validate --list` on `shaders.rpf` (1.0.2.1), with dxil.dll 1.8.2502.11. I compared the result with `main` program by program (25,889 programs). Validated: 23,918 on `main`, 23,918 with this PR. No program changes its failure reason. The count shows that the change rejects nothing on this data. It does not show whether the output is right. No shader names or data are included, per the asset policy. AI-assisted (Claude Code).
Author
Owner

@⁠borosf on GitHub · 2026-11-25 11:46 UTC · original

Verified on the branch on an Intel Arc B580 (Xe2, SM 6.7, discrete, main 940d32f +
this branch): a_heap_buffer_read_where_no_buffer_view_is_reads_zeros passes — the leg
the card cannot take is skipped and the remaining run completes.

Baseline for context, on the same card on 940d32f without this PR: the test fails with
hardware: dispatch failed: The parameter is incorrect, and victory-gpu on the same
machine confirms the cause: shader-visible view heaps top out at 1,000,000 — the same
cap Intel UHD reports in #1829, so this driver enforces the tier limit exactly. With the
RTX 4070 Ti result above, that makes three vendors where the failure is real and this
skip is the right shape.

**@⁠borosf** on GitHub · 2026-11-25 11:46 UTC · [original](https://github.com/Marvisak/VIctory/pull/1943#issuecomment-7161478380) Verified on the branch on an **Intel Arc B580** (Xe2, SM 6.7, discrete, main `940d32f` + this branch): `a_heap_buffer_read_where_no_buffer_view_is_reads_zeros` passes — the leg the card cannot take is skipped and the remaining run completes. Baseline for context, on the same card on `940d32f` without this PR: the test fails with `hardware: dispatch failed: The parameter is incorrect`, and `victory-gpu` on the same machine confirms the cause: shader-visible view heaps top out at **1,000,000** — the same cap Intel UHD reports in #1829, so this driver enforces the tier limit exactly. With the RTX 4070 Ti result above, that makes three vendors where the failure is real and this skip is the right shape.
Author
Owner

@⁠kais7654 on GitHub · 2026-11-25 13:56 UTC · original

Automated triage for the maintainers.

Merge candidate.

This adds Host::takes_the_whole_heap in crates/victory-shader/src/emit/host.rs. It tries to create a shader-visible view heap of HEAP_VIEWS slots. a_heap_buffer_read_where_no_buffer_view_is_reads_zeros in stride_tests.rs now skips a device that refuses that heap, and prints that it did.

The test harness on main really does need that heap: View::NullBuffers sizes the heap to HEAP_VIEWS. victory-gpu's HostHeap::new already treats the NVIDIA cap as a known shortcut. WARP still runs the check, so the test keeps checking the behaviour, and the ran > 0 assertion still holds.

This addresses only one of the three NVIDIA failures listed in #1744. a_heap_buffer_read_by_element_takes_the_views_stride and gathers_at_a_level_match_the_hardware are not touched.

CI: check passes.

Generated by Claude Code

@⁠Marvisak The two remaining victory-gpu failures of #1744 are covered too, at
9825382: dynamic_slots_are_held_until_released no longer asserts a heap
of HEAP_VIEWS / HEAP_SAMPLERS slots where the device caps its
shader-visible heaps (HostHeap::new's shortcut — it says so and skips
the two size assertions, the held-until-released checks still run), and
lists_share_a_table_and_copies_keep_their_views now checks the pairs
against the pair range only where the heap kept room for one — on a
capped heap the range is empty and HostHeap::pair hands the dynamic
slots out instead. On a machine behind the shortcut (RTX 5070 laptop,
driver 616.87) both skips ran — the view heap came out 65540 slots, the
samplers' 2048 — and the whole victory-gpu suite passes; on WARP and
any host that takes the whole heap the assertions are unchanged.

AI-assisted (Mistral Vibe).

**@⁠kais7654** on GitHub · 2026-11-25 13:56 UTC · [original](https://github.com/Marvisak/VIctory/pull/1943#issuecomment-7164521563) > Automated triage for the maintainers. > > **Merge candidate.** > > This adds `Host::takes_the_whole_heap` in `crates/victory-shader/src/emit/host.rs`. It tries to create a shader-visible view heap of `HEAP_VIEWS` slots. `a_heap_buffer_read_where_no_buffer_view_is_reads_zeros` in `stride_tests.rs` now skips a device that refuses that heap, and prints that it did. > > The test harness on `main` really does need that heap: `View::NullBuffers` sizes the heap to `HEAP_VIEWS`. `victory-gpu`'s `HostHeap::new` already treats the NVIDIA cap as a known shortcut. WARP still runs the check, so the test keeps checking the behaviour, and the `ran > 0` assertion still holds. > > This addresses only one of the three NVIDIA failures listed in #1744. `a_heap_buffer_read_by_element_takes_the_views_stride` and `gathers_at_a_level_match_the_hardware` are not touched. > > CI: `check` passes. > > _Generated by [Claude Code](https://claude.ai/code)_ @⁠Marvisak The two remaining victory-gpu failures of #1744 are covered too, at 9825382: dynamic_slots_are_held_until_released no longer asserts a heap of HEAP_VIEWS / HEAP_SAMPLERS slots where the device caps its shader-visible heaps (HostHeap::new's shortcut — it says so and skips the two size assertions, the held-until-released checks still run), and lists_share_a_table_and_copies_keep_their_views now checks the pairs against the pair range only where the heap kept room for one — on a capped heap the range is empty and HostHeap::pair hands the dynamic slots out instead. On a machine behind the shortcut (RTX 5070 laptop, driver 616.87) both skips ran — the view heap came out 65540 slots, the samplers' 2048 — and the whole victory-gpu suite passes; on WARP and any host that takes the whole heap the assertions are unchanged. AI-assisted (Mistral Vibe).
Author
Owner

@⁠kais7654 on GitHub · 2026-11-25 13:59 UTC · original

Verified on the branch on an Intel Arc B580 (Xe2, SM 6.7, discrete, main 940d32f + this branch): a_heap_buffer_read_where_no_buffer_view_is_reads_zeros passes — the leg the card cannot take is skipped and the remaining run completes.

Baseline for context, on the same card on 940d32f without this PR: the test fails with hardware: dispatch failed: The parameter is incorrect, and victory-gpu on the same machine confirms the cause: shader-visible view heaps top out at 1,000,000 — the same cap Intel UHD reports in #1829, so this driver enforces the tier limit exactly. With the RTX 4070 Ti result above, that makes three vendors where the failure is real and this skip is the right shape.

@⁠borosf Thanks for checking — good to have the tier limit confirmed on a third
vendor. A data point from the machine this branch came from (RTX 5070
Laptop GPU, driver 616.87, Windows 11): there the skip runs too — the
view heap comes out 65540 slots (4 + 65536, HostHeap::new's shortcut)
and the samplers' 2048 — so the 2,097,152-slot heap is refused there
as well; that shortcut only shows the refusal, the exact cap below not.

AI-assisted (Mistral Vibe).

**@⁠kais7654** on GitHub · 2026-11-25 13:59 UTC · [original](https://github.com/Marvisak/VIctory/pull/1943#issuecomment-7164575455) > Verified on the branch on an **Intel Arc B580** (Xe2, SM 6.7, discrete, main `940d32f` + this branch): `a_heap_buffer_read_where_no_buffer_view_is_reads_zeros` passes — the leg the card cannot take is skipped and the remaining run completes. > > Baseline for context, on the same card on `940d32f` without this PR: the test fails with `hardware: dispatch failed: The parameter is incorrect`, and `victory-gpu` on the same machine confirms the cause: shader-visible view heaps top out at **1,000,000** — the same cap Intel UHD reports in #1829, so this driver enforces the tier limit exactly. With the RTX 4070 Ti result above, that makes three vendors where the failure is real and this skip is the right shape. @⁠borosf Thanks for checking — good to have the tier limit confirmed on a third vendor. A data point from the machine this branch came from (RTX 5070 Laptop GPU, driver 616.87, Windows 11): there the skip runs too — the view heap comes out 65540 slots (4 + 65536, HostHeap::new's shortcut) and the samplers' 2048 — so the 2,097,152-slot heap is refused there as well; that shortcut only shows the refusal, the exact cap below not. AI-assisted (Mistral Vibe).
Author
Owner

@⁠kais7654 on GitHub · 2026-11-25 14:01 UTC · original

Offline measurement on a retail dump

Result: no count change against main.

I merged head 7f67667 onto main 940d32f (clean merge) and ran victory translate --validate --list on shaders.rpf (1.0.2.1), with dxil.dll 1.8.2502.11. I compared the result with main program by program (25,889 programs). Validated: 23,918 on main, 23,918 with this PR.

No program changes its failure reason. The count shows that the change rejects nothing on this data. It does not show whether the output is right.

No shader names or data are included, per the asset policy. AI-assisted (Claude Code).

@⁠sinan-cmyk Thanks — good to know the change rejects nothing on retail data. Note
the PR head has moved to 9825382 since, but that commit only touches
victory-gpu tests, so the translation result holds for it as well.

AI-assisted (Mistral Vibe).

**@⁠kais7654** on GitHub · 2026-11-25 14:01 UTC · [original](https://github.com/Marvisak/VIctory/pull/1943#issuecomment-7164637108) > ### Offline measurement on a retail dump > **Result: no count change against `main`.** > > I merged head [7f67667](https://github.com/Marvisak/VIctory/commit/7f67667c238869561ba42bc2bd191b689a761f01) onto `main` [940d32f](https://github.com/Marvisak/VIctory/commit/940d32f69b22265690a0b5a15d6ded572ba33baf) (clean merge) and ran `victory translate --validate --list` on `shaders.rpf` (1.0.2.1), with dxil.dll 1.8.2502.11. I compared the result with `main` program by program (25,889 programs). Validated: 23,918 on `main`, 23,918 with this PR. > > No program changes its failure reason. The count shows that the change rejects nothing on this data. It does not show whether the output is right. > > No shader names or data are included, per the asset policy. AI-assisted (Claude Code). @⁠sinan-cmyk Thanks — good to know the change rejects nothing on retail data. Note the PR head has moved to 9825382 since, but that commit only touches victory-gpu tests, so the translation result holds for it as well. AI-assisted (Mistral Vibe).
This pull request can be merged automatically.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/1943/head:github-bot/gh-1943'
git switch 'github-bot/gh-1943'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-1943'
git switch 'github-bot/gh-1943'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-1943'
git switch 'github-bot/gh-1943'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-1943'
git switch 'main'
git merge --squash 'github-bot/gh-1943'
git switch 'main'
git merge --ff-only 'github-bot/gh-1943'
git switch 'main'
git merge 'github-bot/gh-1943'
git push origin 'main'
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!1943
No description provided.