Repository navigation
Conversation
The emitted DXIL's `main` is read back from the container (the unabbreviated records the writer makes) and counted: blocks, and instructions by kind, a call by the function called. `translate --count` prints the total, by stage and by kind; with `--list`, a line per program. The report holds counts only. So a change to the translation shows what it takes out of the code the host's compiler is given, program by program, next to the validator's verdict on each. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
DenRakEiw
left a comment
There was a problem hiding this comment.
Verified locally merged onto origin/main (940d32f, Windows 11 x64, Rust 1.98.1 MSVC):
cargo test -p victory— 12 passed, 0 failedcargo clippy -p victory --all-targets— 0 warningscargo xtask policy— ok (184 files ok)
Clean translate --count instruction counter for emitted DXIL shaders. Looks good.
AI-assisted (Gemini 4 Neon).
|
One caveat for revision-to-revision comparisons: at The synthetic bundle contained an end-only compute program, a barrier then end, and a byte-identical copy of the first. With either 1 or 3 jobs, both builds reported 3 instructions in 2 blocks across 2 emitted programs. SDK DXC disassembly showed one AI-assisted. Synthetic inputs only. |
|
Reviewed by running it twice: the number reproduces exactly, it adds up, and one line reads wrong in a report meant to be quoted This is the shared number my own triage has been missing: I have been comparing revisions by "programs that validate" and nothing else, and a count of what the host's compiler is actually handed is the metric several of the open pull requests need. So I checked the three things that make such a number usable. 1. It reproduces. Two runs over the same local 1.0.2.1 archive (26,503 containers), Byte-identical lines, and the top of the by-kind table in the same order on both runs. A metric that moves between runs is not a metric. 2. It adds up. The stage lines sum to the total exactly: I checked that because a breakdown that does not sum is worse than no breakdown — and I checked it before writing this, having first convinced myself the vertex line was missing when it was only below the 3. One line reads wrong in a report that is meant to be posted. Without — and a reader of a pasted report will take "0 validated" for "nothing passed". Two smaller notes, both positive:
What I did not verify: that the counter is right instruction by instruction — I checked that it is deterministic, that it partitions correctly by stage, and that the kinds are plausible (bitcast, select, fcmp, and, add at the top). Whether No game data is involved: counts and instruction kinds. Written with an AI assistant. |
Without `--validate` the summary read "0 validated", and without `--pipelines` "0 pipelines": zeros that a reader of a pasted report takes for "none passed". The lines now say "validation not checked" and "pipelines not made" for a check nobody asked for (review of Marvisak#2115). Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
|
Thank you both. Head is now @Dathinel: reproduced at @fiestorra: done in the second commit. Without (the first without What I ran for this update: the two runs above on a path that does not exist (no input read), AI-assisted |
… head 35cf1c4) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… summary lines say what was not checked) Conflict in apps/victory/src/translate.rs: the DXIL summary line keeps Marvisak#1315's "vertex, geometry and pixel programs" and takes Marvisak#2115's checks() wording. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…sak#2115 in; Marvisak#2150 left out for now Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
catminou4
left a comment
There was a problem hiding this comment.
Tested locally: macOS arm64, rustc 1.98.1, PR head merged into main 940d32f, cargo test -p victory-shader --locked.
148 passed / 0 failed / 2 ignored. translate --count counts emitted-instruction instructions (+4 tests) — CLI metric accuracy; mixed apps+shader+docs.
Offline measurement on a retail dumpResult: no count change against I merged head 4d34d76 onto No program changes its failure reason. The count shows that the change rejects nothing on this data. It does not show whether the output is right. No shader names or data are included, per the asset policy. AI-assisted (Claude Code). |
|
Automated triage for the maintainers. Merge candidate. Now merges cleanly. This adds CI: passing. Generated by Claude Code |
|
I addressed the instruction labels in the review with 1cf8787 on The expanded synthetic emitter test has two integer additions, one floating-point addition, and one each of floating-point subtract, multiply and divide. The old reader reports those under integer-only names. The changed reader reports the shared buckets and preserves the 27-instruction total. All four count tests, strict workspace Clippy and the asset policy passed on Windows. Please preserve the Git author if you take the commit. Claim. AI-assisted with Codex. Synthetic bitcode only. |
The writer test now runs each shared binary opcode it has in both forms (add, sub, mul, udiv, sdiv, urem against fadd, fsub, fmul, fdiv), with the float operands typed by a constant, a call's result, a field, a cast, a load, a select and a phi, and integer ops after the floats so a value id off by one would name one wrongly. It checks that the kinds add up to the instruction total (22 in 2 blocks). The record test adds a scalar half, an integer vector and a scalar integer srem, which stay integer. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Addressed the triage point in Why this option and not a combined label: the count is for comparing two translator revisions, and float and integer arithmetic move for different reasons. An @andrewpozdnakov7-jpg, thanks for Verified at
The description now says how kinds are named. The title-data table in it was counted before this change, so its AI-assisted. |
|
Recount at Local title data, offline, CPU only ( AI-assisted |
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
On the triage's non-blocking note (values not reset per
Checked: the count tests pass under WARP with one test thread (7 passed), clippy has no warnings, and the asset-policy hook passes. Synthetic test only; no title data was used for this change. AI-assisted |
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Main's 286a00e writes only instructions with effects and what they read. The tests' last values were read by nothing, so the writer left them out with all they read. Both tests now store them, and count the stores, to keep every instruction they name. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Merged main
Synthetic tests only for this update; no title data used. AI-assisted |
…f the emitted shaders
Summary:
victory translate --countcounts the instructions of every emitted shader: the total, by stage and by kind. With--listit also prints a line per program. The report holds counts only, so it can be posted as it is.Why
Three open PRs make the emitted DXIL smaller (#697, #1716, #1646), and triage asks each for "a benefit it can show". The repository has no shared number for that. This adds one, read from the container itself, so any revision of the translator can be compared with any other, program by program, next to the validator's verdict.
What it counts
emit::counts::of(container)reads the DXIL part's bitcode back (the unabbreviated recordsbitcode.rswrites) and countsmain:dx.op.rawBufferLoad.f32, ...). LLVM shares one opcode between the integer and float forms of add, sub, mul, div and rem; the kind is taken from the first operand's type, so a float operation is counted asfadd,fsub,fmul,fdivorfrem(half, float, double, and vectors of them)It counts what was written, not what a pass believes it wrote. A module with abbreviations (one DXC made) is refused, not miscounted.
The counts are static: one per instruction, however often it runs. They show what the translation adds and what a change takes out. They are not a measure of GPU time.
bitcastis counted like any other instruction: it is one in the module, and the host's compiler has to read it. It becomes no machine instruction, which is one more reason the count is not a measure of GPU time.When comparing two revisions
--validatethe summary used to read "0 validated, 0 pipelines". After @fiestorra's review the second commit makes it say "validation not checked" and "pipelines not made" when those checks were not asked for. This changes the summary of everytranslaterun, with or without--count.main
940d32fover the title'sshaders.rpfLocal title data, offline, CPU only (
translate --validate --list --count, dxil.dll 10.0.26100.0). Counts only; no names or data from the title are in this PR.23,918 of the 25,591 validate, as without
--count. The largest kinds, recounted at2729d8ewith the float forms named apart (every total above is unchanged, and each pair sums to the shared count measured at4d34d76):bitcastselectfcmpandicmporaddextractvaluedx.op.tertiary.f32fmullshrdx.op.rawBufferLoad.f32phifsubdx.op.annotateHandlesubdx.op.createHandleFromHeapfadddx.op.getDimensionsmulfdivNo integer
sdiv/sremand nofremwere emitted.The console code of these programs is 40,601,701 IR instructions, so the translation writes 4.7 host instructions for each.
Checks
cargo test -p victory-shader counts::withVICTORY_WARP=1: 6 passed (at2729d8e). They are synthetic and use no device: a module holding every instruction the writer has (with an unread phi and a folded latch) counted exactly, each shared opcode in its integer and float form with the float typed by a constant, a call, a field, a cast, a load, a select and a phi (22 instructions, kinds summing to the total), half and vector operands, a whole container, the sum of two counts, and streams that are refused.cargo test -p victory --bins translate: 1 passed. The new summary lines were read from a run on a path that does not exist, with and without--validate.cargo clippy -p victory-shader -p victory --all-targets: clean.rustfmt --edition 2024 --checkon the changed files: clean.cargo xtask policy: ok.victory-shaderlib suite on WARP at2729d8e: 251 passed, 2 failed (gathers_at_a_level_match_the_hardware,permutes_read_the_lane_named_and_zero_from_lanes_left_out), which fail the same way onmain940d32fon this machine's WARP. The PR changes no emitted byte.AI-assisted.
🤖 Generated with Claude Code