Repository navigation
Conversation
|
Substantial and mostly verified — the Two things to untangle before merge:
|
|
Progress log, continued (the branch is #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 ( 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 Everything above is one run away from reproducible: |
|
Code review and RTX 5090 + WARP check at head Several blocking issues here:
Recommend dropping the superseded |
|
Automated triage for the maintainers. Needs work (unchanged blocker). The new head The blocker in this PR is still there. CI: passing. Generated by Claude Code |
|
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 ( Skipping that one is worth ~2x on the real path (no debug layer, no per-command timing):
So 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 ( Next: the traced-record dump ( 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. |
|
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: Same run, same two skipped hashes, only
So 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 ( Still open and unchanged in the branch: nothing in this comment is a patch yet. |
|
Progress log, part 5 - the tool that shows what our translation of a bad shader is, and what it says.
What the group counts say. The trace on What the body is. A ray march with a float exit condition and the loop limit as the only other way out: with And the other two hashes are not loops at all. That means "the GPU hangs" is at least two different problems, and they need different fixes:
Tests: |
`VICTORY_DUMP_SHADER=8bbcbda6008eaa37` (or `all`) writes each named shader's DXIL to `%TEMP%\victory-<hash>.dxil` as it is translated; `dxc -dumpbin` reads it as LLVM IR. The pipeline log and the breadcrumb reports name shaders by this hash, and until now there was no way to see what our translation of one looks like - which is what a frame spent in a compute dispatch that asks for 746 tiny groups needs. Found with it in the prologue: `8bbcbda6008eaa37` (NumThreads 8x4x1) is a ray march whose exit is a float comparison and whose only other way out is the loop limit (1 << 20), and `00167d58cc5a78d7` (4x4x4) has no loops and no barriers at all yet stops the queue - two different causes behind the same "GPU hang".
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.
|
@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.
Two 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 The branch merges this exact head with @moe-miau's #2626 ( 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. git fetch https://github.com/steven-seagull27/VIctory.git codex/pr2936-packed-integration
git switch -c verify-2936-packed FETCH_HEAD
cargo test -p victory-gpu --all-features --locked --lib packed_copy_tests -- --nocaptureAI-assisted with Codex. The results here used synthetic textures. |
The pipeline log says how long a translation took but not who ran it: with the prologue's cold cache 1 725 translations of ~110 ms each add up to the 20-25 s the first gameplay frame spends, and the question that decides the fix is whether that is one thread (move it off the recorder) or the eight pipeline workers (a translator throughput problem). It is the workers: victory-pipelines-3..7 took 181-288 translations and 18 000-27 000 ms of wall time each in the same run, so the batch is already spread and the stall is per-translation cost.
|
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, 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 Dropped: copies in video memory ( 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 (
|
…sses
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.
|
Progress log, part 7 - the cold-cache stall is one algorithm, measured to the line. Phase timing in the translator (diagnostics) and
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 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. Also from the same instrument: Nothing in the release build changes: the phases are
|
|
@pes7 Your Part 6 numbers point to a concrete cold-cache A/B. I tested #2942 ( I verified that the two compiler heads together merge cleanly onto your |
|
Progress log, part 8 - the retry batching was implemented, measured, and then reverted: its own soundness check failed. What it did. 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 ( So the next step is not another run, it is a proof: dump every translated shader ( The measured shape of 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: |
|
@pes7 Correction to my earlier interpretation of the 111.9 s figure. On The synthetic benchmark called AI-assisted testing and analysis on my machine. |
|
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 Two screenshots from that run (
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: Branch |
|
Progress log, part 25 - The shader. Dumped and disassembled: A caveat I owe the record. With
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), Branch |
This reverts commit 1e53e91.
|
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 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. What that leaves: the 5-6 s dispatch ( The diagnostics that made this checkable stay in the branch ( |
|
Progress log, part 27 - the prologue now plays its own scripted scenes, and the frame cost is not the loops. What the run shows.
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: 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:
|
…pump coalescing & 16-bit/indirect completeness (Wave 29A) Adapts and integrates: - GPU-to-CPU title-window write-back with retire-ticket fencing, xmem dirty-stamp + byte-level CPU-write precedence, and LEONIDA_TITLE_WRITEBACK=0 kill switch (ubiquitarianism/leonida#2129, GPL-3.0). - Slot-133 shadow GPU-write preservation via 256-byte piece sums (LEONIDA_SHADOW_KEEP, ubiquitarianism/leonida#2163, GPL-3.0), saved-snapshot advancement after partial merge (Marvisak/VIctory#3031, GPL-3.0), and read-only hash skip for foreign PAGE_READONLY pages (ubiquitarianism/leonida#1897, GPL-3.0). - Held-batch fence-pump fix: snapshot has_shader_work / internal_staging on ExecuteCommandLists thread in VulkanQueue::Deferred and coalesce redundant back-to-back refresh_shadows() / refresh_console_heaps() inside a single QueueHolds::pump_ready() sweep when xmem epochs and shadow registry are unchanged. - Transient dedicated command-pool renewal for long recordings above LEONIDA_CMD_POOL_RENEW (default 512, Rubenpannen/VIctory-RTX5070@5df4fb3, GPL-3.0). - Complete 16-bit packed colour widening for B5G6R5_UNORM RT/UAV, B4G4R4A4_UNORM RT/UAV, and B5G5R5A1_UNORM RT/UAV (Marvisak/VIctory#2936, GPL-3.0; californiaAlmonds/OpenScarlett@ee7153c, MIT). - Compound graphics ExecuteIndirect host-visible expansion, Tier 1.1 incrementing-constant stride fix, and D3D12 state-leakage binding reset (ubiquitarianism/leonida#1937, GPL-3.0). AI-assisted; verified on NVIDIA GeForce RTX 3080 (Windows 11, VS 18 MSVC 19.51) with LEONIDA_VK_VALIDATION=1 (18/18 CTests passed, 0 validation errors).
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.
|
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 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 ( Measured, same play scenario, 560 s window:
The 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
|
|
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 ( 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 What is still in the way of a mission. The hang class. Four of the runs in this turn ended early with
|
|
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 ( 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 Branch |
…nts at
A 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.
|
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; Four programs in the entire 26 084-program pack fail this way, and they are all the same family: Also measured and rejected this turn: copies in video memory. Same play scenario, only
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
|
|
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
What the probes found, and why none of them hit:
That is the precise next step, and it is one instrumented run away: put the probe in Everything reverted ( |
|
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
Four of those are the four For the next attempt that means: the fix belongs inside Everything else stays as it was: corpus 5 refusals / 14 246 DXIL before and after every attempt, |
|
@pes7 I reproduced the compound In my fixture, 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: git fetch https://github.com/steven-seagull27/VIctory.git refs/heads/codex/pr2936-exec-branch-origin
git cherry-pick b8b7c6e108e97df83f07c56f4aee4aaf3ab5c5bd
$env:VICTORY_TRACE_LANE_MASK = '1'
cargo run --release --locked -p victory --features diagnostics -- translate --list "<your usual shader-pack path>"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. |
|
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 So the mask is copied out of EXEC at the entry block ( 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:
Where that leaves it: the emitter has no number for the entry EXEC because it never records the exec mask as a mask in State: branch clean at |
|
@pes7 Your four opcodes were enough to reproduce the compound branch refusal on I copied entry EXEC into The entry EXEC pair and its saved copy were both structurally 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 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 $env:VICTORY_TRACE_LANE_MASK = '1'
$env:VICTORY_TRACE_LANE_MASK_AT = '2c,1764,d40,d7c'I validated the diagnostic on both branch and store refusals. All local shader inputs were synthetic. AI-assisted with Codex. |
…'s refusals A 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.
|
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 (
For So the first thing that cannot be done is Five more attempts were measured against the pack and reverted, all bit-identical (5 refusals, DXIL 14 246):
With the trace on, the failing Branch |
|
@pes7 I tested the SOP1-vs- Making a subsequent vector move consume the saved register as data invoked 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 git fetch https://github.com/steven-seagull27/VIctory.git refs/heads/codex/pr2936-sop-path
git cherry-pick 45f68677f68ed02deea4d9bcc49066e91519dde8
$env:VICTORY_ONLY = '@0xbe8bb1f'
$env:VICTORY_TRACE_FAILS = '1'
$env:VICTORY_TRACE_EXEC_MOV = '1'With your usual diagnostics-enabled |
|
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. if inst.write(Reg::S(EXEC)).is_some() || self.is_mask(lo) {
return Err(LANE_MASK);
}so any scalar op that writes a lane mask is refused: the copy of EXEC at the top of the character-skinning programs, 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 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:
So the piece to write next is the join itself ( Reverted: branch |
|
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:
The contract, from the two tests:
Where the clean fix dies. So the missing piece is in Branch |
…not a refusal
`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`.
…focus
`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.
|
Attribution of the prologue's GPU time, measured - and why cutting the biggest pipeline would not move the frame. The no-focus run (
Two things fall out of it:
So an optimization aimed at
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. |
…_GPU_REPORT`)
The 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.
|
The report now ranks a whole submission ( Two switches: The families, over the sampled submissions:
Each 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 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: |
What 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.