Skip to content

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

Open
xiaotu030202 wants to merge 1 commit into
Zettrox:mainfrom
xiaotu030202:docs/rdna2-opcode-coverage
Open

xiaotu030202 wants to merge 1 commit into
Zettrox:mainfrom
xiaotu030202:docs/rdna2-opcode-coverage

Conversation

@xiaotu030202

Copy link
Copy Markdown

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).

Issue Zettrox#83 asks whether an iOS / Metal target is in scope. The answer turns
on how much of the shader backend is pinned by tests and how much a second
backend would have to reproduce unproven, which nothing in the tree states.

Counted, not estimated:

  gfx10/opcodes.rs        1,232 opcodes named
  emit/lower.rs             333 named by the lowering
  emit/*_tests.rs            89 named by a test

Both of the smaller numbers are upper bounds (naming an opcode is not
handling it, and a test can name one in a comment), so the document bounds
the funnel rather than claiming exact figures, and says what would make it
exact: a `victory translate --list` sweep over the shader corpus, which
needs game files.

The point it makes for the issue: the tests are the only part of the
backend that carries over to Metal unchanged, so a second backend is
validated on roughly a quarter of the surface it must cover, and the rest
has to be right by construction. That is why the estimate is "replace the
back half of lower.rs" rather than "add an emitter".

No code changed. Text only, in docs/.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant