tooling: the coverage chart cannot see gfx2hlsl, so forms it implements are reported as gaps #3513

Closed
opened 2026-11-29 19:51:45 +00:00 by KelboLive · 3 comments
KelboLive commented 2026-11-29 19:51:45 +00:00 (Migrated from github.com)
Contributor

Imported from R0Y00/Xbox2Windows. Originally posted by KelboLive on 2026-11-29T19:51:45Z.


tooling: the coverage chart cannot see gfx2hlsl, so forms it implements are reported as gaps

Summary

The instruction-coverage chart counts forms exercised by passing fixtures. Only
tests/pixel_aot_check.py and the compute_store_aot_* fixtures write
FORM_COVERAGE_RECORD, so gfx1013 forms are only counted when tools/pixel_aot.py or the
direct-compute path accepted them. tools/startup/gfx2hlsl.py — the translator that
handles a title's shaders at run time — writes no records at all.

A form that gfx2hlsl lowers, but pixel_aot does not, is therefore reported as
unobserved even though the runtime supports it.

Example

s_cbranch_vccz, s_cbranch_vccnz and s_cbranch_execnz are listed as uncovered for
gfx1013 (488 uncovered, all unobserved, on main c4b8a41b with the dev preset).

  • gfx2hlsl lowers all three: tools/startup/gfx2hlsl.py:1152-1178 (the vcc_hi rename for
    s_cbranch_vccz/vccnz), :1735 (MESH_VCC_BRANCHES) and :4998 (execnz beside
    execz).

  • pixel_aot lowers only s_cbranch_execz (tools/pixel_aot.py:4428). Feeding it the
    others raises:

    ValueError: Unsupported instruction 21: s_cbranch_vccz 2
      at tools/pixel_aot.py:8081, lower()
    

So the chart reports a gap for three forms the startup translator already handles.

Reproduction

ctest --preset dev --no-tests=error -E "_hardware$" --output-junit out/test-results.xml
python tools/form_coverage.py out/test-results.xml --records out/build/dev/form_coverage --gaps gfx1013
# s_cbranch_vccz, s_cbranch_vccnz, s_cbranch_execnz appear as unobserved

git grep -n "cbranch_vccz\|cbranch_vccnz\|cbranch_execnz" -- tools/startup/gfx2hlsl.py
# :1152-1178, :1735, :4998

git grep -n "s_cbranch_execz" -- tools/pixel_aot.py
# :4428 is the only conditional-branch lowering

git grep -n "FORM_COVERAGE_RECORD" -- tools/startup/gfx2hlsl.py
# no match: the startup translator writes no records

Why it matters

The coverage denominator is a property of the ISA, but the numerator currently measures
two of the three translators. gfx2hlsl is the path a start-up run depends on, so the
chart under-reports exactly where it matters most for title compatibility.

Every unobserved row should therefore be read as "no fixture proved this through
pixel_aot or direct compute", not as "the project does not support it". The subtitle
already says the chart is "not a measure of port completion"; this is a concrete case
where it is also not a measure of translator support.

Possible directions

  1. Record accepted gfx2hlsl programs. The translator already knows which lines it
    accepted; a fixture that lowers a start-up capture could write those words to
    FORM_COVERAGE_RECORD, under the same "record and test status from one run" rule.
    The open question is which fixture supplies the program: the startup tests work from
    captured requests rather than an assembled listing.
  2. Attribute coverage per translator. Keep one denominator, but report which path
    covered each form, so a reviewer can tell "implemented in gfx2hlsl, untested" from
    "implemented nowhere".
  3. Treat this as documentation. If the recording is deliberately scoped to the
    offline translators, say so where the chart is described, so unobserved is not read
    as unsupported.

Scope

This is a measurement question, not a translation bug. Nothing here claims the three
branches are mistranslated; the claim is only that the chart cannot currently see that
they are translated at all. The exact share of the 488 gfx1013 and 392 gfx1030 gaps that
are measurement rather than implementation is unmeasured — a per-form classification is
the obvious next step.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:issue:6683359464 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/issues/3513). Originally posted by [KelboLive](https://github.com/KelboLive) on 2026-11-29T19:51:45Z. --- # tooling: the coverage chart cannot see gfx2hlsl, so forms it implements are reported as gaps ## Summary The instruction-coverage chart counts forms exercised by passing fixtures. Only `tests/pixel_aot_check.py` and the `compute_store_aot_*` fixtures write `FORM_COVERAGE_RECORD`, so gfx1013 forms are only counted when `tools/pixel_aot.py` or the direct-compute path accepted them. `tools/startup/gfx2hlsl.py` — the translator that handles a title's shaders at run time — writes no records at all. A form that `gfx2hlsl` lowers, but `pixel_aot` does not, is therefore reported as `unobserved` even though the runtime supports it. ## Example `s_cbranch_vccz`, `s_cbranch_vccnz` and `s_cbranch_execnz` are listed as uncovered for gfx1013 (488 uncovered, all `unobserved`, on `main` `c4b8a41b` with the dev preset). - `gfx2hlsl` lowers all three: `tools/startup/gfx2hlsl.py:1152-1178` (the vcc_hi rename for `s_cbranch_vccz/vccnz`), `:1735` (`MESH_VCC_BRANCHES`) and `:4998` (`execnz` beside `execz`). - `pixel_aot` lowers only `s_cbranch_execz` (`tools/pixel_aot.py:4428`). Feeding it the others raises: ``` ValueError: Unsupported instruction 21: s_cbranch_vccz 2 at tools/pixel_aot.py:8081, lower() ``` So the chart reports a gap for three forms the startup translator already handles. ## Reproduction ```powershell ctest --preset dev --no-tests=error -E "_hardware$" --output-junit out/test-results.xml python tools/form_coverage.py out/test-results.xml --records out/build/dev/form_coverage --gaps gfx1013 # s_cbranch_vccz, s_cbranch_vccnz, s_cbranch_execnz appear as unobserved git grep -n "cbranch_vccz\|cbranch_vccnz\|cbranch_execnz" -- tools/startup/gfx2hlsl.py # :1152-1178, :1735, :4998 git grep -n "s_cbranch_execz" -- tools/pixel_aot.py # :4428 is the only conditional-branch lowering git grep -n "FORM_COVERAGE_RECORD" -- tools/startup/gfx2hlsl.py # no match: the startup translator writes no records ``` ## Why it matters The coverage denominator is a property of the ISA, but the numerator currently measures two of the three translators. `gfx2hlsl` is the path a start-up run depends on, so the chart under-reports exactly where it matters most for title compatibility. Every `unobserved` row should therefore be read as "no fixture proved this through pixel_aot or direct compute", not as "the project does not support it". The subtitle already says the chart is "not a measure of port completion"; this is a concrete case where it is also not a measure of translator support. ## Possible directions 1. **Record accepted `gfx2hlsl` programs.** The translator already knows which lines it accepted; a fixture that lowers a start-up capture could write those words to `FORM_COVERAGE_RECORD`, under the same "record and test status from one run" rule. The open question is which fixture supplies the program: the startup tests work from captured requests rather than an assembled listing. 2. **Attribute coverage per translator.** Keep one denominator, but report which path covered each form, so a reviewer can tell "implemented in gfx2hlsl, untested" from "implemented nowhere". 3. **Treat this as documentation.** If the recording is deliberately scoped to the offline translators, say so where the chart is described, so `unobserved` is not read as unsupported. ## Scope This is a measurement question, not a translation bug. Nothing here claims the three branches are mistranslated; the claim is only that the chart cannot currently see that they are translated at all. The exact share of the 488 gfx1013 and 392 gfx1030 gaps that are measurement rather than implementation is unmeasured — a per-form classification is the obvious next step.
Not-Saii commented 2026-11-29 20:42:10 +00:00 (Migrated from github.com)
Author
Contributor

Imported from R0Y00/Xbox2Windows. Originally posted by Not-Saii on 2026-11-29T20:42:10Z.


@KelboLive, unless you're planning to do this yourself, I'd like to take direction 1, with a small part of direction 2. @R0Y00, the issue leaves the direction open, so I'll wait for your OK on the approach below before opening a PR.

Proposal.

  1. Record what gfx2hlsl accepted, in its existing fixtures. I'd use the rule tests/pixel_aot_check.py and the compute_alu_* checks already follow:

    • when FORM_COVERAGE_RECORD is set, a check writes the first word of every line of each program gfx2hlsl translated without an error;
    • programs the check expects to be refused raise first, so they aren't recorded.

    The startup_gfx2hlsl_*_check.py fixtures already assemble source-built programs and translate them on the CPU, so the issue's open question has an answer: these fixtures supply the programs.

    • A small helper in tests/ writes the record.
    • I'll wire it only into fixtures that hand gfx2hlsl a whole program, not into those that test a single emitter function. A record should mean "this program translated", not "this helper ran".
    • Each test gets FORM_COVERAGE_RECORD in CMake, like the compute_store_aot_* tests. Only CPU-only variants record, so no GPU is needed.
  2. First batch: the issue's three forms. I'll start with the fixtures that cover s_cbranch_vccz, s_cbranch_vccnz and s_cbranch_execnz, then extend to the other whole-program checks in later batches.

  3. Show which translator covered each form (direction 2, the small part). form_coverage.py reports which family of records covered each form: pixel_aot, direct compute or gfx2hlsl. Then "implemented in gfx2hlsl" is visible, separate from "implemented nowhere". The denominator doesn't change.

Tests.

  • tests/form_coverage_check.py gets cases for each of these:
    • a gfx2hlsl record counts only when its test passed;
    • a record from another run is ignored;
    • the per-translator column names the right family.
  • Before and after: the gfx1013 gap list on the dev preset, with the three branch forms leaving unobserved and the count of forms that moved.
  • Negative control: a fixture that expects a refusal writes no record.

If you'd rather keep the chart scoped to the offline translators (direction 3), say so, and I'll do the documentation change instead.

Environment: Windows 11 build 26300, MSVC (VS 2022, dev preset), Windows SDK 10.0.26100, Python 3.12. No GPU needed.

AI-assisted.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7262290201 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/issues/3513#issuecomment-7262290201). Originally posted by [Not-Saii](https://github.com/Not-Saii) on 2026-11-29T20:42:10Z. --- @KelboLive, unless you're planning to do this yourself, I'd like to take direction 1, with a small part of direction 2. @R0Y00, the issue leaves the direction open, so I'll wait for your OK on the approach below before opening a PR. **Proposal.** 1. **Record what `gfx2hlsl` accepted, in its existing fixtures.** I'd use the rule `tests/pixel_aot_check.py` and the `compute_alu_*` checks already follow: - when `FORM_COVERAGE_RECORD` is set, a check writes the first word of every line of each program `gfx2hlsl` translated without an error; - programs the check expects to be refused raise first, so they aren't recorded. The `startup_gfx2hlsl_*_check.py` fixtures already assemble source-built programs and translate them on the CPU, so the issue's open question has an answer: these fixtures supply the programs. - A small helper in `tests/` writes the record. - I'll wire it only into fixtures that hand `gfx2hlsl` a whole program, not into those that test a single emitter function. A record should mean "this program translated", not "this helper ran". - Each test gets `FORM_COVERAGE_RECORD` in CMake, like the `compute_store_aot_*` tests. Only CPU-only variants record, so no GPU is needed. 2. **First batch: the issue's three forms.** I'll start with the fixtures that cover `s_cbranch_vccz`, `s_cbranch_vccnz` and `s_cbranch_execnz`, then extend to the other whole-program checks in later batches. 3. **Show which translator covered each form** (direction 2, the small part). `form_coverage.py` reports which family of records covered each form: `pixel_aot`, direct compute or `gfx2hlsl`. Then "implemented in `gfx2hlsl`" is visible, separate from "implemented nowhere". The denominator doesn't change. **Tests.** - `tests/form_coverage_check.py` gets cases for each of these: - a `gfx2hlsl` record counts only when its test passed; - a record from another run is ignored; - the per-translator column names the right family. - Before and after: the gfx1013 gap list on the dev preset, with the three branch forms leaving `unobserved` and the count of forms that moved. - Negative control: a fixture that expects a refusal writes no record. If you'd rather keep the chart scoped to the offline translators (direction 3), say so, and I'll do the documentation change instead. Environment: Windows 11 build 26300, MSVC (VS 2022, dev preset), Windows SDK 10.0.26100, Python 3.12. No GPU needed. AI-assisted.
KelboLive commented 2026-11-29 23:50:35 +00:00 (Migrated from github.com)
Author
Contributor

Imported from R0Y00/Xbox2Windows. Originally posted by KelboLive on 2026-11-29T23:50:35Z.


Not planning to take this one, so it is yours for direction 1 with whichever part of direction 2 you want — agreed that @R0Y00 should confirm the direction first, since the recording contract is the maintainers' call.

Two things from my side that may save you time:

  • The three branch forms that motivated the issue (\s_cbranch_vccz, \s_cbranch_vccnz, \s_cbranch_execnz) are all lowered by \gfx2hlsl\ at :1152-1178, :1735\ and :4998, and all three are refused by \pixel_aot\ (\ ools/pixel_aot.py:4428\ is the only conditional-branch lowering there). That pair is the smallest reproducible case of the blind spot if you want a control.
  • The record path is \ ests/pixel_aot_check.py, which writes the words of every program \lower()\ accepted to \FORM_COVERAGE_RECORD; \ orm_coverage.py\ then decodes them and ignores a record not written during the JUnit run. A \gfx2hlsl\ equivalent needs the same run-timestamp discipline or the numbers will mix runs.

Happy to measure or review once there is something to look at. I have the Agility tree and a full dev run set up, so re-running --gaps\ for all three ISAs is cheap if that helps you compare before and after.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7264767573 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/issues/3513#issuecomment-7264767573). Originally posted by [KelboLive](https://github.com/KelboLive) on 2026-11-29T23:50:35Z. --- Not planning to take this one, so it is yours for direction 1 with whichever part of direction 2 you want — agreed that @R0Y00 should confirm the direction first, since the recording contract is the maintainers' call. Two things from my side that may save you time: - The three branch forms that motivated the issue (\s_cbranch_vccz\, \s_cbranch_vccnz\, \s_cbranch_execnz\) are all lowered by \gfx2hlsl\ at \:1152-1178\, \:1735\ and \:4998\, and all three are refused by \pixel_aot\ (\ ools/pixel_aot.py:4428\ is the only conditional-branch lowering there). That pair is the smallest reproducible case of the blind spot if you want a control. - The record path is \ ests/pixel_aot_check.py\, which writes the words of every program \lower()\ accepted to \FORM_COVERAGE_RECORD\; \ orm_coverage.py\ then decodes them and ignores a record not written during the JUnit run. A \gfx2hlsl\ equivalent needs the same run-timestamp discipline or the numbers will mix runs. Happy to measure or review once there is something to look at. I have the Agility tree and a full dev run set up, so re-running \--gaps\ for all three ISAs is cheap if that helps you compare before and after.
R0Y00 commented 2026-11-30 15:16:09 +00:00 (Migrated from github.com)
Author
Contributor

Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-30T15:16:09Z.


@Not-Saii Thanks for offering to take this on. Since we've deprecated gfx2hlsl, let's go with direction 3. Please clarify that the chart covers passing fixtures for pixel_aot and the direct-compute path, and that unobserved means those fixtures haven't covered the instruction form.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7282714816 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/issues/3513#issuecomment-7282714816). Originally posted by [R0Y00](https://github.com/R0Y00) on 2026-11-30T15:16:09Z. --- @Not-Saii Thanks for offering to take this on. Since we've deprecated `gfx2hlsl`, let's go with direction 3. Please clarify that the chart covers passing fixtures for `pixel_aot` and the direct-compute path, and that `unobserved` means those fixtures haven't covered the instruction form.
Sign in to join this conversation.
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
R0Y00/Xbox2Windows#3513
No description provided.