victory-gpu: 16-bit packed colour widens for the host (the second crash between the account screen and gameplay), and the two tools it took #2936
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!2936
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-2936"
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?
@pes7 on GitHub · 2026-11-26 00:48 UTC · original
pes7:fix/prologue→main· +645 −38 · 13 files · 29 commits · openWhat is left after the null-alias fix was merged upstream (
219878a, "GPU: a null shader view has no alias source"): the second crash that stood between the account screen and gameplay, and the two tools this needed. Rebased ontomain(63bcca4); the branch is now only these three commits.b1ec6e0pc_format, the one function resources, views, twins and pipeline target formats all go throughDXGI_ERROR_INVALID_CALLon a typed UAV of B5G5R5A1 and on a B4G4R4A4 render target; with it the title reaches gameplay - 2 555 draws a frame, 8 137 at the widestb1ec6e0fail()drains the D3D12 debug layer's stored messagesID3D12Device::CreateUnorderedAccessView: ...) instead of onlyDXGI_ERROR_INVALID_CALL2e15dc6VICTORY_DUMP_SHADER=<hash>writes that shader's translated DXIL to%TEMP%\victory-<hash>.dxilfordxc -dumpbinThe prologue then runs at 1.0-2.4 fps (867-1006 ms a frame, 683-807 ms of it on the GPU, 372-508 draws a frame dropped while their pipelines are made, 4 481 host textures / 6 050 MB). Those numbers, and the way
VICTORY_SHADER_LOOP_LIMIT=16moves the GPU term to 147-370 ms, are in the comments below - that is the next piece of work, not this PR.Tests on this branch:
cargo test --release --workspace- 30 suites, all ok; clippy clean; builds with and without--features diagnostics.The title renders to a 2560x1440 B4G4R4A4_UNORM texture and makes a typed unordered view of a B5G5R5A1_UNORM one. D3D12 supports neither, and the debug layer says so while the run is going: CreateCommittedResource: A texture that has D3D12_RESOURCE_FLAG_ALLOW_RENDER_TARGET set ... must be created with a format that either can be used as a render target, or cast to a format that could be CreateUnorderedAccessView: The format (0x56, B5G5R5A1_UNORM) cannot be used with a Typed Unordered Access View. This is because the current graphics implementation does not even support this Format. RemoveDevice: DXGI_ERROR_INVALID_CALL so the run ended a minute after the account screen, in the first scene of the prologue, with the device removed. (The 16-bit render target's creation was already failing quietly - `no host texture` - and the unordered view above removed the device.) `pc_format` now widens B5G6R5, B5G5R5A1 and B4G4R4A4 (85, 86, 115) to B8G8R8A8_UNORM (87): the same channel order, legal for render targets, unordered access and shader reads, and it is the one function resources, views, twins and pipeline target formats all go through, so they agree. The title loses the console's 5 or 4 bits a channel, not the picture's layout. With it the title reaches gameplay and the numbers the frame report then prints for the first time: 2 555 draws a frame (before: the device was removed in the loading screen), 3 969 ms a frame, 1 674 draws dropped for want of a host pipeline, 621 MB of title memory copied and 139 MB of textures uploaded a frame. That frame's 3.6 s on the GPU is the next problem - and, being over the 2 s TDR, the next removal. Found with the debug layer (`VICTORY_D3D12_DEBUG=1`) in a diagnostics build: `fail()` now drains the layer's stored messages, which name the call instead of only its code.Two diagnostics (the `diagnostics` feature only) that answer why a cold shader cache costs the first gameplay frame 20-25 s: shader phases (us): stage=Cs blocks=1542 range=342 resource=99315 io=5255 emit=8126713 lowering passes: 74 blocks=1542 setup_us=5561 run_us=85672 - a translation is 74 % structurisation/resource tracing and 25 % lowering in the aggregate, but the *worst* shaders are lowering: 8.1 s of 8.2 s for the biggest one; - `emit::lower` re-runs the whole lowering once per phi that does not settle (`Stop::Retry`): 74 passes for one shader, 222 extra passes over 17 shaders in a batch of 1 725. At ~86 ms a pass on 1 542 blocks that is 6.7 s for one shader alone - the whole cold batch is 160 s of CPU across eight workers, 25 s of wall. Nothing changes in a release build (no `diagnostics`): the phases are `Instant`s behind `cfg` and the pass count is not compiled at all.`emit::lower` re-runs the whole lowering once per phi that does not settle (`Stop::Retry(Value, Why)`): the biggest shader in the prologue needs 74 passes of ~86 ms over 1 542 blocks, 6.7 s of a 8.1 s translation, and 222 extra passes over 17 of the 1 725 shaders a cold cache translates. `fill_phis` now catches the retry per phi, records the value, leaves a value of the phi's own type so the rest of the pass still reaches the other phis, and reports the whole list at the end; `lower` merges it into `bad` and keeps going only if something new appeared. Measured, same scenario, cold cache: before translations 1725 sum 235828 ms median 13 ms max 8030 ms passes>1 19 max passes 74 after translations 401 sum 30208 ms median 5 ms max 2559 ms passes>1 4 max passes 8 Soundness, because a phi marked `bad` is lowered as `Val::Missing` from then on and a placeholder can make another phi look unjoinable: the whole shader pack through `victory translate --list` (26 084 programs, 25 889 per-program outcome lines) gives **identical outcomes** on the two builds - same emitted/refused set (14 246/14 247 vertex and pixel, 2 658 of 2 682 compute, 8 765 of 8 765 mesh) and the same failure reasons, 0 differences between the sorted lines. Corpus wall time 47 s -> 44 s. That is outcome equality, not byte equality of the DXIL; the game run with the change also reached the same place as without it (the early device removals happen on both). cargo test --release --workspace: 30 suites, 0 failures; clippy -D warnings with and without the diagnostics feature.5319ffcc52toa1d566232aThe 6 s dispatch of \caa78b8ca62bc3d6\ binds neither a descriptor table (nothing printed) nor a root view (nothing printed either): its only bindings are the user-data dwords, which are now logged at submission - traced user data [compute caa78b8ca62bc3d6] user_data=[... 18816, 4294966592, 768 ...] traced user data [compute caa78b8ca62bc3d6] user_data=[... 27520, 4294966208, 1024 ...] 6 005 lines in one loading run, and the values are small and structured (an offset, a negative offset, a size: 18816 / -2048 / 768), not garbage. So the table the two searches walk is *title memory* (the page-table path), which puts the memory refresh and its withhold/miss accounting next in line.The title's 3 444 host copies of its memory span more than 1 030 distinct 256 MiB regions of its address space, while `CAPACITY` gave a list's page table room for 512 - "the world's ~4 100 copies use a few dozen", which held for the world and not for this title. Every region past the cap reads as absent, and the diagnostics said so plainly: title memory this frame: 18 447 withheld and 1 098.1 MB of views kept, missed 120 539 pages and 23 256 MiB regions with no copy A compute shader that searches a table in that memory then reads zeros, never matches its key and runs its loop to the 2^20 cap. The one that cost the loading its five seconds is `caa78b8ca62bc3d6` (64 threads, three nested loops), and with the capacity raised it does not appear in the slow-command report at all: before, CAPACITY 512 : dispatch 1x1x1 [compute caa78b8ca62bc3d6] 6 012.2 ms after, CAPACITY 2048: (below the report's threshold) loading run, no VICTORY_SKIP_PIPELINES and the default loop limit: 120 world frames, 0 device removals, the full 420 s window frames 1.8-2.6 s: GPU 1.2-1.7 s, copies 137-240 ms / 1.4-2.0 GB Until this, the prologue only ran with two dispatches skipped or with the loop limit cut to 1024 (both diagnostics); with the capacity raised it runs on an unmodified build. Cost: a table is `(CAPACITY + 1) * 32 KiB` beside the level-1 entries, so 67 MB instead of 17 MB per table, and the run keeps one or two of them. Raising it further only helps the remaining 6-19 regions and grows linearly, so the next change there is to allocate level-2 blocks per submission for the regions a submission's views reach, not a bigger constant. The corpus A/B is unchanged, as it must be - the translator is not touched: 25 889 per-program outcome lines, 0 differences, 47 s. cargo test --release --workspace: 30 suites, 0 failures; clippy -D warnings clean with diagnostics.@kotekompotek on GitHub · 2026-11-26 00:53 UTC · original
Substantial and mostly verified — the
HEAP_VIEWS= 1,000,000 change is the principled fix: translated shaders clamp heap indices below it,D3D12_MAX_SHADER_VISIBLE_DESCRIPTOR_HEAP_SIZE_TIER_2caps every creatable heap at 1,000,000, so a 1<<21 clamp could only ever produce out-of-heap reads (device removal), never a valid descriptor.NULL_RESERVEcorrectly protects the null-view pair on the capped path (MIN_DYNAMIC - 1024leaves slots 999,998/999,999 free exactly whereNULL_BUFFER_VIEWlands).Two things to untangle before merge:
The
alias_sourcehunk is already on main —placed.is_null()guard merged as219878a("a null shader view has no alias source", the #2847 crash class). Identical code and comment; a rebase will show it as an empty diff. Your earlier PR #2933 was the same change.Residual OOB on smaller heaps:
HEAP_VIEWS= 1M only putsNULL_BUFFER_VIEWinside the heap when the heap is actually ≥1M. On NVIDIA,make(count + MIN_DYNAMIC)succeeds for counts ≤934,464 — e.g. a 737,856-count title heap makes an 803,392-descriptor heap, where index 999,998 is still past the end (pairs_endfalls back tototal, the nulls are never written, and a clamped index still reads OOB). GTA6's own 934,464-count heap lands exactly atmake(1,000,000)so its crash is covered, but the title-side cap is only fully guaranteed on thePORTABLE_VIEWSarm. Possibly worthpairs_end/null placement attotal - 2whenHEAP_VIEWS > total— or a comment noting the smaller-heap case remains a documented shortcut.pc_format85/86/115→87 is the alternative shape of #2442's fix for the same crash class (B5G5R5A1 + typed UAV →DXGI_ERROR_INVALID_CALLremoval): yours widens the resource format at creation, #2442 keeps the format and stripsALLOW_UNORDERED_ACCESSwhere the host can't store typed. They're complementary rather than conflicting — worth a line in the PR description saying which case each covers (widening handles RT too; the flag strip handles formats that must keep their bit layout).@pes7 on GitHub · 2026-11-26 01:01 UTC · original
Progress log, continued (the branch is
fix/prologue, and this comment is the running record - evidence from actual runs, not intentions):#4 - the prologue now runs. With the two crashers fixed (#1, #2 above), the first gameplay frame is reached. It then hung the GPU within seconds: DRED breadcrumbs named it exactly -
and, with that one skipped (
VICTORY_SKIP_PIPELINES=00167d58cc5a78d7), the next run stopped at another:With both skipped the title plays: 37 consecutive world frames, 534-4434 draws a frame, 600-3227 ms a frame, and the run lasts until a third command of the same kind (still to identify).
#5 - the numbers that frame report finally gives (steady part of that run):
So the fps problem in the prologue is on the GPU (80 % of the frame), and separately 30 % of the draws are dropped because their host pipelines are still being made in that frame.
next, in this order: (a) rank the GPU work per command with
VICTORY_GPU_TIMINGduring these frames, (b) the dropped draws - their pipelines are made during the frame, so the same frame both stalls and drops, (c) the two hanging compute dispatches, which is a translation question (s_barrier-style waits are the known family, issue #1799).Everything above is one run away from reproducible:
drive4.ps1-style driver, Enter at 15 s/45 s/80 s/110 s (the account screen, then the menu's Start),VICTORY_SKIP_PIPELINES=<the two hashes>.@fuzeofficlal on GitHub · 2026-11-26 01:02 UTC · original
Code review and RTX 5090 + WARP check at head
0082b445a252againstmain(63bcca43c6a0):Several blocking issues here:
resource.rs:eca1d364(alias_sourcenull check) directly duplicates and conflicts with219878a0e775(GPU: a null shader view has no alias source), which is already onmain(along witha_null_view_has_no_alias_source).alias_source,NULL_RESERVE=1024, loweringHEAP_VIEWSto1_000_000, 16-bit format remapping, andlog_messageson device removal).BGRA8remapping (crates/victory-gpu/src/resource.rs:247:85 | 86 | 115 => 87) breaks byte width and pixel layout:85(B5G6R5_UNORM),86(B5G5R5A1_UNORM), and115(B4G4R4A4_UNORM) are 2 B/texel (resource.rs:127), whereas87(B8G8R8A8_UNORM) is 4 B/texel.texture.rs:696,788,813detiles raw 2-bpp title bytes straight into the 4-bppBGRA8host staging pitch without 16->32-bit pixel expansion, corrupting every row/channel.list.rs:725-795(upload) andlist.rs:853-903(read_back) pass 2-bpp title footprints into/out of a 4-bpp host texture, causing D3D12CopyTextureRegionformat-mismatch failures (DXGI_ERROR_INVALID_CALL).pipeline/host.rs:142(InputLayout) andtexture.rs:294(alias_copy) are also affected.NULL_BUFFER_VIEWoverlap (crates/victory-gpu/src/descriptor/host.rs:210):extra.min(total.saturating_sub(count).saturating_sub(NULL_RESERVE))assumesNULL_BUFFER_VIEWsits neartotal, whereas it is fixed atHEAP_VIEWS - 2 = 999_998. On Tier-3 GPUs that allowtotal > 1_000_000(e.g.count = 750_000,total = 1_012_144),count + extra = 1_011_120 > 999_998, placingNULL_BUFFER_VIEWinside the dynamic allocation range (see#2461for a fullview_heap_limit()solution that handles both 1M-capped and uncapped heaps).Recommend dropping the superseded
alias_sourcecommit and splitting any remaining independent fixes into focused PRs.@Marvisak on GitHub · 2026-11-26 01:14 UTC · original · edited 2026-11-26 08:26 UTC
Automated triage for the maintainers.
Needs work (unchanged blocker). The new head
652cd44reverts1e53e91, so thememory::CAPACITYchange is no longer in this PR. That's fine if you plan to send it as its own small PR, as suggested, with the doc comment and the memory cost stated. Your progress logs (parts 24 and 25) are useful context for that PR. Part 25 already notes that one run cannot show it removes the TDR.The blocker in this PR is still there.
resource.rspc_formatmaps85 | 86 | 115 => 87for every use. That puts 2-byte texels into a 4-byte host format, and nothing converts them on upload or read-back, so the title's data and the host texture disagree in size and layout. Please replace this with a use-dependent path that converts the texels, or drop the commit. Also still open: indraw.rs,countforVICTORY_DUMP_ARGUMENTSis read eagerly, outside the deferred closure. The diagnostics commits would also be easier to review as their own PR.CI: passing.
Generated by Claude Code
@pes7 on GitHub · 2026-11-26 01:22 UTC · original
Progress log, part 3 - the first measured fps number and what moves it.
The frame's GPU cost is in the indirect dispatches. With the two hanging compute dispatches skipped (part 2), one more hash shows up at the top of the per-command ranking (
VICTORY_GPU_TIMING, 27 world frames):Skipping that one is worth ~2x on the real path (no debug layer, no per-command timing):
8bbcbda6008eaa37So one indirect command family is about half of the prologue's frame time, and the frame report's "on the GPU" tracks it exactly - it is not a CPU problem there.
The hang is not deterministic. The same build with the same skips ran 24 world frames and 60 s of gameplay in one run and was removed in the next, and the command named by the breadcrumbs changed when one was skipped (
00167d58cc5a78d7->f607780aa8e502d0->indirect [mesh c82b7a0b51f8f8a9, pixel e4d3d1ea315a7036]). That is the shape of a GPU-side wait on data that may not be there yet - the family issue #1799 describes - rather than one bad shader.Next: the traced-record dump (
VICTORY_TRACE_SHADERS=<hash>) prints what the indirect records actually ask for, which says whether the 400 ms is real work the title requests or our translation of it.Numbers above are one run each, but the two skip sets differ by exactly one hash and the frame's draw counts overlap, so the ~2x is not scene drift.
@pes7 on GitHub · 2026-11-26 01:37 UTC · original
Progress log, part 4 - the prologue's frame time and its hangs are the same thing: translated loops running to their limit.
The trace says the second most expensive GPU command asks for almost nothing:
746 groups of 64 threads, ~48 000 threads - and it costs 200-400 ms of the frame. So the work is not the title's; it is in the shader our translator emits. The project already has the instrument for exactly this:
VICTORY_SHADER_LOOP_LIMIT(emit::loop_limit,lower::LOOP_LIMIT = 1 << 20- "data the host has not mirrored yet (a null view reads zeros) can make that four billion iterations, which hangs the host GPU until the driver resets it").Same run, same two skipped hashes, only
VICTORY_SHADER_LOOP_LIMIT=16:end: no crashSo with the loops cut short the GPU term drops 2-4x and the run stops crashing entirely (it ran the whole 260 s window). The picture is wrong at 16 iterations, of course - this is the diagnostic, not the fix - but it says the prologue's fps and its "GPU hangs" have one root: a translated loop whose data-driven bound does not terminate as the console's does, so a lane burns up to a million iterations per entry, and a dispatch with tens of thousands of lanes takes hundreds of milliseconds (and, sometimes, over the 2 s TDR).
Next: find which loop. The shader is named by the trace above (
8bbcbda6008eaa37) and the hang by the breadcrumbs; the emitters' loop lowering (lower.rs, the phi-based counters and the limit exit) is where a bound that should terminate is not terminating - most likely a loop that reads its condition from memory we have not refreshed at that point (the same "null view reads zeros" the comment warns about).Still open and unchanged in the branch: nothing in this comment is a patch yet.
@pes7 on GitHub · 2026-11-26 01:56 UTC · original
Progress log, part 5 - the tool that shows what our translation of a bad shader is, and what it says.
VICTORY_DUMP_SHADER=<hash>(diagnostics,6ac972cin this branch) writes each named shader's translated DXIL to%TEMP%\victory-<hash>.dxil;dxc -dumpbinturns it into the IR. It works on the three hashes the runs named:What the group counts say. The trace on
8bbcbda6008eaa37:746 groups, and its IR isNumThreads=(8,4,1)- 23 872 threads in all. That command is worth 200-400 ms of the frame (part 3), so the time is in the body, not in the amount of work.What the body is. A ray march with a float exit condition and the loop limit as the only other way out:
with
%7480 = fcmp oge float %7459, %7417as the real test andSampleCmpLevelZeroinside. So either the march really runs a million steps (wrong data: a NaN or a non-advancing step) or it needs far fewer and hits the limit in some lanes - either way every iteration past the first few dozen is waste.And the other two hashes are not loops at all.
00167d58cc5a78d7isNumThreads=(4,4,4)with nodx.op.barrierand no loop-limit check at all - straight-line code that still stops the queue, so it is not a spinning loop: it is memory access (it reads the placed buffers we mirror in system RAM, at PCIe latency) or sheer instruction count.f607780aa8e502d0has two loops and two limits,NumThreads=(32,1,1).That means "the GPU hangs" is at least two different problems, and they need different fixes:
00167d58cc5a78d7- the cost of reading title memory that lives in system RAM (the same copy path we measured at 87-313 MB a frame).VICTORY_COPIES_IN_VIDEO_MEMORY=1is the project's own answer to that, and on this GPU it is supported (host copies of title memory in video memory (diagnostics) on=true) - measured in the menu it makes copy-back 5x more expensive (239 ms against 19-49 ms) because the CPU then reads our copy out of VRAM, so it trades one side for the other; worth a proper measurement in the world, not taken yet.8bbcbda6008eaa37,f607780aa8e502d0- the translated loops.VICTORY_SHADER_LOOP_LIMIT=16cut the GPU term from 683-807 ms to 147-370 ms and let the run finish its whole window without a removal, but the picture is wrong at 16 and the runs drift by scene, so the number that matters (same scene, limit 2^20 vs a limit that still admits every legitimate march) is not measured yet.Tests:
cargo test --release --workspace- 27 suites, all ok, on this branch (the 195 invictory-gpuincluded).@steven-seagull27 on GitHub · 2026-11-26 02:18 UTC · original
@pes7 I tested the 16-bit format change separately from the two diagnostics. The global BGRA8 mapping also changes sampled-only textures, where the original 16-bit storage works. This loses the source pixels on both adapters I tested. I put a combined branch on my fork if you can try the same account-screen → gameplay run.
The fixture tiled all 65,536 possible 16-bit words into one 256×256 sampled-only texture per format, used the production detile/upload path and host copy footprint, then read one RGBA sample per texel with a compute shader. I converted the samples back to their original guest precision. For B5G6R5 I also checked opaque alpha. The diagnostic zero-initialized its staging window before each detile so untouched bytes had a known value.
b456c7063bcca434684227Two fresh processes per adapter agreed on every count (RTX 5080, driver 621.40, and built-in WARP 10.0.26100.10068, debug layer on). For example, guest B5G6R5
0xf800should sample as opaque red. This head produced RGBA8[1,248,0,248]. The combined branch produced[255,0,0,255]. Native RTX sampling of some intermediate 5/6-bit values differs from the nearest 8-bit expansion by one code. All those values still recover the original guest word.The branch merges this exact head with @moe-miau's #2626 (
c8cc83e), preserves both diagnostics, and replaces the unconditional mapping with #2626's use-dependent path. For writable B5G5R5A1 and B4G4R4A4, both padded upload/clear/partial-readback tests also matched all 4,096 bytes in each of three runs per adapter. RTX used the RGBA8 stand-in and WARP used the native formats.B5G6R5 stays native in this combination. Both devices advertise sampling and rendering for it. WARP also advertises typed UAV stores, while the RTX does not. A title request to write B5G6R5 via a typed UAV on that RTX would still need a separate fallback. Your original log names formats 86 and 115. An in-game comparison would tell us whether the branch retains your gameplay progress and whether a format-85 UAV is actually requested.
AI-assisted with Codex. The results here used synthetic textures.
@pes7 on GitHub · 2026-11-26 02:30 UTC · original
Progress log, part 6 - what the cold-cache stall actually is (measured, not guessed), and two ideas that lost their own measurement.
Translations run on the eight pipeline workers, not on the recorder. The new line in the shader log names its thread; a run with a cold cache (the loop limit changes the cache key, so everything re-translates) says:
1 725 translations in the run, ~110 ms each, spread over the workers - so the 20-25 s the first gameplay frame spends on a cold cache is per-translation cost, not scheduling. Moving it off the recorder would change nothing; the win there is translator throughput (or the warm-up,
victory translate --cache, which the pipeline library already leans on).Dropped: block skipping in the copy-back merge. Measured in the build, same data (64 KiB piece, one byte written in 128):
10x worse, and 3 us a piece means the whole 8 MB of copy-back merge is 0.4 ms of a 19-49 ms item - the cost there is the two
ReadProcessMemorycalls a piece, not the merge. Reverted.Dropped: copies in video memory (
VICTORY_COPIES_IN_VIDEO_MEMORY=1). Supported here (GPUUploadHeapSupported, "on=true"), but in the menu copy-back goes 19-49 ms -> 239 ms a frame (the CPU reads our copy out of VRAM) and the menu drops 30 fps -> 3, and with the prologue's key presses the run ended in a device removal (a GPU hang, per the debug layer) twice out of two. It needs a staging copy in system memory beside the VRAM one before it can be measured in the world.What is still the frame, from the runs with the two hanging compute dispatches skipped: 867-1006 ms a frame, 683-807 ms of it on the GPU, 1 260-1 667 draws with 368 indirect, 372-508 dropped while their pipelines are made; skipping one more hash (
8bbcbda6008eaa37, 746 groups, the ray march) takes the frame to 415-584 ms and the GPU to 179-421 ms.cargo test --release -p victory-gpu: 231 pass.@pes7 on GitHub · 2026-11-26 02:51 UTC · original
Progress log, part 7 - the cold-cache stall is one algorithm, measured to the line.
Phase timing in the translator (diagnostics) and
emit::lower's retry counter (4fdad62) answer where the 20-25 s of a cold batch go. A batch of 1 725 translations, summed:range::build(structurisation)resource::trackio::raiselower::lower(emit)So the median translation is 2.7 ms (as the project's own numbers say), and the batch is dominated by a handful of shaders. The worst:
Which is
emit::lower's retry loop:lower()re-runs the whole lowering once per phi that does not settle.74 passes x ~86 ms on 1 542 blocks = the 6.7 s; 222 extra passes across 17 shaders in the batch. The setup is 6 % of a pass, so reusing it would not help; the passes themselves must go.
badis consulted where a phi is first lowered (Val::Missing), so a value marked bad changes how earlier code lowers - that is why the loop restarts, and why batching them needs the failure set collected inside the two phi loops at the end ofrun()(which is the next change here, not this comment).Also from the same instrument:
resource::trackhas a 1.47 s outlier on one shader (median 1 ms), the second target.Nothing in the release build changes: the phases are
Instants undercfg(feature = "diagnostics")and the pass count is not compiled.cargo test --release --workspace: 30 suites, all ok (302 invictory-shader), on this branch.@steven-seagull27 on GitHub · 2026-11-26 02:53 UTC · original
@pes7 Your Part 6 numbers point to a concrete cold-cache A/B. I tested #2942 (
1569277, lowering) and #2957 (dfa6126, SSA) on the same inputs throughtranslate_with. On eight CPU workers, 64 synthetic buffer/VALU shaders took 75.4 ms on base, 67.4 ms with #2942 alone and 63.4 ms with both. For 64 shaders with many live registers at joins, the corresponding medians were 42.2, 36.4 and 35.5 ms. All 128 produced byte-identical DXIL and the same host bindings across all four builds, and every output validated.I verified that the two compiler heads together merge cleanly onto your
4eaaf60, and also onto4684227with the sampled-format test fix. If you have time for a cold-cache run of the same route, comparing your existing eight-worker build with those two compiler changes would show whether the translation gain reaches the first gameplay frame. I didn't measure title startup, pipeline creation or warm-cache FPS. Full table, benchmark fixture and reproduction on #2957.@pes7 on GitHub · 2026-11-26 03:11 UTC · original
Progress log, part 8 - the retry batching was implemented, measured, and then reverted: its own soundness check failed.
What it did.
fill_phisnow catches aStop::Retryper phi, records the value and leaves a type-correct placeholder, so one pass finds many non-settling phis instead of one;lowermerges the whole list intobad.What it measured (same scenario, cold cache, 1 725 translations in the "before" run):
(the "after" run is partial: it ended early, see below.) Max passes 74 -> 8, the worst translation 8.0 s -> 2.6 s.
Why it was reverted. The batched build ended two runs with the title faulting inside its own image (
write 0x0) about 40 s in. A later run of the unbatched build ended the same way, so the crash is not attributable to the change - but the change also cannot be shown sound by that argument either. The placeholders mean a phi that fails because of a placeholder gets markedbadtoo, and a value markedbadis lowered asVal::Missingfrom then on, so the fixed point of the batched loop may differ from the sequential one. That is exactly what a wrong picture looks like, and 302victory-shadertests do not cover the game's biggest shaders.So the next step is not another run, it is a proof: dump every translated shader (
VICTORY_DUMP_SHADER=all) on both builds in the same scenario and compare the files - identical output is the soundness evidence, any difference says which phis were markedbadneedlessly. Only then is the 74 -> 8 passes win something to keep.The measured shape of
resource::track, from the same phase instrument (1727 translations):224 shaders over 100 ms in one phase that should be a walk of the instructions: the second target, and unlike the batching it is a pure scan-vs-map question.
Branch state:
lower.rsandresource.rsback to their committed contents (git statusclean),cargo test --release --workspace30 suites ok, builds with and without diagnostics.@steven-seagull27 on GitHub · 2026-11-26 03:16 UTC · original · edited 2026-11-26 03:32 UTC
@pes7 Correction to my earlier interpretation of the 111.9 s figure. On
df3c5df,mark("resource")runs immediately afterrange::build(&native.patched_code(), ...). The printedresource=bucket therefore measures native code patching and range construction, including the IR work inside it. The next bucket,io=, measuresresource::track. The existing log can be re-bucketed without asking you to rerun the title. For the 224 translations above 100 ms I’d look first at the range-building phases and useio=to assess resource tracking. Instrumentation on the tested commitThe synthetic benchmark called
resource::trackdirectly. Its two cases went from 146.2 to 66.9 µs and 21.8 to 14.2 µs. The 192 compiled shader fixtures were byte-identical across the two builds, and I measured no end-to-end translation speedup on that corpus. Those results support the isolated improvement in #2785. They don’t establish how much time it saves on the prologue. Benchmark detailsAI-assisted testing and analysis on my machine.
@pes7 on GitHub · 2026-11-26 03:29 UTC · original
Progress log, part 9 - the batching is proven by the pack and kept.
The soundness question from part 8 is answered by the whole shader pack rather than by a run:
victory translate --listtranslates all 26 084 programs in ~45 s, and its per-program lines (25 889 of them: success or the exact failure reason) were diffed between the unbatched and the batched translator:and the stage tallies are identical too (
14 246 of 14 247vertex and pixel,2 658 of 2 682compute,8 765 of 8 765mesh emitted). Corpus wall time 47 s -> 44 s.So the batching does not change which programs translate, which was the risk: a phi marked
badis lowered asVal::Missingfrom then on, and a placeholder can make another phi look unjoinable. Outcome equality over every program in the pack is the evidence that it does not happen in this title. (Byte equality of the DXIL is not shown; the game runs reach the same place with and without the change - the early device removals happen on both.)The win it keeps, measured on the prologue scenario with a cold cache:
74 passes -> 8, the worst translation 8.0 s -> 2.6 s, 222 extra whole-lowering passes gone.
cargo test --release --workspace: 30 suites, 0 failures; clippy-D warningsclean with and without the diagnostics feature.Two things this also taught, for the next step: the corpus harness is a deterministic A/B for translator changes (45 s for the whole pack, identical input), and it is the fast way to check any future change to
lower; andresource::track(224 shaders over 100 ms, 111.9 s in one cold batch) is now the largest single item left in the loading path.@pes7 on GitHub · 2026-11-26 03:38 UTC · original
Progress log, part 10 -
resource::trackis not the quadratic it looked like: measured on the deterministic harness, it is ~1 us per seven instructions.Part 7 left
resource::trackas the biggest item in the game's cold batch (224 shaders over 100 ms, 111.9 s). Instrumented on the corpus (victory translate --liston the whole pack, 25 889 tracked programs, 40.6 M IR instructions), printing every call over 1 ms and the share that is insideTracer::descriptor:Worst shader 27 ms, total 8.5 s across the whole pack, and only 36 % of it inside
descriptor()- the rest is the per-instruction walk (smem_address,flat_address, the per-block bookkeeping). So on identical input the phase is linear and cheap, and the game's 1.47 s outlier does not reproduce: it was either a shader outside the settranslatereaches or contention between the eight pipeline workers, not an algorithmic scan.That closes the "track is quadratic" hypothesis and moves the cold-batch target back to
emit::lower, which is what the batching fix (part 9) already cut. The instrument is not kept: with no quadratic to fix it would only costInstants per call.Verification on the current branch:
cargo test --release -p victory-shader302 pass, clippy-D warningsclean,git statusclean (the branch isfix/prologueat5319ffc).What is left, in the order the measurements put it:
8bbcbda6008eaa37(746 groups asking for 200-400 ms) and the two hanging dispatches - the title never reached a mission because those are skipped;emit::lower's remaining cost (still the bulk of a cold translation after the batching);@steven-seagull27 on GitHub · 2026-11-26 03:43 UTC · original
@pes7 Part 10’s directly timed
resource::trackcalls settle an important question. For the cold game log there’s also an accounting detail ondf3c5df: theresource=line records patching the native code and building its range, and the next line,io=, records resource tracking. You can apply that mapping to the saved log. The 111.9 s figure belongs to the former bucket. Original timerFor a future trace I put an optional diagnostics-only timing patch on your timer revision and checked it on Part 9 (
5319ffc). It records the completed phases by name. Within range construction it also reports initial IR construction and structuring separately from the bounded passes, with a call count so repeated passes add up.In a diagnostics build the event is enabled by
VICTORY_LOG=victory_shader::emit=debug. I checked all 11 phase timers independently with synthetic delays. For example, a 32 ms delay in tracking registered 32,345 µs under resource and 112 µs under range. Two delays in bounded IR construction registered 64,336 µs across two calls. Two complete synthetic shader translations produced identical DXIL and binding metadata with diagnostics disabled, filtered, or enabled. These are timer checks. Your direct corpus measurements remain the evidence for the actual cost.AI-assisted with Codex.
@pes7 on GitHub · 2026-11-26 03:55 UTC · original
Progress log, part 11 - the batching is reverted: the account screen proves it changes generated code, and the plain build runs the prologue for the whole window.
Part 9 kept the batching on the strength of identical outcomes over the shader pack. That was not enough: outcomes can match while the code differs, and here it did. Same scenario, same skips (
VICTORY_SKIP_PIPELINES=00167d58cc5a78d7,f607780aa8e502d0), the account screen:5319ffc)df3c5df,plain-lower.exe)end: no crashover the full 480 s windowA shader in the menu went from 38 ms to 1.2 s, so the batched lowering really does emit different code for some program even though both builds translate exactly the same set. The lesson for the record: outcome equality over 26 084 programs is not soundness evidence - the frame time of the account screen is a cheap content check, and it is the one that caught it.
fix/prologueis back atdf3c5df(git reset --hard, force-pushed);cargo test --release --workspace30 suites, 0 failures; the branch carries the 16-bit-format crash fix and the diagnostics.What the plain run also gives, for the next step: the prologue now runs the whole 480 s window without a device removal as soon as the two hanging dispatches are skipped - 47 world frames, 813-4 255 draws, 1.5-4.9 s/frame (0.2-0.66 fps). That is a survivable platform to work on the frame now, instead of a run that dies in the loading screen.
@pes7 on GitHub · 2026-11-26 04:24 UTC · original
Progress log, part 12 - a way to see the arguments of a command that never finishes, and why the earlier batching verdict needs a caveat.
The problem with every dump so far. A command that hangs the GPU can only be named after the fact (breadcrumbs), never read:
capture::read_indirectcopies the records into a read-back buffer inside the list, and that list is the one that never finishes. So the counts of the hanging dispatch were never visible - which is exactly what we needed to tell "huge work" from "garbage data".What is now logged. The arguments live in the host copy of title memory, and the refresh that fills it runs immediately before the list runs.
VICTORY_DUMP_ARGUMENTS(diagnostics) defers a step that logs the record's dwords at submission time, from the copy the GPU will read:For the two dispatches that stop the prologue and for whatever the breadcrumbs name next, one run now says what they were asked to do - 16 dwords per record, before anything can hang.
A caveat on part 11. Five more runs: four ended in a device removal during loading (34, 33, 33, 26 lists, no world frame), one survived 480 s in the prologue (47 frames, 813-4 255 draws, 1.5-4.9 s/frame). And the plain build, which was 38 ms/frame at the account screen in the surviving run, showed 1 202-1 212 ms/frame at the same 16-draw screen in two other runs. So the 1.2 s account screen is intermittent in both builds, not a property of the batched lowering: part 11's evidence was one run against one run, and the batching revert stands only on "no measured win" plus that single comparison. What is certain is that the pathology exists without the batching, and that the account screen - 16 draws, no game logic - reproduces it cheaply when it happens.
That is the cheapest reproduction we have of the "1 fps" reports: a 16-draw screen at 1.2 s/frame, no world, no streaming.
Branch:
fix/prologueat555a5d9,cargo test --release --workspace30 suites 0 failures, clippy-D warningsclean with the diagnostics feature.@pes7 on GitHub · 2026-11-26 05:14 UTC · original
Progress log, part 13 - three things my own tooling had been hiding, and the number that names the stall.
The drivers were running the wrong binary. Several recent "no per-command data" runs used
target\release\victory.exebuilt without--features diagnostics:VICTORY_SKIP_PIPELINES,VICTORY_DUMP_ARGUMENTS,VICTORY_GPU_TIMINGand DRED are all diagnostics-only (main has no #2696), so they did nothing and the two hanging dispatches ran. Two more driver bugs of the same kind: the scripts setVICTORY_GPU_TIMING/VICTORY_D3D12_DREDand then deleted them a few lines later, and one presser built the string"$attempt: ..."which PowerShell parses as a drive. All fixed (press*.ps1,drive16).The 68 MB logs were one warning. 310 724 of 317 747 lines in a 100 s run were
descriptor::host's per-slot warning - main does not have #2634 (open). With #2634 applied (test/with-2634, local) the same run's log is ~1 MB and it lasts minutes.With a correct build, the loading's GPU cost is ~1 s per command.
VICTORY_GPU_TIMINGranking over a loading run (each list alone, so inflated, but the ranking holds):and the frame itself, from a run without the timing switch: 15 450 ms, of which 15 269 on the GPU, with 0 draws and 0 indirect - so the first world-loading frame is compute dispatches and uploads, not geometry. A dispatch of 256 groups taking 918 ms is the same "loop to the 2^20 limit" shape seen before, in a third shader.
The loop limit is the mechanism. The same run with
VICTORY_SHADER_LOOP_LIMIT=1024: the loading frames go from 15 450 ms to 56-83 ms (11 draws). The stall is the translated loops; 1024 iterations is still far above any legitimate march, but it is a diagnostic - the shader then computes the wrong thing, and a device removal still happened later (after a submission of 2 lists), so it is not the whole story.Next: the same instrument (
VICTORY_DUMP_ARGUMENTS, andVICTORY_DUMP_SHADERforc18ab7816c206926) on a run that reaches the world, to see whether the loop bound's data is huge or garbage - decided by whether the dwords are plausible counts or noise.@pes7 on GitHub · 2026-11-26 05:28 UTC · original
Progress log, part 14 - the 918 ms dispatch has no loops at all, and every shader the loading translates is now dumped.
c18ab7816c206926is not the culprit. Dumped withVICTORY_DUMP_SHADERand disassembled (dxc -dumpbin):NumThreads=(8,4,1), 1 391 IR lines, no loop-limit check, no barrier, 2 atomics. A dispatch of 256 groups with no loops cannot cost 918 ms, so that thousand-millisecond entry in theVICTORY_GPU_TIMINGranking is the drain of work from the other threads in the queue, not this command's own cost. The ranking cannot attribute the loading's 15 s; the attribution needs a GPU-side timestamp pair around each dispatch, which this switch does not do (it submits one list per wait instead).The population that can run to the limit is wide. A run with
VICTORY_DUMP_SHADER=alldumped 1 932 shaders in a 52 s loading run; disassembling all of them, 809 have translated loops, and the tail is not one shader:(one
icmp ult i32 %counter, 1048576per loop). So "find the one bad loop" is the wrong shape of question: a third of the loading's shaders can burn a million iterations per lane if their data never satisfies the exit, and the measured mechanism is confirmed from the other side -VICTORY_SHADER_LOOP_LIMIT=1024takes the same loading frames from 15 450 ms to 56-83 ms.What that points at. A runtime signal is needed, not a static one: the cheapest is to make the limit exit itself count - the emitter already emits a distinct path for it (
a lane that reaches the limit leaves the program as killed), so a diagnostics build can have that path bump a counter the host reads back, and the pipeline log then names the shaders whose lanes actually ran a million iterations. That is one small emitter change plus a read-back, and it turns "809 candidates" into "these four pipelines, in this frame".Nothing is committed for a gain this turn; the branch is unchanged (
fix/prologueat555a5d9, 30 workspace suites green, CI green).@pes7 on GitHub · 2026-11-26 05:48 UTC · original
Progress log, part 15 - a way to attribute a batched submission's GPU time, and the reason the first attempt at it produced nothing.
Part 14 ended with the finding that
VICTORY_GPU_TIMINGcannot attribute the loading's 15 s: it submits every list on its own and waits (that is what makes it ~10x wrong), andc18ab7816c206926- the command it ranked highest - has no loops at all, so its 918 ms was the queue draining.What is committed now (
0247b95).VICTORY_GPU_STAMPS(diagnostics) turns the per-command timestamps on without the one-list-per-submission mode, and a submission of all lists that takes over 200 ms reports the two longest commands of every list in it:Also fixed while doing it: every list resolved its stamps into offset 0 of its read-back buffer, so only the list that closed last kept its times - each list now has its own slot (
STAMP_SLOTS).What it printed on the first run: nothing but
slow host submission. 268 of those, 0slow listlines - the stamps are collected only through theVICTORY_GPU_TIMINGgate intiming(), whichstamps()asked for; with the switch on the list has a heap and resolves, butnote_opis what inserts theEndQuerymarkers and it requiresdred_on(). So the next check is one line: whethernotesis populated whenVICTORY_GPU_D3D12_DREDandVICTORY_GPU_STAMPSare both on (it was set in that run, so the likely cause is the read-back offset arithmetic rather than the notes - the slots change is new and untested).Branch:
fix/prologueat0247b95,cargo test --release --workspace30 suites 0 failures, clippy-D warningsclean with the diagnostics feature.Still open, unchanged: the loading's 15 s and the device removal, the world frame (683-807 ms of GPU with 8bbcbda6008eaa37 at 200-400 ms), the 372-508 dropped draws, and no mission reached. The one measured translation win remains reverted.
@pes7 on GitHub · 2026-11-26 06:01 UTC · original
Progress log, part 16 - the indirect counts are finally visible, and they answer the huge-vs-garbage question: the counts are small.
The instrument worked once the driver stopped running a stale binary. A third bug of the same family: the presser scripts had
$exe = ...\exe\with2634-diag.exehard-coded, so every run after the first used an old build - the one withoutVICTORY_GPU_STAMPSand without the new report.VICTORY_DUMP_ARGUMENTStherefore never printed anything, not because the instrument was wrong. With the fresh binary:6 426 of those lines in one loading run, and the dispatch counts are 642, 16, 0, 1 groups - plausible, small numbers, not huge and not garbage. So the loading's 15 s is not fed by oversized indirect work; with
VICTORY_SHADER_LOOP_LIMIT=1024taking the same frames to 56-83 ms, the cost is per-thread loops inside direct dispatches, exactly the "loop to the 2^20 limit" shape.The batched per-command report is structurally alive but reads zeros. Same run:
Notes are recorded (7 439 of them), the heap exists, the lines print - and every duration is 0.0 ms, so the read-back lands where the timestamps are not. That is now a two-line question (the
STAMP_SLOTSoffset inclose()against the oneslowest()maps) rather than a blind one; the report also now logsnotes=andstamps=so the next empty run says which half is missing.Branch
fix/prologueat993d3f0;cargo test --release --workspace30 suites, 0 failures; clippy-D warningsclean with diagnostics.@pes7 on GitHub · 2026-11-26 06:10 UTC · original
Progress log, part 17 - the loading's five seconds has a name, and it is one workgroup.
The read-back was reading the wrong place.
Mapreturns the start of a read-back resource, not of the range asked for, so once every list took its ownSTAMP_SLOTSslot the report read offset 0 (another list's slot, or zeroes) and printed 0.0 ms for everything while 7 439 notes and a live heap were right there. One line (data.add(begin)) and the batched report works:caa78b8ca62bc3d6is the 5 s.NumThreads=(64,1,1), dispatched 1x1x1 - sixty-four threads - 9 768 IR lines, three translated loops, no barriers. Its loops:The latter two are searches: they advance until a loaded value equals a key, with the 2^20 limit as the only other exit. Sixty-four threads running a million-iteration search is exactly 5 s, and it is the first frame's TDR (5 251 ms is over the 2 s window on its own, before the rest of the submission).
So the question is now narrow and concrete: the search's key or its table does not match what the title has on the console - either the table is stale in our copy at that dispatch, or the comparison reads a different width/sign than the original. The next step is to dump that table and the key at submission (the same mechanism as
VICTORY_DUMP_ARGUMENTS, extended to a direct dispatch's user-data buffers) and compare - a match in the data but not on the GPU means a translation bug, no match means a refresh bug.Branch
fix/prologueata1d5662;cargo test --release --workspace30 suites, 0 failures; clippy-D warningsclean with diagnostics.@pes7 on GitHub · 2026-11-26 06:26 UTC · original
Progress log, part 18 - the prologue runs without any skip, and no device removal, once the loops are capped.
The measurement that matters this time:
Until now every run that reached the world needed two compute dispatches skipped, and every run without skips died in loading with
DXGI_ERROR_DEVICE_HUNG. With the loops capped at 1024 iterations per lane the title loads, enters the prologue and stays there for seven minutes of gameplay without a removal - so the TDR was entirely the translated loops running to their 2^20 limit, not a bad state, a bad descriptor or a bad submission.The specific one that cost the loading its 5 s is named (part 17):
caa78b8ca62bc3d6,NumThreads=(64,1,1)in a 1x1x1 dispatch, whose two searches arewhile (loaded != key)with the limit as the only other exit. Capping at 1024 makes them terminate; the right fix is to make them find what the title's data has, and that is the next piece of work.Two caveats, stated plainly:
What is left, in order: (a) run the same scenario with
VICTORY_D3D12_DRED=1as well, so the per-command report (which now works, part 17) says what the remaining 2.2 s of GPU is; (b) fix the two searches ofcaa78b8ca62bc3d6by comparing its key against the table the title actually has - a data dump at submission, as planned; (c) then the copy volume (1.2-10.4 GB a frame), which dwarfs everything else on the CPU side.Branch
fix/prologueata1d5662, 30 workspace suites green, clippy clean with diagnostics.@pes7 on GitHub · 2026-11-26 06:33 UTC · original
Progress log, part 19 - the 6 s dispatch is a nested pair of loops, so the per-loop cap cannot bound it, and the outer loop's bound is the value to look at.
Per-command attribution in the no-skip run (
LOOP_LIMIT=1024,GPU_STAMPS, DRED):caa78b8ca62bc3d6is still 6 s with the cap at 1024. Its three limit checks leave to the same block, and the IR puts the loops headed at%604and%5933inside the one headed at%540(%540..exit at 6026/6375, both inner headers between them):So the cap is per loop entry: 1 024 outer iterations x 1 024 inner = ~10^6, which is the 6 s. The lever is the outer bound
%560: on the console it is presumably a handful (the loop exits when3 < count), and in ours it is at least 1 024, which is either stale data or a mistranslated count. That value is now the single thing to dump.The attribution reports drains too, and one line proves it:
DROPPED dispatch (...) 2191.3 ms- a dropped command records no GPU work, so its 2.2 s is the previous work finishing between the two markers. The remaining 2.2 s of a world frame is therefore split betweencaa78b8ca62bc3d6(6 s over the frames it runs in),6697dff15287e544(~0.5 s per call, several a frame) and that drain, and the per-command numbers are upper bounds, not costs.Branch
fix/prologueata1d5662; 30 workspace suites green; clippy clean with diagnostics. Next: dump%560,%462and%466at submission time (the user-data buffer of the direct 1x1x1 dispatch), decide data-vs-translation, and fix accordingly.@pes7 on GitHub · 2026-11-26 06:40 UTC · original
Progress log, part 20 - the data of the 6 s dispatch is not in a table, and that is itself the answer to "why nothing printed".
The two searches of
caa78b8ca62bc3d6exit onloaded != keywith the 2^20 cap as the only other way out, and they are nested inside the loop that exits on3 < count(part 19), so the cap does not bound them (1024 x 1024). To see the values,VICTORY_DUMP_VIEWS(diagnostics,340844b) now logs the first sixteen dwords of every constant or placed buffer view a traced pipeline binds, at submission time, from the copy the GPU will read.First run with
VICTORY_TRACE_SHADERS=caa78b8ca62bc3d6andVICTORY_DUMP_VIEWS=1: zero lines. The shader therefore does not read its data through a descriptor table - it reads root views or user data (its recorded notes sayu16=0x95c0, a user-data heap slot, not a table entry), so the dump has to be extended to those two paths before it can say anything.That is the whole of this step, and it is worth writing down as such: two instruments (per-command attribution, view dump) now work on the paths they cover, the 6 s is attributed to one shader with three nested loops, and what remains is to reach the values through the root-view/user-data path - a smaller job than the table dump was, because those bindings are already resolved in
bindasRoot::View(address)anduser_value.Branch
fix/prologueat340844b;cargo test --release --workspace30 suites, 0 failures; clippy-D warningsclean with diagnostics.Still unmet and unchanged: no mission reached, no shipped fps or loading gain; the prologue runs only with the loop cap (diagnostic, wrong picture), frames are 2.2-3.4 s with 1.2-10.4 GB of copies, and the world frame's GPU is
caa78b8ca62bc3d6plus6697dff15287e544(~0.5 s a call).@pes7 on GitHub · 2026-11-26 06:48 UTC · original
Progress log, part 21 - the values exist and are sane, and they say the table is title memory, not a view.
VICTORY_DUMP_VIEWSnow covers the traced pipeline's user data and root views as well (4bd6cb4). Forcaa78b8ca62bc3d6in a loading run:6 005 lines, and the values are small and structured: the three non-zero dwords are
18816, 0xFFFFF800 (-2048), 768, then27520, 0xFFFFF900 (-1792), 1024,2688, 0xFFFFFF00 (-256), 256- an offset, a negative offset and a size, exactly what a search over a table looks like. Not garbage.And the other two paths print nothing: no descriptor-table views and no root views for this shader. So its data comes from title memory through the page table (
t0inMEMORY_SPACE), which is the one path the dump still does not cover and the one whose freshness is the question:memory::withholdingwithholds ranges when a list using title memory misses, and a search over withheld (zero) memory cannot find its key, which is precisely a loop to the 2^20 cap.So the next measurement is already in the code, one log line away:
memory's counters (withheld_bytes,missed_pages,missed_regions,first_missed,SUBMISSION_MISSED) for the same loading frames - if pages are withheld during the frame that runscaa78b8ca62bc3d6, the fix is in the refresh/withhold path and not in the translation.Branch
fix/prologueat4bd6cb4;cargo test --release --workspace30 suites, 0 failures; clippy-D warningsclean with diagnostics.@pes7 on GitHub · 2026-11-26 06:58 UTC · original
Progress log, part 22 - the loops are fed by missing title memory, and the memory table is why.
memoryalready logged the answer; one run of the loading scenario, no code change:120 539 pages and 23 whole 256 MiB regions with no copy, plus 18 447 withheld ranges and 1 098 MB of views kept. A shader that searches a table in that memory reads zeros, never finds its key, and runs its loop to the 2^20 cap - which is
caa78b8ca62bc3d6and its 5 s.The cause is a constant:
memory::CAPACITYis 512 level-2 blocks, i.e. 512 distinct 256 MiB regions a page table can name, with the comment "the world's ~4 100 copies use a few dozen". This title's 3 444 copies span more than 1 030 such regions (the first missed ones are consecutive:0x850000000 0x860000000 0x870000000 0x880000000), so every region past the cap reads as absent.Measured with the cap raised to 1024 (one constant, everything else unchanged):
So the chain is complete and measured end to end: missing regions -> zeros -> search to the cap -> 5-6 s single dispatch -> TDR. It is not a mistranslation: the same shader with its memory reachable is six times faster, and the loop bound is the only thing the 1024 cap was hiding.
Reverted to
CAPACITY = 512for now, because raising it costs(CAPACITY + 1) * 32 KiBof page table per list (16 MB -> 32 MB with 1024, and this title needs more than 1030) and that is a memory decision, not a one-line one. The change that would fit: allocate the level-2 blocks per submission for the regions the submission's own views reach (most of the 1 030 are unused in any given submission), instead of a fixed table of 512.Branch
fix/prologueat4bd6cb4, clean;cargo test --release --workspace30 suites, 0 failures.@pes7 on GitHub · 2026-11-26 07:11 UTC · original
Progress log, part 23 - the first shipped fix that removes the TDR: the page table now names 2 048 regions instead of 512.
The chain from part 22, measured end to end, and the fix is one constant:
caa78b8ca62bc3d6(dispatch 1x1x1, 64 threads, three nested loops)VICTORY_SKIP_PIPELINES, default loop limitmissed ... 256 MiB regions with no copyWhy: the title's 3 444 host copies span more than 1 030 distinct 256 MiB regions, and a list's page table had room for 512 ("the world's ~4 100 copies use a few dozen" - true of the world, not of this title). Every region past the cap reads as absent, so a shader searching a table there reads zeros, never matches its key and runs its loop to the 2^20 cap - the 5-6 s singleton dispatch and the TDR.
Until now the prologue ran only with two dispatches skipped or with
VICTORY_SHADER_LOOP_LIMIT=1024, both diagnostics with a wrong picture. With the capacity raised it runs on an unmodified build: no skips, default loop limit.Cost, stated: a table is
(CAPACITY + 1) * 32 KiBbeside the level-1 entries - 67 MB instead of 17 MB - and the run keeps one or two. Raising it further only covers the remaining 6-19 regions and grows linearly, so the next change there is per-submission level-2 blocks for the regions a submission's views reach, not a bigger constant.Verification: corpus A/B unchanged as expected (the translator is untouched) - 25 889 per-program outcome lines, 0 differences, 47 s;
cargo test --release --workspace30 suites, 0 failures; clippy-D warningsclean with and without diagnostics; commit1e53e91onfix/prologue.What this does not do: the world frame is still 1.2-1.7 s on the GPU with 1.4-2.0 GB of copies a frame, and no mission has been shown yet - the next runs go further in the prologue and the next target is the remaining GPU cost (
6697dff15287e544, ~0.6 s a call) and the copy volume.@pes7 on GitHub · 2026-11-26 07:26 UTC · original
Progress log, part 24 - with the capacity fix the prologue plays on an unmodified build, renders correctly, and gets to its opening scene.
Same binary as
1e53e91(CAPACITY 2048, diagnostics), noVICTORY_SKIP_PIPELINES, no loop-limit override, 620 s window with the account screen and menu pressed through andWheld now and then in the scene:Two screenshots from that run (
O:\tmp\victory-work\run\play_353.png,play_555.png):So the picture is correct, not the compressed garbage of the loop-limit diagnostic, and the title is in the prologue's own scene rather than stuck in loading. That is the first time any of this session's runs has got there without a skip switch or a loop cap.
What is left is fps, and it is now the only thing in the way: 1 400-4 400 draws at 1.8-3.0 s a frame. The per-command report says where:
6697dff15287e544(indirect dispatch, ~0.5-0.6 s a call, several a frame) plus the drain between submissions; the CPU side is 0.5-2.0 GB of title-memory copies a frame (70-160 ms) and 3 000-44 000 heap slots a frame. Both are measurable with what is in the branch now.Branch
fix/prologueat1e53e91(the capacity fix is the latest commit); corpus A/B and 30 workspace suites were verified on it in part 23.@pes7 on GitHub · 2026-11-26 07:36 UTC · original
Progress log, part 25 -
6697dff15287e544is a different animal, and a caveat on part 23's claim.The shader. Dumped and disassembled:
NumThreads=(8,4,1), 29 112 IR lines (193 KB of DXIL), seven loops each with aicmp ult i32 %counter, 1048576exit, and 23 atomics, no barriers. That is a heavy data-parallel pass (the atomics alone suggest work distribution), an order of magnitude bigger than the 5 s one, and its ~0.5-0.6 s per indirect call may simply be real work that the memory table no longer breaks. Nothing in it looks like the "search a table that is not there" shape ofcaa78b8ca62bc3d6; the exits are counters with the cap behind them, notloaded != key.A caveat I owe the record. With
CAPACITY = 4096the same play scenario showedcaa78b8ca62bc3d6at 4 180 ms again, which reads like 4 096 being worse than 2 048. It cannot be, in data terms:write_tablesorts copies by size and assigns level-2 blocks as regions are first touched, so a larger cap names a superset of the regions a smaller one does. The 4 180 ms is therefore either the drain attribution the report is known to include (theDROPPED dispatch ... 6 301 msline in the same run is a 6 s "command" that records no GPU work) or run-to-run variation - not a regression. What that means for part 23 is stated plainly: the capacity change names more of the title's memory, the play run with it reached 238 frames and the prologue's own scene, but a single run cannot prove it removed the TDR, and one run at 4 096 muddies the picture rather than disproving it. A proper claim needs interleaved runs of the same scenario, which is the next measurement rather than another one-shot.CAPACITYis back at 2 048 in the tree (the value the play run used); the 4 096 experiment is not kept.What is still true and measured: the loading no longer needs skips or a loop cap to reach the prologue's scene (screenshots at 353 s and 555 s),
caa78b8ca62bc3d6costs 5-6 s only when its memory is missing (1024 regions named: 6 s; 2048: below the report's threshold), and 6-22 regions remain unnamed at 2 048.Branch
fix/prologueat1e53e91, tree clean, 231 tests invictory-gpupass.@pes7 on GitHub · 2026-11-26 08:16 UTC · original
Progress log, part 26 - part 23's fix is withdrawn: the interleaved A/B does not support it, and the mechanism it named never happens.
Part 23 credited
memory::CAPACITY512 -> 2048 with removing the loading's TDR. I could not reproduce that, so the change is reverted (652cd44) and the numbers are below, as measured.Interleaved A/B, same scenario (account screen and menu pressed through, no skip switches, default loop limit, warm cache), 2 runs per build, both tools from the same source otherwise:
Each build wins one pair, and the scenes differ (3 167-5 329 draws), so the difference is inside run-to-run noise. No run of either build lost its device, so the removals the change was credited with do not reproduce at 512 either.
The claimed mechanism does not exist in these runs.
write_tableprints one warning when copies need more 256 MiB regions than the table has blocks ("...more 256 MiB regions than a page table has room for"). It fires zero times at CAPACITY 512, in every run of both builds: the table was never full. And a build whose table can name every level-1 entry (CAPACITY = LEVEL1 - 1, 134 MB of table per heap) still reports the same 34 missed regions and 96 310 missed pages - unchanged - so "missed" means pages the title reads that have no host copy at all, not regions the table had no room for. That build also fails one of the table's unit tests, so it was not kept either.What that leaves: the 5-6 s dispatch (
caa78b8ca62bc3d6) and the loading TDR come and go with the scene and the data, not with the table's capacity; part 23's two observations were one-shot runs of a variable thing, and the honest reading is that the cause is still open.The diagnostics that made this checkable stay in the branch (
VICTORY_GPU_STAMPSper-list attribution,VICTORY_DUMP_SHADER,VICTORY_DUMP_ARGUMENTS,VICTORY_DUMP_VIEWS), as does the 16-bit-format fix. Branchfix/prologueat652cd44;cargo test --release --workspace30 suites, 0 failures; both build configurations clean.@pes7 on GitHub · 2026-11-26 08:32 UTC · original
Progress log, part 27 - the prologue now plays its own scripted scenes, and the frame cost is not the loops.
What the run shows.
play2(diagnostics build, no skip switches, default loop limit, no stamps): account screen and menu pressed through, thenWheld in bursts and a step left/right now and then; a screenshot every two minutes.129 world frames before that, 0 device removals, and the run ended at 566 s not with a GPU fault but with the title's own breakpoint:
unhandled exception 0x80000003 at victory-image+0x5149aec(three first-chance ones first, then the fatal), followed by the title's Breakpad reporter writing a minidump.0x80000003isint3- the game's own consistency check, not ours and not the driver. That is the next error class to chase, and it is after the opening credits, i.e. deeper than anything reached before.So the prologue's content runs: dialogue, cameras, subtitles, credits. Two visible rendering defects remain in those frames (checkerboard patches under the rooftop and in the sky in the credits shot), which is what a broken invariant at the end may be about.
The frame cost is genuine work, not loop burn. Ladder on the same scenario (warm cache for each limit, 420 s window, cold translation excluded):
Capping every translated loop at 4 096 iterations - the switch that took the loading from 15 450 ms to 56-83 ms - leaves the prologue's frames where they were. So the 1.5-3.8 s frames are the title's real compute and draw work (the per-command report puts it in eight compute pipelines of 0.3-0.8 s each a frame), and improving fps means making those cheaper, not shortening loops.
Also in this turn:
CAPACITY512 -> 2048 is reverted (652cd44) - the A/B in part 26 shows the values within noise and the "table full" warning never firing, so the fix part 23 claimed was not one. The diagnostics stay.cargo test --release --workspace: 30 suites, 0 failures. (Two runs during the session failed one hardware-sensitive test each - a GPUvalutest and the low-guard memory test - both pass alone and the workspace is green on a quiet machine, so they are load flakiness on this shared box, not the branch.)Three prologue compute pipelines read a *root view's* offset while the title had bound that root as 32-bit constants, and every such draw or dispatch was dropped: dropped 1-2.4/frame without a host pipeline: dispatch: a root view's offset: no root view, or outside title buffers [compute 35e51bb27a463294], [compute f94e5d8bf4e1cf05], ... A diagnostics count of the two halves of that reason says which it is: over a whole run, `no_view` fires and `no_copy` never does - the slot holds `Root::Constants(...)`, not `Root::View(...)`. The console lets a title pass a descriptor itself as root constants, and the ones here hold their buffer's address in dword 0 (`Constants([1915200512, 13, 0, 0, 190980448, 16, 8, ...])`). `State::root_address` now answers "the title address this root stands for" for both forms: the view's address, or the first dword of the constants when that address lies in a host copy (`shadow::find`), and `root_view_at` binds the view at that address exactly as it did for a view root. When the address is in no copy the old drop stands, so nothing is invented. Measured on the prologue scenario (play driver, 560 s window, diagnostics): before: 2.4/frame dropped for this reason, run ends on the title's int3 after: 0 dropped for this reason after, with the diagnostic loop cap 1024 (so the unrelated 5-6 s loop class does not end the run first): 208 world frames, 0 device removals, 0 drops, the whole 560 s window, no title exception The visible checkerboard patches in the credits frame are the shape this should fix; the fix is not yet shown to remove them (the run above has no screenshots), which is the next check.translate --listnames the opcode a refusal points at 049c3f6457A refusal carries `at 0x14dc`, and until now the offset was all it said: the program is 12 000 words of native code and the instruction at that offset was the one thing the message did not have. It has it now, in the same line: bvh_skinning:CSComputeSkinningPedBlendShapesVelocity_1c34db0a_Wrapped Cs at 0x14dc [s_cbranch_execz Sopp { imm: 92 }] emit: a lane mask read as data That names the prologue's remaining functional hole instead of hinting at it: four programs of the whole pack (`CSComputeSkinningPedBlendShapes`, `...SecMotion`, `...Velocity`, `...SecMotionVelocity` - the character skinning with blend shapes) fail on the same opcode, and the one the prologue binds (`compute 82a2ad6d07417d36`) is dropped 4 times a frame in the interior scene that the play run then stands in for four minutes. The other three shader families that refuse at an offset get the same line for free.@pes7 on GitHub · 2026-11-26 09:08 UTC · original
Progress log, part 28 - the dropped dispatches are fixed, and they were a binding form we did not read, not a memory gap.
What the drops were. Three prologue compute pipelines read a root view's offset while the title had bound that root as 32-bit constants:
The diagnostics added for this turn split the reason in two - a slot holding no view, versus a view whose address is in no copy - and over a whole run
no_copynever fires whileno_viewdoes, with the slot's state printed:So the title passes the descriptor itself as root constants (the console allows it), and those descriptors hold their buffer's address in dword 0.
The fix (
3ebf6ec).State::root_addressanswers "the address this root stands for" for both forms - the view's address, or the first dword of the constants when that address lies in a host copy - androot_view_atbinds the view there exactly as it does for a view root. If the address is in no copy, the old drop stands, so nothing is invented.Measured, same play scenario, 560 s window:
int3after the creditsThe last line is the longest the prologue has run: 208 world frames, no removal, no exception, no dropped dispatch. The loop cap is only there to keep the other known class (a dispatch that runs a translated loop to 2^20 in 5-6 s, which hangs the device) from ending the run first; it is not part of the fix.
Still to show: whether the checkerboard patches in the credits frame go away (that run took no screenshots), and whether the run now gets past the credits without the title's
int3. Both need the same scenario with screenshots, which is the next run.cargo test --release --workspace: 30 suites, 0 failures; clippy-D warningsclean with and without diagnostics; branchfix/prologueat3ebf6ec.@pes7 on GitHub · 2026-11-26 09:37 UTC · original
Progress log, part 29 - with the root-address fix the prologue runs 15 minutes and 343 frames with no removal and no exception, and the picture is a character walking in the world, not a crashed credits sequence.
Same build as part 28 (
3ebf6ec), the play driver with screenshots, the diagnostic loop cap 1024 in place only so the unrelated 5-6 s loop class cannot end the run first:The screenshots tell the story of the sequence, which is well past where the last crash was:
Compare part 27's run on the same driver without the fix: 129 frames, ending at 566 s on the title's
int3right after the credits, with 2.4 dropped dispatches a frame and checkerboard patches visible in the credits frame. None of that appears in this run: no drop, no assert, no patch.What is still in the way of a mission. The hang class. Four of the runs in this turn ended early with
DXGI_ERROR_DEVICE_HUNGbetween 80 and 90 s (7 world frames, 2 removals), two with the fix and two without, and two with a 1024 loop cap - so it is neither caused by the fix nor fully mitigated by the cap (a nested loop is 1024 x 1024 even then). Until that is named and fixed, whether a 15-minute run reaches a mission is a coin flip; the two survivors of this turn (560 s and 900 s) both did not.cargo test --release --workspace: 30 suites, 0 failures (part 28); branchfix/prologueat3ebf6ec, PR mergeable and clean.@pes7 on GitHub · 2026-11-26 10:13 UTC · original
Progress log, part 30 - no diagnostic switch at all: 350 world frames, 15 minutes, no removal, no exception - and the scene then stands still.
Same binary as part 28 (
3ebf6ec), the play driver with screenshots, nothing switched on: noVICTORY_SKIP_PIPELINES, no loop cap, no DRED, no stamps.What the screenshots show, in order:
So the run is stable and deep, but from about 10 minutes it stops advancing: the last 250 s are the same interior shot. That is not a crash and not a hang - it is a scripted scene that does not move on, which is the next thing to look at for "first mission" (a cutscene waiting for an event we do not deliver - audio/subtitle/fade - rather than a rendering failure).
The hang did not reproduce. Three runs with
VICTORY_D3D12_DRED=1(so thatnote_oprecords each list's commands, which survive until the list is reset - they are what the removal message appends as; list N of M, of its K: <command>) all ran their full windows: 87, 92 and 48 world frames, no removal. The report path is in place and costs nothing when nothing fails; it needs a failing run to say anything, and this hour did not have one. The earlier early deaths (7 world frames, ~85 s) were in runs before3ebf6ec.Branch
fix/prologueat3ebf6ec, PR mergeable and clean, workspace 30 suites green (part 28).@pes7 on GitHub · 2026-11-26 10:28 UTC · original
Progress log, part 31 - the scene that stands still has a cause, and it is a named one: the character skinning shader does not translate.
The stall. In part 30's clean run the last four minutes are the same interior shot. Its frames carry a drop I had not looked at:
So one compute pass is refused and dropped four times a frame for the whole scene. It is the character skinning with blend shapes.
Naming the instruction. A refusal used to give only an offset;
translate --listnow prints the opcode there too (049c3f6), and the corpus run says which one:Four programs in the entire 26 084-program pack fail this way, and they are all the same family:
CSComputeSkinningPedBlendShapes,...SecMotion,...Velocity,...SecMotionVelocity. The opcode iss_cbranch_execz- "branch if no lane is active" - which reads the EXEC mask, and the mask's value at that point is the per-lane boolean the emitter keeps inlane_bitsrather than a mask dword, so the read comes back asVal::Missing("a lane mask read as data")and the branch refuses. That is a concrete, bounded bug in the emitter's mask handling, not a data or memory problem.Also measured and rejected this turn: copies in video memory. Same play scenario, only
VICTORY_COPIES_IN_VIDEO_MEMORY=1, compared inside the 4 000-8 000 draws band where both runs have frames:playclean)The GPU term does improve (-5 %: 2 956 -> 2 804), but the CPU side more than eats it: the total goes up 34 %. Not kept.
Where this leaves the objective. The prologue now runs 15 min and 350 frames with no switch, no removal and no exception, and the scene that does not advance does not advance because a skinning pass is missing. Fixing
s_cbranch_execz's mask read is the next step and the first one that should move the content forward rather than the frame time.cargo test --release --workspace: 30 suites, 0 failures; clippy-D warningsclean; branchfix/prologueat049c3f6.@pes7 on GitHub · 2026-11-26 10:51 UTC · original
Progress log, part 32 - the mask fix was attempted four ways, measured each time, and not kept: the corpus does not move.
The target was
compute 82a2ad6d07417d36(character skinning, dropped 4/frame in the interior scene), refused ats_cbranch_execzwith "a lane mask read as data". Four attempts, each built and run over the whole pack (victory translate --list, 26 084 programs, ~50 s):getfalls back to the emitter's own bit (lane_bits) when a mask is missings_cbranch_execz/execnzmay read a mask as data (ininst())mask_okis forced true for a block's branch inexit()v_readlane_b32may read masks as dataWhat the probes found, and why none of them hit:
get(printing the instruction being lowered) fires zero times ats_cbranch_execz- so the branch's mask is not read throughget;v_readlane_b32, 6 ats_xor_b64, 4 each atv_cmpx_gt_u32andv_cndmask_b32, all of which are caught (the translation continues), so none of them is the fatal one;exit()'satom(..)->map_err) also fires zero times - so the fatalLANE_MASKcomes from somewhere that is neithergetnor the branch's atom:mask_dword/i32_of, or the structuring pass that hands the branch its condition.That is the precise next step, and it is one instrumented run away: put the probe in
mask_dword,i32_of(andmask_number) rather than inget, and print the IR block/instruction that asked. Four attempts that each left the corpus bit-identical is the evidence that guessing at the gate is not the way in.Everything reverted (
git statusclean at1e49107);cargo test --release --workspace: 30 suites, 0 failures. The branch keeps the two things that are measured: the root-address fix (drops 2.4/frame -> 0,3ebf6ec) and the CLI naming the refusing opcode (049c3f6,1e49107).@pes7 on GitHub · 2026-11-26 10:57 UTC · original
Addendum to part 32 - the refusal site is now pin-pointed, which is what the next attempt needs.
Two more probes (both reverted; the corpus is unchanged and the branch is clean at
1e49107):mask_dword's "not a structural mask" path: 0 hits in the whole pack - the fatal mask never reaches it;i32_of's missing-value path: 32 169 hits, all caught (translation continues);boolean(when, ..)inexit(), i.e. the_arm of the branch-condition match: 5 hits, all fatal, andmask_okistruethere:Four of those are the four
CSComputeSkinningPedBlendShapes*programs; the fifth isBool(2) ... "a descriptor read only as data", a different, already-known refusal. So the fatal path is: the branch's condition is a compound boolean (Bool(n), a node of the boolean tree) whose evaluation reaches a mask atom that cannot be read - not theatom-only fast path the branch takes when the condition is(atom, TRUE, FALSE).For the next attempt that means: the fix belongs inside
boolean()/atom()(instructure's boolean tree), not inget,mask_dwordorinst. Withmask_okalready true there, the atom must be a mask the emitter has neither inx.st.masksnor a bit for inlane_bits- which is the case a probe insideatom()can print in one run.Everything else stays as it was: corpus 5 refusals / 14 246 DXIL before and after every attempt,
cargo test --release --workspace30 suites green,victory-shader302 tests green, branchfix/prologueat1e49107, CI green.@steven-seagull27 on GitHub · 2026-11-26 11:02 UTC · original
@pes7 I reproduced the compound
exit/booleanrefusal from your part 32 addendum with a synthetic compute shader on1e49107. I put an opt-in producer trace on that exact head, following ThomasSAMP’s producer-tracing work in #1425.In my fixture,
s_and_saveexec_b32produces an SCC that feeds a scalar select and then a vector compare. The branch reports:The compare is where the leaf lost its bit. The missing input came from the earlier save-EXEC instruction. Your shader may reach a different producer. On the unmodified head, ordinary compare → save EXEC → branch → restore controls with 0, 8, and 32 active lanes matched 96/96 lanes per adapter on RTX 5080, Windows WARP, and WARP 1.0.22. The existing mask/data-join control matched another 32/32 per adapter.
To try the trace on your branch in PowerShell, substitute your usual input path in the last command:
Could you share just the text trace line for one of the four skinning shaders? The stage, leaf and producer opcodes and offsets should be enough to build a narrower synthetic case. All my inputs were synthetic. AI-assisted with Codex.
@pes7 on GitHub · 2026-11-26 11:21 UTC · original
Addendum to part 32 - the poisoned value is traced to its entry-block origin, and that rules out the seven guesses.
A probe now records, for every value marked "a lane mask read as data", the instruction that wrote it (name, machine offset, IR block), keeps the last twelve mask reads of a thread, and prints them when a lowering ends on one. Worth keeping in mind: the emitter tolerates per-instruction failures (it marks their writes missing and goes on), so a value's reason is often the reason of an instruction several steps earlier - that is why every gate I tried looked right and changed nothing.
For the four
CSComputeSkinningPedBlendShapes*programs the chain is:So the mask is copied out of EXEC at the entry block (
s_mov_b64at 0x2c), saved and restored (s_and_saveexec_b64), inverted (s_andn2_wrexec_b32) and finally selected on (v_cndmask_b32) - and every one of those steps is a mask operation whose value the emitter has no number for. The read that finally kills the program is the select, but the missing thing is the entry EXEC.Seven attempts, each built and checked against the whole pack (26 084 programs, ~45-50 s), each leaving it bit-identical (5 refusals, DXIL 14 246) and each reverted:
getfalls back to the emitter's bit (lane_bits);s_cbranch_execz/execnzmay read masks ininst();mask_okforced true for a block's branch;v_readlane_b32may read masks;boolean(when)swallowsLANE_MASK(branch taken);v_cmp_*writing its mask to VGPRs gets the ballot dwords;Atom::Laneof the entry EXEC reads as "all lanes active".Where that leaves it: the emitter has no number for the entry EXEC because it never records the exec mask as a mask in
structure's tables for these programs (x.st.maskshas the value at the branch, but its provenance is an instruction that already failed). The next attempt should therefore start from the entry EXEC's structure entry rather than from the branch, and the disassembly of the native code at 0x2c/0x1764/0x1794/0xcf8 of one program (CSComputeSkinningPedBlendShapesVelocity) is the cheapest way to see what the console compiler was doing.State: branch clean at
1e49107,victory-shader302 tests green, clippy clean, corpus 5 refusals / 14 246 DXIL as before.@steven-seagull27 on GitHub · 2026-11-26 11:36 UTC · original
@pes7 Your four opcodes were enough to reproduce the compound branch refusal on
1e49107with a synthetic guest Wave64 compute shader. The wave width and register operands of one skinning variant would tell us whether this is the same failure.I copied entry EXEC into
s[20:21], narrowed it withs_and_saveexec_b64, rans_andn2_wrexec_b32 s24,s20withs25initially zero, restored EXEC, then useds[24:25]as the condition ofv_cndmask_b32. Feeding the selected value into a compare and thens_cbranch_execzgave “a lane mask read as data” before pipeline creation. This reproduced with both 8 and 40 lanes selected initially. Runnable synthetic case and controlThe entry EXEC pair and its saved copy were both structurally
Bool::TRUEin this fixture. At the select, the WREXEC low result hadother=Some(Bool(3)),pair=Noneandstored=a lane mask read as data. The high register still held numeric zero. Both the branch and a separate store traced the propagated failure back to WREXEC. That gives us a way to distinguish a missing entry mask from a lost low/high pair downstream.Changing only WREXEC to its B64 form let all six guest-Wave64 controls run. 384/384 lane values matched on each of RTX 5080, inbox WARP and WARP 1.0.22. B32 and B64 write different halves, so each form has its own expected output. The host wave width was unpinned.
Could you post the guest wave width and the four decoded instructions with operands from one named variant? The decimal offsets from the ring (44, 5988, 3392, 3452) convert to
0x2c, 0x1764, 0xd40, 0xd7c. The last two differ from the offsets listed at the end of the addendum. One variant’s text is enough.If convenient, my opt-in offset diagnostic prints those operands, SSA reads/writes and mask-pair state only when a lane-mask refusal escapes. The branch includes the earlier producer trace and is based on your
1e49107. From a checkout of that branch, use the same translate command as before with:I validated the diagnostic on both branch and store refusals. All local shader inputs were synthetic. AI-assisted with Codex.
@pes7 on GitHub · 2026-11-26 11:40 UTC · original
Progress log, part 33 - the refusal now has an ordered list, and its first entry is not where the message points.
Two switches are in the branch (
433d49b, diagnostics only, read at run time):VICTORY_ONLY=@0x<offset>-translate --listtranslates just that container;VICTORY_TRACE_FAILS=1- every instruction the emitter gives up on, with offset, block, reason and reads.For
CSComputeSkinningPedBlendShapesVelocity(@0xbe8bb1f) that gives the whole story in order:So the first thing that cannot be done is
s_mov_b32at 0x5c copying the exec mask's low dword (S(126), the entry value 8) into a register - and everything after it is fallout. The program's own error is reported 2 000 words later, at the branch.Five more attempts were measured against the pack and reverted, all bit-identical (5 refusals, DXIL 14 246):
mask_dwordfalls back to the emitter's bit, then to "the entry exec is all lanes";get, before it refuses;is_maskno longer gated bymask_okinget;bit_masked(ballot of the bit) shared by both callers;mask_dword, before the structure's table.With the trace on, the failing
s_mov_b32does not go throughi32_of(a probe there logs other values, never Value(8)), so the refusal comes from the SOP1 move's own mask path rather than fromget. That is the piece to instrument next: probemask_dwordand the scalar-move handler together, withVICTORY_ONLYset, and see which of them produces the reason for that one instruction.Branch
fix/prologueat433d49b;cargo test --release --workspace30 suites, 0 failures; clippy-D warningsclean across the workspace.VICTORY_ONLYandVICTORY_TRACE_FAILSfor one program's refusals 433d49b165A program's refusal is usually not the instruction the message names: the emitter gives up on an instruction, marks its writes missing and goes on, so a branch can report a reason that came from something dozens of instructions earlier (the prologue's character skinning reports `s_cbranch_execz` at 0x14dc while the first thing it cannot do is a mask copy at 0x5c). Two switches for that: - `VICTORY_ONLY=@0x<offset>` (`translate --list`): translate only that container, so one program's log is its own; - `VICTORY_TRACE_FAILS=1`: log every instruction the emitter gives up on, with its offset, block, reason and reads. Together they give the ordered list, which is what says where to look: FAIL s_setreg_imm32_b32 at 0x1c (block 0): a register the emitter does not model FAIL s_mov_b32 at 0x5c (block 1): a lane mask read as data reads [(S(126), Value(8))] ... Both are read at run time only, so a normal run pays nothing.@steven-seagull27 on GitHub · 2026-11-26 11:47 UTC · original
@pes7 I tested the SOP1-vs-
mask_dwordquestion from part 33 on433d49b. Boths_mov_b32entries can logFAILin a shader that executes correctly. My synthetic fixture put consecutive copies of entry EXEC_LO at0x5cand0x60. Both destinations were tracked masks.Lower::soptherefore returnedLANE_MASKbefore reading the source, and neither copy calledi32_oformask_dword. The branch/restore control still matched 40/40 output words on each of RTX 5080, inbox WARP and WARP 1.0.22 (groups of 8 and 32).Making a subsequent vector move consume the saved register as data invoked
mask_dwordon the copied SSA value, not the original entry value. On the RTX 5080 all eight lanes read0xffin the partial group and all 32 read0xffffffffin the full group. That distinction explains how a probe watching onlyValue(8)could miss the numeric consumer in a case like this.I put the requested 27-line diagnostic on your exact head. It prints the decoded source and destination, the destination SSA ID, whether the move took the structural or numeric path, and the SSA ID of each actual
mask_dwordcall. To use it on your branch:With your usual diagnostics-enabled
translate --listcommand, the useful excerpt is the twoEXEC movelines at0x5c/0x60and anyEXEC numericlines referencing their destination IDs. That would identify which path this particular game shader takes. The earlier mixed-width case remains a separate synthetic reproducer. AI-assisted with Codex.@pes7 on GitHub · 2026-11-26 12:14 UTC · original
Progress log, part 34 - the gate is found and measured; the change that opens it needs the join redesigned first, so nothing is kept.
The gate.
lower.rs,sop(): after computing the destination, it refuses outright -so any scalar op that writes a lane mask is refused: the copy of EXEC at the top of the character-skinning programs,
s_and_saveexec_b32, a mask combine. That refusal is what the branch finally reports.What opens it. Lowering the mask the op leaves behind - the structure's boolean for every mask register it writes, the destination's bit for writes the structure does not name - instead of refusing. Measured over the whole pack, per program, against a baseline taken with the change stashed:
Exactly the four intended programs, nothing else. (For scale: with an additional shortcut that makes an untracked mask join contribute no lane, 17 program lines change - these four plus thirteen
CS_RTShadowTrace*ray-traced-shadow programs that refuse the same way today.)Why it is not kept. The emitter's mask joins are the contract that keeps the approximations honest, and the two sides of it are pinned by tests that my change breaks one each way:
emit::lower::tests::a_scalar_result_needs_no_execfails ("a lane read under an EXEC with no mask" now refuses);emit::synthetic_tests::a_compare_mask_joined_with_data_on_the_skip_edge_is_0_therefails;CS_IrradianceCache_Shade(which translates today) starts refusing.So the piece to write next is the join itself (
pending_masksinfill_phis): it must tell a mask register reused as data on one edge (the case those two tests describe) from a mask joined with a mask. The four skinning programs give it a target and the two tests give it a contract; the change above is onegit stashaway and is exactly four programs wide.Reverted: branch
fix/prologueat433d49b, 302victory-shadertests and 30 workspace suites green, clippy clean.@pes7 on GitHub · 2026-11-26 12:27 UTC · original
Progress log, part 35 - the join's contract is now written down exactly, from the tests themselves, and the one place a fix still dies is named.
Four variants were built and measured; each one satisfies part of the contract and breaks another part, so nothing is kept:
a_scalar_result_needs_no_execa_compare_mask_joined_with_data_on_the_skip_edge_is_0_thereThe contract, from the two tests:
..._joined_with_data_on_the_skip_edge_is_0_there, first half;s_and_saveexec) joined with data must stay refused - the same test's second half (a mask holding lanes off its edge joined with data translatedpanics otherwise);v_readlanemust not create a lane-mask phi at all -a_scalar_result_needs_no_exec.Where the clean fix dies.
sop()can lowers_mov_b32 sX, exec_lofrom the structure's boolean, and that is exactly what the fourCSComputeSkinningPedBlendShapes*programs need (measured: 2 658 -> 2 662 compute programs, four lines changed, nothing else). But when the destination's boolean is itself a join, evaluating it registers a mask phi inpending_masks, and if one of that phi's edges is untracked,fill_phisturns it intoErr(unsupported(...))- fatal for the whole program, where the old refusal was merely tolerated (the instruction's writes marked missing). That is whya_scalar_result_needs_no_execfails in every variant that lowers the copy.So the missing piece is in
pending_masksitself: a phi registered because a mask was read as data must not fail the program when an edge is untracked - it should fall back to the tolerated path (the value stays a number, EXEC drawn from it only guards av_readlane). With that, variant 2's numbers (+4 programs, 0 other lines) should hold with both tests green.Branch
fix/prologueat433d49b, clean; 302victory-shadertests and 30 workspace suites green after the revert.`sop()` refused every scalar instruction whose destination is a lane mask - if inst.write(Reg::S(EXEC)).is_some() || self.is_mask(lo) { return Err(LANE_MASK); } - so a program that copies exec before its first branch was refused at that branch, and the whole pipeline was dropped. That is the prologue's character skinning with blend shapes (`CSComputeSkinningPedBlendShapes`, `...SecMotion`, `...Velocity`, `...SecMotionVelocity`), dropped four dispatches a frame in the scene where the play run then stands still. Now the op lowers the mask the structure already has for what it writes, instead of refusing. Three details make it hold: * only the writes the structure names as masks get a bit; a write it does not name (the saved exec of an `s_and_saveexec`, a register the compiler reuses for data) carries the destination's mask, because the branch that follows would otherwise read a value with no definition at all; * a phi registered while such an evaluation runs is *lenient*: an edge the structure cannot name gives it no lanes instead of failing the program, so `a_scalar_result_needs_no_exec` (a copy of exec that only guards a `v_readlane`) keeps translating; * every other mask join keeps its refusal, so a mask holding lanes off its edge joined with data still does not translate (`a_compare_mask_joined_with_data_on_the_skip_edge_is_0_there`, second half). Measured over the whole shader pack (`translate --list`, 26 084 programs), against a baseline taken with this change stashed: before 25889 program lines, after 25889 only before: 4 only after: 4 (the same four, now emitted) compute programs 2658 -> 2662 Nothing else changes. `cargo test --release --workspace`: 30 suites, 0 failures; clippy `-D warnings` clean. `lower.rs` is at the repository's 512 KiB asset-policy limit, so the two new methods live in `emit/lower/masks.rs`.VICTORY_KEYSentries can hold a key, so a run needs no window focus a4228565e3`VICTORY_KEYS=<seconds>:<key>` held each key for 200 ms, which is enough for a menu press and not for walking. The entries now take a third field, the hold in milliseconds: VICTORY_KEYS=200:W:6000,215:A:1200,10:Enter:300,20:Enter:300 Both the keyboard device and the stand-in pad see the keys (the HLE merges them in `poll`), so a run can be driven while the title's window stays in the background: nothing calls `SetForegroundWindow` or `keybd_event`, and the person using the machine keeps their focus. Enter is the pad's A and W the left stick up, so the account screen, the menu and walking all work this way. First run with it (`nofocus`): the title reached the world without any window activation - 1 862 draws/frame at 153 s, 4 657 at 196 s - where every earlier driver had to attach to the window's input queue and steal focus at 15/40/70 s.@pes7 on GitHub · 2026-11-26 13:47 UTC · original
Attribution of the prologue's GPU time, measured - and why cutting the biggest pipeline would not move the frame.
The no-focus run (
prologue, 1 200 s,VICTORY_KEYSonly) gave 477 world frames, 0 removals, 0 exceptions, and its per-command report (VICTORY_GPU_STAMPS+ DRED, one line per command over 200 ms) names every pipeline:compute 39f0e9aeb156a61ccompute 5cf00dc39042edafcompute df11dcd012cd7382compute 3df629ffc3d0a2a6compute 8cb27ccf2d50c606compute 34fb51b8a0312e82compute 0a5ecfee6b79e13bTwo things fall out of it:
compute 3df629ffc3d0a2a6is one 9.3 s dispatch in the whole run (a bake during loading), not a frame cost.So an optimization aimed at
39f0e9aeb156a61cwould be worth ~7 % at best, and the shape of the data says the cost is per-command overhead (binding, descriptors, barriers) rather than one bad shader. That changes what to attack next, and it is why nothing is committed here: a shader-level micro-optimization would not have shown a frame-time win.39f0e9aeb156a61citself, for the record: 24 896 IR lines,NumThreads=(32,1,1), 3 600 groups a dispatch, five translated loops, 464waveReadLaneFirst, 170 raw buffer loads, 26 atomics - a coarse BVH-style pass whose cost is the work it is asked for.Next, in this order: (a) count what the 1 400-6 000 draws and ~31 barriers a frame each cost, with the same report (it logs a command only above 200 ms today, so the threshold has to come down for a frame's worth of commands); (b) the per-frame CPU side - 1 192 root-view slots, 533 k heap slots and 1.5 GB of copies - where the numbers are already in the frame line.
VICTORY_GPU_REPORT) 621935a8caThe batched report named two commands a list, and only for submissions over 200 ms, so a frame's ~350 commands were ranked by their two longest - which is why the biggest pipeline looked like 44 % of the frame when it is 7 %. Two switches now say how much to list and when: VICTORY_GPU_REPORT=40 commands per list (default 2) VICTORY_GPU_REPORT_MIN_MS=250 submission length that triggers it (default 200) With 40, a 1 150 ms submission lists 354 commands summing to 1 144 ms, i.e. the report accounts for the submission's whole time. On the prologue's frames it gives the family table the next optimization needs - no single shader: indirect 25ebc92075b62822 2 453 ms (an indirect draw: geometry) dispatch 39f0e9aeb156a61c 2 019 indirect 7a071f906f98311b 1 749 draw 05e958b19269d596 1 126 dispatch 5cf00dc39042edaf 538 mesh 04b9be3756e8f41c 475 over the sampled submissions, each family 200-600 ms of a ~3 s frame: geometry and compute in similar measure, not one bad pass. Diagnostics only (the switches are read at run time, nothing changes without them); clippy `-D warnings` clean, `cargo test --release -p victory-gpu` 231 passed.@pes7 on GitHub · 2026-11-26 13:58 UTC · original
The report now ranks a whole submission (
621935a8), and the frame turns out not to be one bad pass.Two switches:
VICTORY_GPU_REPORT=<commands per list>(2 by default) andVICTORY_GPU_REPORT_MIN_MS=<submission length>(200 by default). WithVICTORY_GPU_REPORT=40on a 1 200 s no-focus run (149 world frames, 0 removals, 0 exceptions, frames 2.9-3.4 s at 4 800-10 400 draws), a 1 150 ms submission lists 354 commands summing to 1 144 ms - the report accounts for the submission's whole time, so its ranking is now a budget.The families, over the sampled submissions:
indirect 25ebc92075b62822(an indirect draw: geometry)dispatch 39f0e9aeb156a61cindirect 7a071f906f98311bdraw 05e958b19269d596dispatch 5cf00dc39042edafmesh 04b9be3756e8f41cEach family is 200-600 ms of a ~3 s frame: geometry and compute in similar measure. That is why nothing was committed as an fps fix this turn - the earlier "39f0e9aeb156a61c is 44 % of the frame" reading came from ranking only the two longest commands per list, and the biggest single family is
indirect 25ebc92075b62822, a vertex shader driven by an indirect draw.Next, concretely: the vertex shader behind the indirect draws (25ebc…) and the indirect dispatcher (7a07…) are now the two candidates with the largest budgets; the geometry side is where our translation adds the most per-vertex work (typed buffer fetches read as raw bytes and converted per component), so that is the first thing to time against the console's form.
Verification:
cargo test --release -p victory-gpu231 passed, clippy-D warningsclean; the switches are diagnostics-only, read at run time.VICTORY_ONE_BARRIER,VICTORY_NO_BARRIERS) 2810c8d98eEvery indirect command is clamped by a compute dispatch between two global unordered-access barriers, and the world runs 2 600 of them a frame - so the barriers are a candidate for a large part of a frame. Measuring them needs an A/B that keeps the commands running, which `VICTORY_NO_CLAMP` could not: it returned `None`, the command was dropped, and the run then compared a frame with 5 018 indirect commands against one with none. Two switches replace it, neither changing anything unless set: VICTORY_ONE_BARRIER=1 after the clamp, only the transition out of unordered access (which already flushes that buffer) - the global barrier after it ordered nothing the command needs; VICTORY_NO_BARRIERS=1 both global barriers gone: the ceiling of what they cost together, for the measurement only (the title's writes then need not be visible to the clamp). `VICTORY_NO_CLAMP` is removed: it measured a different program. No numbers claimed: the A/B was started and stopped early (base 47 and 13 world frames, one-barrier 3), so nothing here says the change is faster. It says how to find out.VICTORY_ALLOW_COPYBACK) 2fc6a2926aEvery world frame of every run so far reports the same three numbers: 0 pages copied back, 20 000-31 000 withheld, missed 70 000-112 000 pages and 27-50 region marks with no copy (first: 0x740000000 0x750000000 ...) `copy_back` withholds *all* of a frame's write-backs as soon as one page of title memory was read by a shader with no copy (`withholding()`), and that is the state of every frame: the title reads 0x740000000-0x780000000 - a gigabyte with no host copy - so * the title's memory never receives what its shaders wrote, and the host copy the title's own reads are answered from (and that a refresh pushes back) is what the GPU wrote a while ago or never; * the per-frame work is real: 100 000 page marks read back and walked, 20 000 pages dropped, every frame. Whether that is what keeps the game from advancing (the prologue's first scene waits for input and never moves on) cannot be told from the logs. The new switch copies back even while pages are missing, so one run says it: VICTORY_ALLOW_COPYBACK=1 Diagnostics only: the rule above is unchanged unless the switch is set. No behaviour change and no numbers claimed.Every world frame reports thousands of pages of title memory a shader read with no copy (`memory`'s frame line), and the first four addresses have been the same four gigabyte-apart regions for every run - so the next question is what those addresses are, which the line could not say. `shadow::describe(address)` answers it: the registered title buffer that holds the address and whether a copy of it was made, or how far the nearest registered buffers are. The first four missed pages of a frame log it at `debug`: title memory a shader read with no copy page=0x740000000 what="no registered title buffer at 0x740000000; nearest below ..." That separates "the title never registered a buffer there" (a use we do not translate into a buffer access at all, so no copy exists to make) from "the buffer is registered but its copy was never made or was released". Diagnostics only, no behaviour change, no numbers claimed.@pes7 on GitHub · 2026-11-26 14:38 UTC · original
Two things came out of reading the existing runs' logs (no new runs — the machine's user is playing games, so I stopped the A/B I had started and will measure later).
The frame is not per-draw
7× the draws for 1.3× the time. So per-draw overhead is not the shape of the cost: there is ~2 s of fixed work per frame plus a modest per-draw term. That agrees with the full-submission report (top 80 commands ≈ 1 400 ms of a 2 900 ms frame):
compute 39f0e9aeb156a61cdispatch 28918b7150a7aad5indirect 25ebc92075b62822indirect 7a071f906f98311bBoth 24 000-line shaders (
39f0e9aeb156a61c,7a071f906f98311b) were dumped and read: 170/474 raw loads, 464/24waveReadLaneFirst(the console's owns_mov … readfirstlane, not our waterfall loops), 5/7 loop counters, heap clamp asicmp+selectper access. No translation bloat — they are the work they are asked for, so a shader-level micro-optimization is not where the frame is.Nothing is ever copied back to title memory
Every frame of every run reports the same three numbers:
memory::copy_backwithholds all of a frame's write-backs as soon as one page was read by a shader with no copy, and the title reads 0x740000000–0x780000000 — 1 GiB with no host copy — in every frame. Consequences:Whether this is what keeps the prologue's first scene from advancing is now a question with an answer, not an argument:
and
shadow::describenow logs, for a frame's first four missed pages, what the title registered there — "never registered a buffer" (a use we do not translate into a buffer access, so no copy can exist) versus "registered but the copy was not made".Committed here (all diagnostics, nothing changes unless set)
2810c8d9—VICTORY_ONE_BARRIER/VICTORY_NO_BARRIERSfor the clamp's two global UAV barriers (2 600 indirect commands a frame, each one record);VICTORY_NO_CLAMPremoved, because it dropped the commands instead of measuring them.2fc6a292—VICTORY_ALLOW_COPYBACK.c99ebaba—shadow::describefor a missed page.No fps claim: the barrier A/B was cut short (base 47 and 13 world frames, one-barrier 3), so it measured nothing. Clippy
-D warningsclean onvictory-gpuboth with and withoutdiagnostics; a diagnostics build ofvictorysucceeds.Whether a frame draws the scene several times over is not visible from the draw count: the world reports 5 000-10 000 draws a frame for a prison cell, which is a few hundred on a console, and the frame line said nothing about what those draws cover. `take_work` counts, per frame, vertices (`DrawInstanced`), indices (`DrawIndexedInstanced`), dispatch threads (groups x 64) and mesh groups (x 128), and the report logs them: work a frame: 96 000 vertices, 74 000 indices, 734 000 dispatch threads, 5 700 mesh groups The counters are the two atomics a draw already pays (`DRAWN`); the line is printed by the diagnostics report, beside the draw count and the dropped ones. Indirect records are not counted here - their arguments are read out by `VICTORY_DUMP_ARGUMENTS`, which names the work per record. No behaviour change; the numbers are what the next run is for.VICTORY_ALLOW_COPYBACK's comment carries what it did when run 1592af0c5bView 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.