Repository navigation
Conversation
catminou4
left a comment
There was a problem hiding this comment.
gfx10::Instruction.words moves from a heap Vec<u32> to an inline [u32; MAX_WORDS=5] + len, with a decode-time guard rejecting instructions longer than the budget. All call sites (fields.rs, sp3.rs, apps/victory disasm) converted to words(); the public field removal is workspace-internal. Existing gfx10 decode tests stay green on macOS (96 passed). Nice allocation win for shader-heavy paths — consider a quick cargo bench-style before/after if you have one.
…, #188) Integrates selected runtime, GPU, and shader fixes from FulGerNet/macca-cl (cd81e89, GPL-3.0-or-later) plus remaining clean upstream PRs on top of origin/main (da435f1): From FulGerNet/macca-cl: - console_insn.rs: mwaitx yields (std::thread::yield_now) instead of spinning with pause so waiting threads do not starve video/audio/pipeline workers. - texture.rs: mark view-aliased textures (Bink intro video frames) so they hash on every refresh rather than every 8th frame. - pipeline/make.rs: VICTORY_PIPELINE_THREADS override, 3/4 core default (2-8), early prewarm at THREAD_PRIORITY_LOWEST and draw-requested at NORMAL. - pipeline/library.rs: per-writer atomic cache staging files (+2 tests). - shader_cache.rs & emit/{mod,shader}.rs: key translated shader cache by translation_limits() (host_max_wave + view_heap_limit) and wave/strict env options (+test), plus DXIL validator warning pass (VICTORY_DXIL_STRICT=1). - emit/{mod,lower}.rs: last-resort wave-wide compute fallback on 32-lane hosts before WaveSize(64) (VICTORY_WAVE_WIDE=0 disables), plus mixed flat and interpolated input row lowering (+test). - draw.rs, list.rs, queue.rs: host heap COM-pointer tracking (ABA guard), root-signature invalidation, recycled transient table submission guard, and initial pipeline bind on list creation (+3 tests). - kernel.rs & xgame.rs: CP_ACP ANSI path encoding for GetModuleFileNameA and XLaunchNewGame (+test). From upstream PRs: - fxceless/victory-fork#25: uniform control-flow immediate samplers (+test). - fxceless/victory-fork#24: cap constant buffer views at 64 KiB (+test). - fxceless/victory-fork#23: gameinput reading history 32 -> 256. - Marvisak/VIctory#1623: inline GFX10 instruction words (+from_word helper). - Marvisak/VIctory#188: SSE2 16-byte TLS scan at startup. Verified on Windows 11, RTX 4080 16 GB (Wave32), Ryzen 7 7800X3D, 32 GB RAM: - cargo xtask policy --staged: 22 files ok - cargo clippy --workspace --all-features --lib --tests -- -D warnings: clean - cargo test --workspace: 0 failures (215/215 victory-shader passed) - Live 2560x1440 diag run (VICTORY_DISPLAY_MODE=2560x1440): smooth Bink intro video at 30.0 fps (33.3 ms/frame, 12.7 MB/frame texture streaming, 0.4 ms GPU, 0 dropped draws) -> UI Text Size setup screen (25.4-30.0 fps, 7.1 GB private, 552 MB VRAM), 0 crashes (crashes.log empty). Fixes #6 Fixes #8
e9254f2 to
72eff75
Compare
Marvisak#1180 and Marvisak#1623 both change `Instruction`, so they conflict with each other in `gfx10/mod.rs`: this branch is stacked on `perf/instruction-name` (Marvisak#1180) so that whichever lands second still applies. The two are independent in what they save and compose without a trade: `words` stays the inline `[u32; MAX_WORDS]` with `len` (Marvisak#1623), and `name` stays resolved once at decode (Marvisak#1180), so an instruction carries both and neither costs the other its win. Merge Marvisak#1180 first; this diff then shrinks to the `words` change alone.
|
Heads up before merging: this PR and #1180 conflict with each other in This branch is stacked on
The resolution keeps both wins, since they are independent: words: [u32; Instruction::MAX_WORDS],
len: u8,
/// [`name`] of `encoding` and `opcode`, resolved once at decode time.
name: Option<&'static str>,Verified on the stack: |
Translation speed (compile-storm CPU): Marvisak#1623 inline instruction words (decode -18..-45%), Marvisak#1834 VALU names without heap vector, Marvisak#1833 live-set bit walk, Marvisak#1802 relative shift bounds, Marvisak#1824 dx.op declarations once. Per-draw/per-list CPU: Marvisak#1825 view-stride table once per list, Marvisak#1826 object names only where logged, Marvisak#1800 capped-heap log spam once per 64Ki. Tooling: Marvisak#1809 list pipeline keys without cache init. Locking: Marvisak#1680 pipeline library loads without the global mutex. Held: Marvisak#1819 (2^20->2^14 loop bound) breaks transcendental convergence tests (sin/cos/exp/sqrt) — accuracy-lowering, rejected per policy.
|
Automated triage for the maintainers. Merge candidate. Re-reviewed at On your reply: confirmed, that was the one change needed. CI: Generated by Claude Code |
13eece9 to
246c928
Compare
|
Real corpus, same method as the note on #1002: the Xbox build's
-1.2% is at the bottom of the -1..-5% the PR claimed on synthetic programs, which is what one would expect: the allocation it removes is one per instruction, and decode is a small part of a translation. The output is identical to That the two PRs are -3.2% and -1.2% rather than overlapping noise is also a check on the method: they were measured in the same window as the control. |
|
Automated triage for the maintainers, second look (a review against This is right as reviewed (an instruction's words fit inline; the tests pass). It no longer builds on Push the change and it will be reviewed again. Thank you for the contribution. |
One `Vec<u32>` per instruction was one allocation and one cache miss for the dword or two most instructions have. The words live in a fixed `[u32; MAX_WORDS]` with a length now: five dwords covers the longest instruction here (an MIMG with its three extra address dwords), and the decoder refuses anything longer rather than truncating it. Decode -18..45% depending on program size; whole translation -1..5%, since decode is a small part of it. Now that Marvisak#1180 is in `main`, this applies on its own: an `Instruction` carries both the inline `words`/`len` and the cached `name`, and neither costs the other its win. cargo test --workspace --locked; both clippy configurations with -D warnings; cargo xtask policy.
246c928 to
cc2a2bd
Compare
…visak#2143 added Marvisak#2143 (merged today) reads `i.machine.words.len()` in `code_table_start`, and this branch made `words` an inline array behind an accessor, so the two textually disjoint hunks do not build together. The accessor returns the slice, so `.len()` is the same number; no behaviour change.
|
Rebased onto today's No other file needed a change: the rest of the branch applies as it was. |
Every GFX10 instruction owns a heap vector for its one or two dwords. They fit inline - the longest instruction here is five dwords - which takes 18-45% off
decodeand 1-5% off a whole translation, with byte-identical output.Instruction::words: Vec<u32>is built withcollect()in the decoder, so every decoded instruction makes one allocation for one to five words of data, and reads them back through a pointer. #1002's counter put it at 1.17 allocations and 149 bytes per instruction - the single largest allocation source in decode.What changes
words: [u32; Instruction::MAX_WORDS]pluslen: u8, andwords()returns the slice.MAX_WORDSis 5 because that is the longest instruction the decoder produces: an MIMG with its three extra address dwords (2 + ((w >> 1) & 3)); VOP3/VOP3P with a literal is 3, everything else 2 or 1. A longer instruction is now a cleanIsaerror rather than a silent truncation.The struct does not grow:
Vecis 24 bytes,[u32; 5]+u8+ padding is 24.Call sites move from the field to the accessor (8 in
gfx10/mod.rs, 1 insp3.rs, 2 infields.rs).Measured
Bench from #1002, standalone against
mainffe310e(not stacked on the other PRs), twelve interleaved rounds per arm, best of each, nanoseconds per instruction:decodebeforeHonest about the shape:
decodeitself is 18-45% faster, but the whole translation is 1.2-5.1%, and the gain shrinks with program size - at 16 k instructions it is inside the run-to-run spread of this machine. What it buys beyond the CPU time is one allocation and one indirection per instruction gone.Applied on top of #1002 + #1033 + #1180 the same change measured 0.929-0.957 of the translation, because the per-instruction constant those three leave behind is smaller and the removed allocation is a larger share of it. Both numbers are real; this one is the one that stands alone.
Correctness
cargo test --workspace --locked: 342 passed, 0 failed, 7 ignored.-D warnings;cargo xtask policy.No game data used. Four files, +38/-16; independent of #1002, #1033, #1180 and #1556.
What it gives (to decide the merge): an instruction's words are kept inline (
[u32; 5]) instead of in a heap vector: decode -18..-45 %, translation -1..-5 % (the numbers in the description).State: MERGEABLE, CI
checkgreen, rebased onto today'smain(f3578e3).Risk: rebased for #2143 (
words().len()through the accessor); 302victory-shadertests pass.