Shaders: one arena per program for instruction operands and effects #1757
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!1757
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-1757"
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?
@Luislariosss on GitHub · 2026-11-24 22:00 UTC · original
Luislariosss:perf/ir-instruction-arena→main· +832 −477 · 12 files · 1 commits · openFIND-1 (claimed here): translating one instruction still cost about five heap allocations (~180 ns of ~880 ns per instruction) — the decoder's Vec of source operands and
Inst'sreads/writesVecs, each built from a temporary Vec, pluseffects()' scratch and dedup buffers. This replaces those Vecs with one arena per program.What is in it
Fields' variable-length lists (Sop.src,Ds.data,Image.addr,Valu.src) are nowgfx10::Span { start, len }intoProgram::operands: Vec<Operand>;Inst.reads/Inst.writesare spans intoProgram::effects: Vec<(Reg, Value)>.Instruction::fieldstakes the arena to append to;ir::buildreuses one scratch pair for the per-instruction register lists, so the decoder andeffectsstop allocating per instruction.Program::operands(span)andInst::reads/writes/read/write(&Program, ..).Exp.srcstays a fixed array;Instruction.wordsis unchanged (per instruction, out of scope here).Inst,FieldsandProgramstayClone/PartialEq/Eq/Debug; the offlinevictory translatepath is adapted as well.ir::tests::operand_and_effect_spans_slice_back_each_instructions_lists: 0, 2 and 3 sources, an implicit VCC operand, reads/writes order, and no gaps in either arena. A second testir::tests::split_block_copies_get_their_own_effect_spanspins the block-split path: the split copy's spans do not overlap the original's, its write values differ, and renaming through one copy leaves the other unchanged.Tested
rust-toolchain.toml).cargo test --workspace --no-fail-fast: 478 passed, 0 failed, 7 ignored at this head (29d5f6e, rebased onto upstream70564ae). Upstreammainalone on the same machine: 476 passed, 0 failed, 7 ignored — the difference of two is the two new tests, so no upstream test regressed. The GPU-executedvalu/waterfalltests ran on the RX 9060 XT (no GPU skips on this adapter).cargo clippy --workspace --all-targets --locked -- -D warnings: clean.cargo check --workspace --all-targets: passed.CARGO_PROFILE_DEV_DEBUG=0 CARGO_PROFILE_TEST_DEBUG=0— rustc 1.98.1 here dies with 0xc0000005 while compiling with debuginfo; the test behavior is unchanged by that.Not tested / not measured
Instruction.wordsand the other per-instruction Vecs the finding names remain, out of scope here.AI use
FIND-1: translating one instruction still cost about five heap allocations (~180 ns of ~880 ns): the decoder's Vec of source operands, and Inst's reads and writes Vecs, each built from a temporary Vec, plus effects' scratch and dedup buffers. Fields' variable-length lists (Sop.src, Ds.data, Image.addr, Valu.src) are now a gfx10::Span { start, len } into Program::operands, and Inst.reads/writes a Span into Program::effects. Instruction::fields takes the arena to append to. Readers go through Program::operands(span) and Inst::reads/writes/read/write(&Program, ..). ir::build reuses one scratch pair for the registers of each instruction and drops the operands of dropped instructions. Node splitting copies a block's effects spans so each copy still renames its own values. Exp.src stays a fixed array; Instruction.words is unchanged. No behavior change. Inst, Fields and Program stay Clone/PartialEq/Eq/Debug. Tests: cargo test --workspace --no-fail-fast: 478 passed, 0 failed, 7 ignored (upstream main alone: 476 passed, 0 failed, 7 ignored; the difference is the new operand_and_effect_spans_slice_back_each_instructions_lists and split_block_copies_get_their_own_effect_spans). cargo clippy --workspace --all-targets --locked -- -D warnings is clean. The allocation count and the ns per instruction were not measured (no counting allocator in the tree).@DesertGamer on GitHub · 2026-11-24 22:14 UTC · original
VIctory V2: community PRs, merged and tested
Open PRs sitting in the queue? V2 pulls them into one build, screens each one (binaries, build scripts, hooks, new deps) and runs tests after every batch.
Where it stands today: launches, runs the menu at 30 fps, plays the intro video, reaches the start screen and loads the world (~50 s). Entering the world is the current blocker: rendering fails with a GPU "device removed" error (tracked in issue #1).
⚠️ Entering the world on a real GPU can hang it and make Windows reset the driver. Try it at your own risk.
Not playable yet, but every batch of merged fixes moves it closer. If you have a PR that's stuck, or a GPU to test on, I'd love your help:
https://DesertGamer/VIctory-V2
Unofficial community fork of Marvisak/VIctory, GPL-3.0.
@upipibi on GitHub · 2026-11-24 23:05 UTC · original
NVIDIA counterpart to the RX 9060 XT runs: RTX 3070 8 GB, driver 616.56, Windows 11, debug,
29d5f6e(onmain70564ae).cargo test -p victory-shader --locked: 208 passed, 3 failed, 2 ignored. The 3 are #1744's NVIDIA heap-cap failures onmain, so there are no new failures from the arena change.AI-assisted (Claude Code). Synthetic tests only.
@Marvisak on GitHub · 2026-11-25 03:40 UTC · original · edited 2026-11-25 22:18 UTC
Automated triage for the maintainers.
Needs rebase. This PR no longer merges cleanly into
main(conflicts incrates/victory-shader/src/emit/lower.rs,ir.rsandstructure.rs). It will be reviewed again once it is rebased.From the earlier needs-work note, still open: a green CI
checkat the head, and a before/after timing (e.g.translateover a synthetic corpus) for this wide refactor.Generated by Claude Code
View command line instructions
Manual merge helper
Use this merge commit message when completing the merge manually.
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.