Skip to content

GPU: report the view heap sizes when the host caps one - #35

Closed
WallasSCRIPTS wants to merge 1 commit into
Marvisak:mainfrom
WallasSCRIPTS:gpu/view-heap-past-report
Closed

WallasSCRIPTS wants to merge 1 commit into
Marvisak:mainfrom
WallasSCRIPTS:gpu/view-heap-past-report

Conversation

@WallasSCRIPTS

@WallasSCRIPTS WallasSCRIPTS commented Nov 23, 2026 •

Copy link
Copy Markdown

Relates to #16 and #11.

What

When the host cannot make a view heap as large as the title asked for, it
caps it and keeps PORTABLE_VIEWS - DYNAMIC slots. The warning named only
the resulting size, so the number of title slots lost was invisible. This
reports three numbers at creation: what the title asked for, what the host
made, and the difference.

The earlier version of this PR also reported out-of-range reads from
mirror(). On main, mirror() already logs the highest past-heap slot,
and #21 remaps the root tables that reach past the cap. Two reports of the
same reads would overlap, so that part is gone. One report, one place.

Doc corrections

docs/view-heap-limit.md now reflects #21 landing: root tables are made
afresh in the dynamic area, State::tables does that when a table holds a
constant buffer or an entry past the host heap (there is no 16-descriptor
rule), and #16 is the RTX 5070 Ti report, not the RX 7600 this was built on.
The sampler heap's 2,048-entry limit is left for a separate issue.

Verification

Static review only; no NVIDIA host here.

@Sunkiller-qc

Copy link
Copy Markdown

Thanks, the heap-creation report (asked for / made / lost) is useful. Since #21 landed, mirror() already logs the highest past-heap slot (main descriptor/host.rs:312), so this conflicts and the two reports would overlap. Picking one would help. A few things in docs/view-heap-limit.md look outdated or off: lines 14-15 say nothing remaps, but #21 now remaps tables; line 25 says draw::tables copies "tables holding more than 16 descriptors", but it makes tables afresh when they hold a CBV or reach past the cap (there's no 16-descriptor rule); and line 68 puts the "machine that filed #16" as an RX 7600, while the PR text says #16 is an RTX 5070 Ti. The note that a sampler heap over 2,048 makes HostHeap::new return None is a good catch and might deserve its own issue. Static review, not built or run.

@WallasSCRIPTS
WallasSCRIPTS force-pushed the gpu/view-heap-past-report branch from 4974271 to 756ea50 Compare November 24, 2026 00:02
@WallasSCRIPTS WallasSCRIPTS changed the title GPU: report title descriptors past the host view heap's end GPU: report the view heap sizes when the host caps one Nov 24, 2026
@WallasSCRIPTS

Copy link
Copy Markdown
Author

Picked one: dropped the per-read report and kept the creation-time sizes
(asked for / made / lost). mirror() on main stays the single report for
past-heap slots.

Rebased onto 97c78d1 after #21 landed. The doc now says root tables are
remapped, describes State::tables correctly (CBV or a past-cap entry, no
descriptor-count rule), and attributes #16 to the RTX 5070 Ti. The
sampler-heap > 2,048 failure will go in its own issue.

cargo check -p victory-gpu --all-targets clean, cargo test -p victory-gpu
36 passed. Static only, as you noted — no NVIDIA host here to see the line
fire. Thanks for the review.

The cap warning only said how many descriptors the host made, so a capped
NVIDIA heap gave no clue how many title slots were lost. Report what the
title asked for, what the host made, and the difference.

This replaces the earlier per-read report: main now logs the highest
past-heap slot in mirror() and Marvisak#21 remaps the root tables that reach it,
so a second report of the same reads would only overlap.

docs/view-heap-limit.md is updated for Marvisak#21 landing: root tables are
remapped, State::tables makes tables afresh for a CBV or a past-cap entry
(no descriptor-count rule), and Marvisak#16 is an RTX 5070 Ti. The sampler heap's
2,048 limit is left as a separate issue.

Verified with cargo check -p victory-gpu --all-targets and cargo test
-p victory-gpu (36 passed).
@WallasSCRIPTS
WallasSCRIPTS force-pushed the gpu/view-heap-past-report branch from 756ea50 to df40f86 Compare November 24, 2026 00:26
@DaviTostes

Copy link
Copy Markdown

Tested df40f86 under Wine 11.22 + vkd3d-proton 3.1 on Arch Linux x86_64 (AMD RX 9060 XT, RADV 26.3.1), Windows build with cargo xwin ... --target x86_64-pc-windows-msvc: pass, no regression.\n\n- victory_gpu: 36 passed, 3 failed — the same three environment-only failures as main (argument_clamp_builds, a_rejected_blob_gives_an_empty_library, #128's VirtualQuery upload skip).\n\nNo game data used. AI-assisted (DeepSeek V4.1 Flash coding agent).

@Sunkiller-qc

Copy link
Copy Markdown

Thanks, the new version reads well, and the doc matches main now.

One small heads-up: if #135 lands, the capped heap keeps PORTABLE_VIEWS - DYNAMIC_CAPPED title slots, while made = PORTABLE_VIEWS - extra (descriptor/host.rs:97) still uses DYNAMIC, so the logged numbers would be off. Whichever merges second should adjust that line.

Static review, not built or run.

@WallasSCRIPTS

Copy link
Copy Markdown
Author

Superseded by #21 (merged), which makes tables past a capped host view heap afresh: the hang this diagnosed is now fixed rather than logged, so the reporting here has nothing left to say on a capped heap.

This branch is more than a hundred commits behind main. Its one piece nothing else carries is docs/view-heap-limit.md, the reasoning about SM 6.6 directly indexed heaps (ResourceDescriptorHeap): two heaps do not merge into one index space, so the remap that works for root descriptor tables cannot serve indices past the cap there. Nothing hits that path today; the note stands if something does. Closing rather than rebasing a log line.

muhammed-aksoy pushed a commit to muhammed-aksoy/VIctory that referenced this pull request Nov 24, 2026
zebraso pushed a commit to zebraso/VIctory that referenced this pull request Nov 25, 2026
Steenax6 added a commit to Steenax6/VIctory-NVID that referenced this pull request Nov 26, 2026
DispatchX(x, y, z, flags) with bit 5 of the console's dispatch initiator
(USE_THREAD_DIMENSIONS, 0x20; 0x8020 for 32-lane programs) gives thread
counts, not group counts. The flags were dropped and the counts run as
groups: the ray-tracing structure builder, which dispatches this way, ran
up to 64 times over and its box stages wrote empty nodes past their
structures into the title's own objects (2.2 GiB in one frame of a failed
run). That is the likely cause of the fault seconds after the first 3D
frame with VICTORY_BVH_BUILDER=1.

The host now runs ceil(threads / numthreads) groups per axis, from the
console program's group size (Translated::threads). A partial last group
runs whole: cutting its extra threads needs the thread count in the
translated program, which victory-shader has no place for yet. The first
such dispatch and every partial one are logged, and the frame line counts
them.

Sources: fxceless/victory-fork PR Marvisak#646 (mynzjerko; the conversion and its
test) and PR Marvisak#994 (PiloteCode), DexNom/VIctory bc3cd4b and PR Marvisak#35,
uiliannn/VItoriaBr 633ba6e, all GPL-3.0 forks of VIctory.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Steenax6 added a commit to Steenax6/VIctory-NVID that referenced this pull request Nov 26, 2026
…e count

DispatchX with USE_THREAD_DIMENSIONS counts threads; the console then
starts only the threads up to the count in the last group, its other
lanes off in EXEC from the start. Since 3c92819 the host ran the groups
that hold the threads, but the last one whole: its threads past the
count ran too (the "shortcut" in State::dispatch).

Every program of the structure builder (a spilled user-data table, the
programs that dispatch this way) now gets two instructions in front of
its code: v_cmp_gt_u32 vcc, ttmp15, v0 and s_and exec, exec, vcc. The
trap temporary is a new compute input, the threads left from the
group's first on: the dispatch's thread count (user data of the new
kind USER_DISPATCH_THREADS, which the host sets per dispatch, u32::MAX
for one of whole groups) less the group id times the group's width,
none past the count. The title's code runs unchanged behind it, so its
lane counts, saved EXECs and scans that turn every lane on see the
lanes the console's would, in every form the translator has; in the
paired form (wave64 programs on 32-lane hosts, VICTORY_WAVE_PAIRS) the
upper lanes take their own console thread ids. No thread leaves early,
so every barrier is reached as before. A card test runs a 64-lane
program in the paired form and a 32-lane one over two groups for 13
counts: each lane adds its wave's s_bcnt1 of EXEC, and only the
launched lanes add, counting only launched lanes.

The frame line now says how many partial groups were cut and how many
still run whole (a program without the entry code, or a group partial
in y or z, whose rows the builder does not have).

Only the builder's programs change (all 52 still emit, validate and get
pipelines with VICTORY_HOST_WAVE=32); they run only with
VICTORY_BVH_BUILDER=1. The shader cache must be warmed again.

After DexNom/VIctory PR Marvisak#35 (pr0vId3nce: EXEC masked by instructions
ahead of the program), with the count through a trap temporary instead
of a load of the spilled table; the host word as fxceless/victory-fork
PR Marvisak#994 (PiloteCode) and uiliannn/VItoriaBr 633ba6e pass it. All
GPL-3.0 forks of VIctory.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants