docs: measure the RDNA2 opcode funnel behind the iOS question #100

Open
xiaotu030202 wants to merge 1 commit from upstream-pr/100 into main
xiaotu030202 commented 2026-11-25 12:07:09 +00:00 (Migrated from github.com)
First-time contributor

Imported from Zettrox/ztrx. Originally posted by xiaotu030202 on 2026-11-25T11:14:36Z.


Follow-up to #83, as promised in my comment there: the opcode inventory, measured from the tree rather than estimated.

→ docs/rdna2-coverage.md (this PR, text only, no code)

The funnel

Count Source
Opcodes the GFX10 tables name 1,232 gfx10/opcodes.rs
Named by the lowering 333 string literals in emit/lower.rs
Named by a test 89 the five *_tests.rs files

Why I think it is worth a document

The tests are the only part of the shader backend that carries over to a Metal backend unchanged — diff_tests.rs compares against the console SDK's own dxc.exe, and the valu / wave64 / intersect suites pin RDNA2 results a second backend would have to reproduce. If 89 opcodes are pinned and 333 are lowered, then a second backend can be validated on roughly a quarter of the surface it has to cover, and the remaining 244 have to be right by construction.

That is what makes the estimate "replace the back half of lower.rs" rather than "add an emitter": you cannot lean on the tests for the rest.

Both counts are upper bounds, and the document says so

Naming an opcode in lower.rs is not the same as handling it — many are match arms passing through a shared helper, and a few appear only in a tracing message. A test can name one in a comment. So the doc bounds the funnel and states what would make it exact:

victory translate <corpus> --list

over the 26,503-shader corpus, which needs game files. I do not have them; a tester or you do. The document's step 2 is to turn that into an opcode-frequency table, because the top of it is very likely far below 244 — game shaders use a small subset heavily.

What this PR is not

Not a claim that iOS is feasible or infeasible. It is the one part of the #83 decision that can be settled from the repository alone, plus an explicit list of what cannot (the MSL leg needs a Mac; the x64-without-JIT problem needs an AOT recompiler, which is a different project).

Verification

cargo test --workspace on this tree is green on my machine — 0 failures, so nothing here fixes a bug. Windows 11, RTX 5070 Ti, Rust 1.98.1 pinned, MSVC 14.44.35207, Windows SDK 10.0.26100.0.

The document is a single new file under docs/; no existing file is touched, and the asset-policy check is unaffected (text, .md).

<!-- greyfinch-sync:Zettrox/ztrx:issue:6603219686 --> Imported from [Zettrox/ztrx](https://github.com/Zettrox/ztrx/pull/100). Originally posted by [xiaotu030202](https://github.com/xiaotu030202) on 2026-11-25T11:14:36Z. --- Follow-up to [#83](https://github.com/Zettrox/ztrx/issues/83), as promised in my comment there: the opcode inventory, measured from the tree rather than estimated. **→ `docs/rdna2-coverage.md`** (this PR, text only, no code) ## The funnel | | Count | Source | |---|---|---| | Opcodes the GFX10 tables name | **1,232** | `gfx10/opcodes.rs` | | Named by the lowering | **333** | string literals in `emit/lower.rs` | | Named by a test | **89** | the five `*_tests.rs` files | ## Why I think it is worth a document The tests are the only part of the shader backend that carries over to a Metal backend unchanged — `diff_tests.rs` compares against the console SDK's own `dxc.exe`, and the `valu` / `wave64` / `intersect` suites pin RDNA2 results a second backend would have to reproduce. If 89 opcodes are pinned and 333 are lowered, then **a second backend can be validated on roughly a quarter of the surface it has to cover**, and the remaining 244 have to be right by construction. That is what makes the estimate "replace the back half of `lower.rs`" rather than "add an emitter": you cannot lean on the tests for the rest. ## Both counts are upper bounds, and the document says so Naming an opcode in `lower.rs` is not the same as handling it — many are `match` arms passing through a shared helper, and a few appear only in a `tracing` message. A test can name one in a comment. So the doc bounds the funnel and states what would make it exact: ``` victory translate <corpus> --list ``` over the 26,503-shader corpus, which needs game files. I do not have them; a tester or you do. The document's step 2 is to turn that into an opcode-frequency table, because the top of it is very likely far below 244 — game shaders use a small subset heavily. ## What this PR is not Not a claim that iOS is feasible or infeasible. It is the one part of the #83 decision that can be settled from the repository alone, plus an explicit list of what cannot (the MSL leg needs a Mac; the x64-without-JIT problem needs an AOT recompiler, which is a different project). ## Verification `cargo test --workspace` on this tree is green on my machine — 0 failures, so nothing here fixes a bug. Windows 11, RTX 5070 Ti, Rust 1.98.1 pinned, MSVC 14.44.35207, Windows SDK 10.0.26100.0. The document is a single new file under `docs/`; no existing file is touched, and the asset-policy check is unaffected (text, `.md`).
This pull request cannot be merged automatically due to conflicts.
Merge manually to resolve the conflicts.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin 'upstream-pr/100:upstream-pr/100'
git switch 'upstream-pr/100'

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch 'main'
git merge --no-ff 'upstream-pr/100'
git switch 'upstream-pr/100'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/100'
git switch 'upstream-pr/100'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/100'
git switch 'main'
git merge --squash 'upstream-pr/100'
git switch 'main'
git merge --ff-only 'upstream-pr/100'
git switch 'main'
git merge 'upstream-pr/100'
git push origin 'main'
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
Zettrox/ztrx!100
No description provided.