gpu: remap title view slots past capped host heaps #3518
No reviewers
Labels
No labels
accessibility
area: build
area: formats
area: gpu
area: loader
area: runtime
area: shader
bug
documentation
duplicate
enhancement
good first issue
gpu: amd
gpu: intel
gpu: nvidia
help wanted
host: wine
invalid
out of scope
question
request
run report
triage: confirmed
triage: has patch
triage: merge candidate
triage: needs info
triage: needs rebase
triage: needs work
triage: proposed close
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/Marvisak--VIctory!3518
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-3518"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
@danielibabet on GitHub · 2026-11-27 12:27 UTC · original
danielibabet:pr/capped-heap-remap→main· +961 −257 · 12 files · 1 commits · openHosts whose shader-visible CBV/SRV/UAV heaps stop at 1,000,000 descriptors (resource binding tier 2, e.g. NVIDIA) lost every title descriptor past the cap (the old
shortcut: descriptors past the host's limit are left out).What changes
Hostdetects a capped device once (aHEAP_VIEWSshader-visible heap fails;VICTORY_CAPPED_HEAP=1forces it).HostHeapon such hosts keeps 672,320 title slots 1:1 and maps active higher title slots into 262,144 physical overflow slots (LIFO free list, recycled when the title clears a slot). Strides, view marks, view addresses, read marks and deferred placed textures (make_read) all follow the physical slot.emit::Options::capped_heap: direct resource-heap indices (root type 5) go through a virtual→physical table, root SRVt254in the root CBV space (next toVIEW_STRIDES; noHostShaderfield or cache-format change), and heap indices / null buffer views clamp below 1,000,000. Uncapped hosts translate exactly as before.Tests (RTX 4070 + WARP)
emit::remap_tests: compute shader reading/writing at virtual heap slots 1,150,000 / 1,500,000 through the remap table; unmapped slot reads the null view.descriptor::host::remap_test: 1,245,184-slot title heap: overflow allocation, placed texture materialised through its physical slot, clear + reuse.diagnostics) andcargo xtask policyclean. (The fullvictory-shaderlib suite crashes locally indxil.dllvalidation onorigin/maintoo.)@oni-swr on GitHub · 2026-11-27 13:25 UTC · original
Independent WARP/CPU verification of #3518 at head
df88467b(base: main63bcca43, merge-base of this PR). Head re-checked unchanged just before posting.Setup: Windows 11 Pro 10.0.26200, AMD Ryzen 7 5700X3D, D3D12 WARP only (
VICTORY_WARP=1 VICTORY_D3D12_WARP=1, dxil.dll from the Windows SDK on PATH). Base and head were built in separate worktrees with separate target dirs, so the head binary is a fresh build. Test commands:cargo test -p victory-gpu --features diagnosticsandcargo test -p victory-shader --features diagnostics. Note thatvictory-gpuonly honoursVICTORY_D3D12_WARPwith--features diagnostics; without it the tests use the real adapter.VICTORY_CAPPED_HEAP=1The 4 victory-shader failures are the same set on both sides (
a_mask_joined_with_data_at_a_uniform_loop_is_its_number,gathers_at_a_level_match_the_hardware,permutes_mask_high_address_bits_and_divergent_branches,permutes_read_the_lane_named_and_zero_from_lanes_left_out), so they are baseline WARP lane failures, not caused by this PR. The two new tests pass:remapped_high_heap_indices_execute_above_portable_views_limitin victory-shader, andcapped_view_heap_remaps_high_slots_and_recycles_overflow_entriesin victory-gpu.Finding 1 (CI will fail): clippy
-D warningsfails on dead code.cargo clippy -p victory-shader --features diagnostics --all-targets -- -D warningsfails on the head and passes on base:emit_withnow callslower_with, so the non-test build has no caller forlower(only tests use it). CI runscargo clippy --workspace --all-targets --locked -- -D warnings, so it should fail there too. Fix: markloweras#[cfg(test)], or move it into the test modules.cargo clippy -p victory-gpupasses on the head.Finding 2 (test coverage): the victory-gpu cap test only runs the cap logic on a capped host.
descriptor/remap_test.rs:14returns early when!host.capped_heap. On WARP that flag only becomes true when the 2^21-slot probe heap fails to create, or whenVICTORY_CAPPED_HEAP=1is set. The test passes in the capped lane, where its asserts oncount,overflowanddynamicrun. A plain WARP run may therefore skip the body. Running CI-style lanes withVICTORY_CAPPED_HEAP=1would prevent a silent no-op. The victory-shader test does exercise the clamp and null-slot path on WARP, because the remap table is supplied directly.Diff review for the question "can remapped slots alias or index out of range": I found no bug.
direct..direct+OVERFLOW_VIEWS(direct = 1,000,000 - 65,536 - 262,144). Dynamic slots start above that, andNULL_RESERVEplus the null views stay at the top. The ranges are disjoint, andkept,strides,marksandaddressesare all sized tocount + overflow + dynamic.to_phys/to_titlepair kept under oneslotsmutex.write_remapis only called under that lock, so a slot cannot map to two titles. A freed slot resets itsremapentry toCAPPED_HEAP_VIEWS - 1(null).REMAP_VIEWS - 1before the table read, and the physical result clamps toheap_views - 1.AI-assisted: Claude Code, Claude Sonnet 5.5 (build/test orchestration and diff review; results above are from the actual runs).
@pickles976 on GitHub · 2026-11-27 13:48 UTC · original
Linux/Wine verification of exact head
df88467(base63bcca43), clean worktree. RTX 4060 Laptop 8 GiB (resource binding tier 2), NVIDIA 590.48.1, Wine 11.0, vkd3d-proton 3.2.0 diagnostic build2576c0b4adfae4a+(relaxed-vtable; not stock certification), DXVK vendor masking disabled. No title run.Leg 1 —
descriptor::host::remap_test::capped_view_heap_remaps_high_slots_and_recycles_overflow_entries1/1 pass (fresh 9.36 s compile, 0.74 s test;verify-pr3518-descriptor-natural-df88467-20261127T134719Z). Two silent-skip paths were made fail-closed for this run only (absent host panics;host.capped_heapprinted) and the source was restored afterwards: natural capped detection fires on this stack — the 1,000,000HEAP_VIEWSshader-visible heap creation fails andhost.capped_heap=truewithoutVICTORY_CAPPED_HEAP. Full body executed on the real adapter: 1,245,184-slot title heap; high slots 737,856 / 950,000 / 1,200,000 each mapped into the 262,144-slot overflow pool with correct stride/address/read state; placed texture at 1,210,000 deferred onmirror(false)and materialized through its physical overflow slot bymake_read; clear resets the virtual entry toCAPPED_HEAP_VIEWS - 1and returns the physical slot; next high slot reuses it (LIFO). No device removal.Leg 2 —
emit::remap_tests::remapped_high_heap_indices_execute_above_portable_views_limit1/1 pass (fresh 5.91 s compile, 1.31 s test;verify-pr3518-emit-remap-df88467-20261127T134738Z). Same fail-closed strengthening applied and restored. Both hardware legs created the remapped compute PSO and dispatched: virtual slot 1,150,000 read back[101, 202, 303, 404]through the remap table, unmapped virtual slot 1,800,000 read back zeros via the null view. Caveat: thewarp=trueleg is not real WARP here — Wine'sEnumWarpAdapterreturns the first hardware adapter, so it is a repeat NVIDIA leg, and theWARP must be availableassertion was unchanged.Scale context from this machine's title trials (context, not a matched measurement): a previous guarded run on a different stack measured
room=737853 views=1000000with 507,331title slot past the host heapevents, so a frame can plausibly want more than 262,144 simultaneously-live past-cap slots. The exhaustion path (descriptor/host.rs:983-993) warns once and returnsNone— the slot reads null, i.e. the pre-PR behavior — so degradation beyond the pool is bounded and observable via thehost view heap overflow slots exhaustedwarning. If title logs on tier-2 hosts show that warning, it would indicate the 1 << 18 pool needs to grow or spill to a second heap.Test-only probes restored; worktree left clean at the exact head. Evidence dirs and per-run
resources.jsonlunder.compat-runtime/logs/. Guarded scope: peak GPU 250 MiB, min available RAM 10,828 MiB, min disk 15.19 GiB. No gameplay, frame-time or black-frame claim — this PR removes the past-cap data loss, it does not establish that capped-heap nulls caused the black scene.AI-assisted verification, review-only; no direct PR contributions.
@AurumCarlos on GitHub · 2026-11-27 14:04 UTC · original · reviewed
UsedResource::lower_boundis used as a descriptor count, but it is the shader register (native.rs:416: "Shader register of the first descriptor read"; the FSPX test there readsu11at offset0x58withlower_bound: 11). Two places indraw.rsnow depend on the register number:draw.rs:1279:span = lower_bound - 1movesendforward byregister - 1slots. An entry whose own slot is belowhost.count()is still markedfresh(made again in dynamic slots on every draw) when its register is high, which uses up dynamic slots a capped host has few of.draw.rs:1318:n = offset / 8 + lower_bound. For thatu11entry,maincopies 12 records and this copies 22. In general it copiesregister - 1extra records past the last one the shader reads.Nothing in
UsedResourcegives a range's length, somain'soffset / 8 + 1is what's known. Suggested fix: go back tomain's two expressions in one helper used by both places, and add a test:with
let end = table + u64::from(u.table_offset_dwords) * 4;and.map(entry_slots). If the remap needs ranges longer than one record (arrays), that needs a count from the program's resource table, not the register.@pickles976 on GitHub · 2026-11-27 14:16 UTC · original
Follow-up title-path evidence on the same Wine/RTX 4060 Laptop host. This is not an exact PR-head run: local dirty integration = #3147
2eb38bb1+ #21014d8c89a+ this PRdf88467b, manually conflict-resolved to retain Wave64 lowering, format filtering, and capped-heap remapping. Relaxed-vtable diagnostic vkd3d build; unchanged 6,000 MiB GPU / 2,048 MiBMemAvailable/ 9 GiB scope guards.Before launch, the combined stack passed:
emit::wave64_tests: 11/11Fresh diagnostics release, reported 1920×1080, scripted A at 55 s. Run
20261127T141340Zstopped deliberately on the RAM guard at 88.31 s: 1,982.5 MiB available, 3,370 MiB GPU, 7,827.7 MiB scope (5,922.2 anon / 1,858.8 file including 1,837.9 shmem), 14.976 GiB disk, exit 137. The 45 s capture is the account picker; after A, DirectStorage openedshared_minigame000andstory000packs, but the 90 s capture missed the already-killed client. No recognizable 3D scene/gameplay or performance claim.Descriptor observation: the prior same-lineage run had 507,331
title slot past the host heapevents. With this PR integrated, the log has oneand zero old past-cap warnings, zero
host view heap overflow slots exhausted, and zero dynamic-slot-exhaustion warnings. So remapping is active on the title path and the pool did not visibly exhaust before the RAM stop. This does not establish that past-cap nulls caused the missing scene; 74 distinct compute translation refusals remain, and the log records two black-after-nonblack transitions.I also saw AurumCarlos's new
UsedResource::lower_boundreview. Absence of exhaustion in this bounded run does not clear that register-vs-count defect. I would not promote or repeat the title stack until those two range expressions are corrected and covered by the proposedu11test.Local evidence:
.compat-runtime/logs/20261127T141340Z-{console.log,resources.csv,guard-events.jsonl}, capturemenu-20261127T141425337179Z.png, focused logsverify-scene3147-pr2101-pr3518-{shader-remap,gpu-remap,wave64,packed-lighting}.log.AI-assisted verification; review-only, no code contribution.
@oddmaniv on GitHub · 2026-11-27 14:22 UTC · original
Independent verification of the PR author's concurrent WARP pipeline/draw test at
df88467bb8a9f97b1cb4f0a9da83ea5be335b074.cargo test --locked -p victory-shader --lib emit::host::tests::parallel_warp_pipelines_and_draws -- --exact --nocaptureMain baseline pin:
63bcca43c6a00a758510398fa43096ce7e4f7df0.Windows x86_64 MSVC native runs. Local and remote source snapshots matched before and after each check. The adaptation applies the PR diff without additional source edits.
This is focused regression coverage, not the full workspace suite, a gameplay test, or an independent validation of every behavior in the PR. No new fix is claimed.
AI-assisted verification.
@borosf on GitHub · 2026-11-27 16:19 UTC · original
Numbers from a capped host that is not NVIDIA, in case they're useful for the body's "e.g. NVIDIA".
Intel Arc B580 12 GB, Windows 11 x64,
--console series-x. This device caps too, with the same error, and the title asks for more than one heap holds:In a single four-minute run through the prologue into the prison yard: 310,720
title slot past the host heapwarnings, one per newly-seen index, contiguous from 934,464 to the title's 1,245,183. That is 24.9 % of the title's view slots never bound — on this machine it is the class of failure behind missing textures, not a performance question at all.One interaction worth deciding before either merges, since you own both: on the same machine and the same tree, #3419's
capped_heap_slotsgiveskept=737856 extra=262144, i.e. refusals go 310,720 → 507,328 (it reserves 262,144 dynamic slots out of the same 1,000,000). #3518's own split is 672,320 1:1 plus a 262,144 overflow for title slots, so the two PRs put different arithmetic in the same place. If #3419 lands first, a capped host loses a further 196,608 title slots until this lands; if this lands first, #3419's sizing needs rewriting on top of it.If a run on this Arc at your head would help — bound/refused counts before and after, plus a screenshot of the yard — say the word and I'll do it. I'm not touching the code: the remap is yours.
AI use: Mistral Vibe (agent) — log counts on the machine above, no code.
@borosf on GitHub · 2026-11-27 16:36 UTC · original
Two things from the Arc, both reproducible: the red
check, and one bug in the remap.The failing test is not your logic — it is a race on frame.rs's globals.
frame::tests::waits_end_on_ticks_and_count_framesfails atframe.rs:231,left: 0, right: 1. Isolated, it passes 10/10 on your head (df88467) and 10/10 on its parent (63bcca4). In the full-p victory-gpu --libsuite it fails 2 of 8 runs on your head, and never in isolation. The counters it asserts on —FRAME,PRESENT_TICK,WAITS,LASTinframe.rs— are process-global, and yourdescriptor/remap_test.rstests make lists and frames on other test threads, so whichever runs alongside it moves the numbers. Astatic TEST_LOCKaround the frame tests, or reading only this thread's increments (the idiom #3224 just added forcopystat), would settle it. Worth saying: on this machine your head is cleaner than its parent, which fails 8/8 ondescriptor::host::tests::dynamic_slots_are_held_until_released(host.rs:2226) — your change fixes that one.The overflow pool runs out well before your title's space does. From a four-minute run through the prologue into the prison yard on the Arc:
Zero
title slot past the host heapwarnings — the remap does what it says, the old failure is gone. But the title's space reaches 1,245,183 and the pool is exhausted at 892,146, so roughly 353,000 high slots never map, now silently: recycled overflow is sized for the active set, and the active set here is larger than 262,144. Either the pool needs to grow out of the 1,000,000 budget the direct slots don't use, or exhaustion should log a rate-limited count of the slots it left unmapped rather than one line.AI use: Mistral Vibe (agent) — builds, suite runs and in-world log counts on Windows 11 x64, Intel Arc B580.
@Jishnuraj07 on GitHub · 2026-11-27 18:18 UTC · original
Verification on NVIDIA GeForce RTX 5060 8 GB (Blackwell), driver 32.0.16.2112, native Windows 11 Pro 10.0.26200, rustc 1.98.1 (MSVC). Head
df88467, basemain63bcca4. No game files; library tests only.main63bcca4df88467cargo clippy -p victory-gpu -p victory-shader --all-targets --locked -- -D warningscargo test -p victory-gpu --lib --lockedcargo test -p victory-shader --lib --locked -- --test-threads=1 --skip heap_direct_texture_reads_mark_their_heap_indexmain(dynamic_slots_are_held_until_releasedathost.rs:2226,lists_share_a_table_and_copies_keep_their_viewsat "past the dynamic slots") pass here, and so does the newremap_test.mainfails with this PR.victory-shaderfailures are the same on both, with identical output:a_heap_buffer_read_by_element_takes_the_views_stride([101, 104, 107, …]),a_heap_buffer_read_where_no_buffer_view_is_reads_zeros("The parameter is incorrect") andgathers_at_a_level_match_the_hardware(lane 0). These are the ones in #3445. The second one uses the test host's own heap (emit/host.rs), notHostHeap, so this PR isn't expected to change it.heap_direct_texture_reads_mark_their_heap_indexis skipped because it crashes the test binary with0xc0000005onmaintoo (the zero-length root-constants pointer reported in #3445). Without the skip, the binary stops after 78 tests.No title run.
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.