tools: rank first shader refusals by the draws and dispatches they block #3198

Merged
tedin7 merged 3 commits from upstream-pr/3198 into main 2026-11-29 08:09:06 +00:00
tedin7 commented 2026-11-27 21:28:43 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-27T21:28:43Z.


Part of #870

What this unblocks: picking the next translator gap by how many draws and dispatches it blocks in a real run, not by how many shader keys fail.

tools/startup/triage_run.py already counts .fail reasons per key. A key that fails once and is never drawn counts the same as a key that blocks most of a frame. This adds tools/startup/refusal_census.py, which reads a run's shader cache plus the stand-in stderr and weights each refused key's first refusal by the work the log says it blocked:

  • first refusal = first line of <key>.fail; stage from the request files (.c67 compute, .a/.b graphics, .m57/.m86 mesh, .rtv);
  • weight = the largest count the log gives that key: dispatches of its x2w-render compute census key line, no RTV translation and ExecuteIndirect refusal lines, and per-key use / not-drawn counts when a build prints them; a refused key that no line names weighs 0;
  • class = the triage_run.py shader category when one matches, else the first refusal with registers, numbers and addresses normalized (R, N, H); --shareable keeps only the fixed categories, like triage_run.py reports;
  • output: a Markdown table by stage and a ranking of classes by blocked weight (stdout or --out-md), one TSV row per refused key (--out-tsv).

How to run:

# a run (or a replay of a recording) with X2W_SHADER_CACHE=<dir>, stderr saved to stderr.txt
python3 -B tools/startup/refusal_census.py --cache <dir> --log stderr.txt --out-md census.md --out-tsv census.tsv

Tests:

  • startup_refusal_census (tests/startup_refusal_census_check.py): runs the tool on a synthetic cache and log; checks the TSV rows and weights (cumulative census lines take the last total, a refused key with no log line weighs 0, a translated key is not listed), the class ranking, that --shareable drops unknown text, and that a missing log is a usage error.

Verification:

  • python3 -B tests/startup_refusal_census_check.py -> 4 tests OK
  • python3 -B tests/startup_triage_run_check.py -> 0 failed
  • cmake -S . -B /tmp/cfg -G Ninja -DDXC_EXECUTABLE=/bin/true -> configure OK
  • Windows: none needed (Python only); the Python checks run in CI.

A companion draft with the replay recorder and player follows; this tool is how we rank the first refusals that replays turn up.

Thanks to @Makto94 for the testing that found this.

AI-assisted; commands listed were executed locally.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:issue:5533313859 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/3198). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-27T21:28:43Z. --- Part of #870 What this unblocks: picking the next translator gap by how many draws and dispatches it blocks in a real run, not by how many shader keys fail. `tools/startup/triage_run.py` already counts `.fail` reasons per key. A key that fails once and is never drawn counts the same as a key that blocks most of a frame. This adds `tools/startup/refusal_census.py`, which reads a run's shader cache plus the stand-in stderr and weights each refused key's first refusal by the work the log says it blocked: - first refusal = first line of `<key>.fail`; stage from the request files (`.c67` compute, `.a`/`.b` graphics, `.m57`/`.m86` mesh, `.rtv`); - weight = the largest count the log gives that key: dispatches of its `x2w-render compute census key` line, `no RTV translation` and `ExecuteIndirect` refusal lines, and per-key use / not-drawn counts when a build prints them; a refused key that no line names weighs 0; - class = the `triage_run.py` shader category when one matches, else the first refusal with registers, numbers and addresses normalized (`R`, `N`, `H`); `--shareable` keeps only the fixed categories, like `triage_run.py` reports; - output: a Markdown table by stage and a ranking of classes by blocked weight (stdout or `--out-md`), one TSV row per refused key (`--out-tsv`). How to run: ``` # a run (or a replay of a recording) with X2W_SHADER_CACHE=<dir>, stderr saved to stderr.txt python3 -B tools/startup/refusal_census.py --cache <dir> --log stderr.txt --out-md census.md --out-tsv census.tsv ``` Tests: - `startup_refusal_census` (`tests/startup_refusal_census_check.py`): runs the tool on a synthetic cache and log; checks the TSV rows and weights (cumulative census lines take the last total, a refused key with no log line weighs 0, a translated key is not listed), the class ranking, that `--shareable` drops unknown text, and that a missing log is a usage error. Verification: - `python3 -B tests/startup_refusal_census_check.py` -> 4 tests OK - `python3 -B tests/startup_triage_run_check.py` -> 0 failed - `cmake -S . -B /tmp/cfg -G Ninja -DDXC_EXECUTABLE=/bin/true` -> configure OK - Windows: none needed (Python only); the Python checks run in CI. A companion draft with the replay recorder and player follows; this tool is how we rank the first refusals that replays turn up. Thanks to @Makto94 for the testing that found this. AI-assisted; commands listed were executed locally.
R0Y00 commented 2026-11-27 21:36:21 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-27T21:36:21Z.

Review: COMMENTED


Draft review on fb4f718c: all four python -B tests/startup_refusal_census_check.py tests pass. An added synthetic row exposes a weighting error: a cached .fail and x2w-render compute census key 1234567890abcdef: 12 dispatches, 10 translated, first refusal: example report blocked weight 12. The runtime's own by-reason census sums dispatches - translated in d3d12_compute_dispatch.inl, so this key blocked 2. A cache refusal can be stale after successful translations. Please parse the translated count, prefer failure counters over total-use estimates for the same key, and cover partially recovered and fully translated counters. For a key with no matching log line, zero means the log recorded no evidence, since logs may be sampled or truncated.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:review:6093533104 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/3198#pullrequestreview-6093533104). Originally posted by [R0Y00](https://github.com/R0Y00) on 2026-11-27T21:36:21Z. **Review:** COMMENTED --- Draft review on `fb4f718c`: all four `python -B tests/startup_refusal_census_check.py` tests pass. An added synthetic row exposes a weighting error: a cached `.fail` and `x2w-render compute census key 1234567890abcdef: 12 dispatches, 10 translated, first refusal: example` report blocked weight 12. The runtime's own by-reason census sums `dispatches - translated` in `d3d12_compute_dispatch.inl`, so this key blocked 2. A cache refusal can be stale after successful translations. Please parse the translated count, prefer failure counters over total-use estimates for the same key, and cover partially recovered and fully translated counters. For a key with no matching log line, zero means the log recorded no evidence, since logs may be sampled or truncated.
xiaoqi72665 commented 2026-11-27 22:54:19 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by xiaoqi72665 on 2026-11-27T22:54:19Z.


Independent follow-up to the review on fb4f718c: I reproduced the 12 dispatches / 10 translated case (weight 12 instead of 2). There is also a separate runtime evidence gap.

On main e582a9a, the public source-built indirect translated/other refusal census fixtures on RX 7900 XT and WARP produced 14 per-reason detail lines across four successful fixture runs. For example:

x2w-d3d12 indirect-draw refusal 1: key=1234567890abcdef reason=missing_guest_root calls=2
x2w-d3d12 indirect-draw refusal 1: key=1234567890abcdef reason=missing_guest_root calls=5
x2w-d3d12 indirect-draw refusal 1: key=1234567890abcdef reason=missing_guest_root calls=5

(The key and sequence above are synthetic.) Calling load_weights([log]) at this PR head returns an empty Counter for both that minimal log and the 14 actual lines. The existing per_reason_refusal_census.h reports cumulative counts with periodic and final repeats; this synthetic sequence means 5 runtime refusals, not 12. Runtime-only keys need not have .fail files, and the zero key is unattributed. I would keep these counters separate from first shader refusal attribution rather than blindly add them to shader weights; a missing log match is unknown evidence, not proof of zero failures.

Reproduction: build startup_indirect_draw_indexed on main; run ctest --preset release --no-tests=error -j1 -R "^startup_indirect_(translated|other)refusal_census(warp|hardware)$" -V; pass the per-reason detail lines to load_weights. Existing census unit tests passed 4/4. Happy to coordinate a focused test-only follow-up if useful; not opening a competing implementation. Buhe; AI-assisted.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7229713421 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/3198#issuecomment-7229713421). Originally posted by [xiaoqi72665](https://github.com/xiaoqi72665) on 2026-11-27T22:54:19Z. --- Independent follow-up to the review on fb4f718c: I reproduced the 12 dispatches / 10 translated case (weight 12 instead of 2). There is also a separate runtime evidence gap. On main e582a9a, the public source-built indirect translated/other refusal census fixtures on RX 7900 XT and WARP produced 14 per-reason detail lines across four successful fixture runs. For example: x2w-d3d12 indirect-draw refusal 1: key=1234567890abcdef reason=missing_guest_root calls=2 x2w-d3d12 indirect-draw refusal 1: key=1234567890abcdef reason=missing_guest_root calls=5 x2w-d3d12 indirect-draw refusal 1: key=1234567890abcdef reason=missing_guest_root calls=5 (The key and sequence above are synthetic.) Calling load_weights([log]) at this PR head returns an empty Counter for both that minimal log and the 14 actual lines. The existing per_reason_refusal_census.h reports cumulative counts with periodic and final repeats; this synthetic sequence means 5 runtime refusals, not 12. Runtime-only keys need not have .fail files, and the zero key is unattributed. I would keep these counters separate from first shader refusal attribution rather than blindly add them to shader weights; a missing log match is unknown evidence, not proof of zero failures. Reproduction: build startup_indirect_draw_indexed on main; run ctest --preset release --no-tests=error -j1 -R "^startup_indirect_(translated|other)_refusal_census_(warp|hardware)$" -V; pass the per-reason detail lines to load_weights. Existing census unit tests passed 4/4. Happy to coordinate a focused test-only follow-up if useful; not opening a competing implementation. Buhe; AI-assisted.
tedin7 commented 2026-11-27 23:20:25 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-27T23:20:25Z.


Pushed 09e8189c7 (merged with current main) for the weighting findings.

  • A compute census line now weighs dispatches - translated: 12 dispatches with 10 translated gives 2, and a fully translated key gives 0 even with a cached .fail. The old line form without translated still works. Failure counters win over use estimates for the same key.
  • The runtime per-reason indirect-draw counters are parsed separately and are not added to the shader weights. They are cumulative with repeats (calls 2, 5, 5 counts as 5), and the zero key is left out as unattributed.
  • The docs now say a key with no matching log line means no evidence, not proven zero failures.

Verification:

  • python3 -B tests/startup_refusal_census_check.py: 6 tests OK (new cases: 12/10 -> 2, 12/12 -> 0 with a .fail, legacy line, 2/5/5 -> 5).
  • python3 -B tests/docs_links_check.py, git diff --check, cmake -S . -B <tmp> -DDXC_EXECUTABLE=/bin/true, public_guard.py.
  • No Windows run (Python only).

AI-assisted; commands listed were executed locally.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7230063998 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/3198#issuecomment-7230063998). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-27T23:20:25Z. --- Pushed `09e8189c7` (merged with current `main`) for the weighting findings. - A compute census line now weighs `dispatches - translated`: 12 dispatches with 10 translated gives 2, and a fully translated key gives 0 even with a cached `.fail`. The old line form without `translated` still works. Failure counters win over use estimates for the same key. - The runtime per-reason indirect-draw counters are parsed separately and are not added to the shader weights. They are cumulative with repeats (calls 2, 5, 5 counts as 5), and the zero key is left out as unattributed. - The docs now say a key with no matching log line means no evidence, not proven zero failures. Verification: - `python3 -B tests/startup_refusal_census_check.py`: 6 tests OK (new cases: 12/10 -> 2, 12/12 -> 0 with a `.fail`, legacy line, 2/5/5 -> 5). - `python3 -B tests/docs_links_check.py`, `git diff --check`, `cmake -S . -B <tmp> -DDXC_EXECUTABLE=/bin/true`, `public_guard.py`. - No Windows run (Python only). AI-assisted; commands listed were executed locally.
R0Y00 commented 2026-11-27 23:36:02 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-27T23:36:02Z.

Review: COMMENTED


I retested 09e8189c integrated over main fad97f47 (clean trial tree f6749198). The weighting issue in my earlier draft review is addressed: the 12-dispatch/10-translated case weighs 2, a fully translated key with a cached refusal weighs 0, and the older lines still parse. In the new indirect detail tests, repeat cumulative counters retain the final count, the zero key is excluded, and the per-reason rows do not inflate the shader totals. python -B tests/startup_refusal_census_check.py passed 6/6, tests/startup_triage_run_check.py reported zero failures, and the docs check passed. The source fixture results are recorded here while the PR stays in draft.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:review:6094311907 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/3198#pullrequestreview-6094311907). Originally posted by [R0Y00](https://github.com/R0Y00) on 2026-11-27T23:36:02Z. **Review:** COMMENTED --- I retested `09e8189c` integrated over `main` `fad97f47` (clean trial tree `f6749198`). The weighting issue in my earlier draft review is addressed: the 12-dispatch/10-translated case weighs 2, a fully translated key with a cached refusal weighs 0, and the older lines still parse. In the new indirect detail tests, repeat cumulative counters retain the final count, the zero key is excluded, and the per-reason rows do not inflate the shader totals. `python -B tests/startup_refusal_census_check.py` passed 6/6, `tests/startup_triage_run_check.py` reported zero failures, and the docs check passed. The source fixture results are recorded here while the PR stays in draft.
KelboLive commented 2026-11-27 23:48:14 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by KelboLive on 2026-11-27T23:48:14Z.


Review of 09e8189c (integrated over main):

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7230420446 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/3198#issuecomment-7230420446). Originally posted by [KelboLive](https://github.com/KelboLive) on 2026-11-27T23:48:14Z. --- Review of `09e8189c` (integrated over main):
tedin7 commented 2026-11-28 22:01:55 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-28T22:01:55Z.


Merged current main into this branch (merge commit, no force push, no conflicts); head is now ac13b5d34. No change to the PR's own files since the weighting fix that @R0Y00 retested on 09e8189c.

Verification (Windows Server 2025, D3D12 WARP, head ac13b5d34): x2w_pipe.py win2025 3198 --regex '^(startup_refusal_census|startup_triage_run)' -> 2/2 passed. The Python census tests also pass on Linux.

All open asks (weighting with the translated count, failure counters over use estimates, partially recovered and fully translated cases) are done and were confirmed in the review above. Marking this Ready.

@MasterDomino ready for review and merge when you have time.

AI-assisted; commands listed were executed locally.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7246446903 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/3198#issuecomment-7246446903). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-28T22:01:55Z. --- Merged current `main` into this branch (merge commit, no force push, no conflicts); head is now `ac13b5d34`. No change to the PR's own files since the weighting fix that @R0Y00 retested on `09e8189c`. Verification (Windows Server 2025, D3D12 WARP, head `ac13b5d34`): `x2w_pipe.py win2025 3198 --regex '^(startup_refusal_census|startup_triage_run)'` -> 2/2 passed. The Python census tests also pass on Linux. All open asks (weighting with the translated count, failure counters over use estimates, partially recovered and fully translated cases) are done and were confirmed in the review above. Marking this Ready. @MasterDomino ready for review and merge when you have time. AI-assisted; commands listed were executed locally.
chatgpt-codex-connector[bot] commented 2026-11-28 22:02:08 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by chatgpt-codex-connector[bot] on 2026-11-28T22:02:08Z.


Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-28T22:05:47.390443Z ac13b5d Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7246449491 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/3198#issuecomment-7246449491). Originally posted by [chatgpt-codex-connector[bot]](https://github.com/apps/chatgpt-codex-connector) on 2026-11-28T22:02:08Z. --- <!-- codex-pull-request-review-summary --> <!-- codex-review-state:v1 {"code_review":{"commit_sha":"ac13b5d3464bab0dd8df163b718310c0421002f5","has_any_findings":false,"has_unresolved_findings":false,"status":"completed"},"security_review":{"commit_sha":null,"has_any_findings":null,"has_unresolved_findings":null,"status":null}} --> <details> <summary><strong>Codex Review Summary</strong>: ✅ Completed</summary> This comment shows the latest Codex review activity on this pull request. | Review | Status | Commit | Review trigger | | --- | --- | --- | --- | | 📝 **Code Review** | ✅ **Completed** <relative-time datetime="2026-11-28T22:05:47.390443Z">2026-11-28T22:05:47.390443Z</relative-time> | `ac13b5d` | Draft marked ready | <details> <summary>ℹ️ About Codex in GitHub</summary> <br/> [Your team has set up Codex to review pull requests in this repo](https://chatgpt.com/codex/cloud/settings/general). Reviews are triggered when you - Open a pull request for review - Mark a draft as ready - Comment "@codex review" or "@codex security review". Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. </details> </details>
pigalot commented 2026-11-29 08:08:40 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by pigalot on 2026-11-29T08:08:40Z.

Review: APPROVED


Independently reviewed ac13b5d3 integrated over main eab7180c (clean trial merge, tree 568379e3). git diff --cached --check origin/main is clean. The change is Python tooling, a test, a ctest entry and a docs paragraph, so I did not request a title run.

What I traced: each pattern in tools/startup/refusal_census.py against the line the runtime prints.

  • compute census key ...: N dispatches, T translated matches d3d12_compute_dispatch.inl:1104, and max(0, N - T) agrees with the by-reason sum a few lines above it (dispatches - translated).
  • no RTV translation for, translated ExecuteIndirect Draw refused, shader and ExecuteIndirect refused, key match d3d12_draw.inl:1268, d3d12_draw.inl:3564 and d3d12_xs_device.cpp:3784.
  • The indirect-draw refusal N: key= reason= calls= form matches what tests/startup_indirect_draw_indexed.cpp parses.
  • <key>.fail and req_<key>.<ext> match what gfx2hlsl.py and compile_dxil.cpp write.

The earlier asks on this PR are in at this head: 12 dispatches with 10 translated weighs 2, a fully translated key with a cached .fail weighs 0, the older line form still parses, a failure counter wins over a use estimate from another log, and the runtime indirect-draw counters are reported separately (2, 5, 5 gives 5; zero key left out).

Ran, in the trial merge:

  • out\pe-env\Scripts\python.exe -B tests/startup_refusal_census_check.py: 6 tests OK.
  • python -B tests/startup_triage_run_check.py: 0 failed. tests/docs_links_check.py and tests/run_checks_parallel_check.py: pass.
  • cmake --preset dev and cmake --preset release, then ctest --test-dir out/build/<preset> --no-tests=error -j 1 -R '^(startup_refusal_census|startup_triage_run|runtime_startup_triage_run_cli_check)$': 3/3 passed in both, no skips.
  • On main eab7180c the tool and its test do not exist, so startup_refusal_census is not registered there.

Mutation test of refusal_census.py (31 single-edit mutants, each run against tests/startup_refusal_census_check.py, file restored and git diff --quiet checked afterwards):

  • Killed, 20: translated count ignored; use estimates overriding failure counters; use-estimate fallback dropped; use estimate not taking the largest; cumulative census totals summed; count lines not added; slots summed per key; zero key kept; indirect calls summed; indirect rows ascending; last .fail line instead of first; --shareable leaking text; class ranking ascending; row order ascending; positive-weight count using >=; missing-log check off; normalized class cut short; no RTV translation pattern dead; .c67 and .a stage labels wrong.
  • Equivalent, 2: dropping the max(0, ...) clamp (the later max against the Counter default of 0 does the same); dropping the continue after an indirect-draw line (no other pattern matches that line).
  • Survive, 9: the translated ExecuteIndirect Draw refused pattern, the ExecuteIndirect refused, key pattern and the not drawn key pattern can each be made dead with all 6 tests passing (the one ExecuteIndirect line in the fixture is hidden behind two RTV lines for the same key, because the weight is a maximum); --top ignored; | not replaced in a class label; the --cache directory check off; the class tie-break by key count dropped; the .b stage label wrong (only visible for a key with .b and no .a); the x2w- prefilter removed.

Notes, none blocking:

  1. Graphics weights on current main are capped line counts, not draws. no RTV translation for is logged once when the variant entry is created. The two ExecuteIndirect refusal lines are logged for the first call of each (key, reason) pair and then only for the first 32 and 16 refusals overall (first_calls). Nothing under src/ prints key use or not drawn key yet. So today a compute key is weighed by its real blocked dispatches while a graphics key that blocks many draws weighs about 1, and the ranking across stages leans to compute. The docs paragraph says logs can be sampled; I would add one sentence there saying that the graphics line counts are a lower bound until a build prints per-key draw counts.
  2. A fixture row where a key's only log line is an ExecuteIndirect refusal (one for each form) and one not drawn key row would pin the three surviving patterns.
  3. On Windows, a .fail whose first line holds a byte that cp1252 cannot decode stops the report: printf 'bad byte \x81 here\n' > cache/00000000000000aa.fail, then python -B tools/startup/refusal_census.py --cache cache --log log.txt --out-md o.md ends in UnicodeEncodeError: 'charmap' codec can't encode character '�'. A UTF-8 .fail is read as cp1252 and comes out as mojibake. Passing encoding="utf-8" to the read_text, open and write_text calls would fix both; unconfirmed. --shareable is not affected for unknown text.
  4. tests/startup_refusal_census_check.py is registered in ctest but is not in the Run Python checks list of the python-linux job or in tests/checks/, so it runs in the Windows job only.

Environment: Windows 11 25H2 build 26200.9974; Python 3.12.10; CMake configure with MSVC 19.52.37029. No GPU tests apply.
CI: Build and test on Windows passed on ac13b5d3.

This reply was AI-assisted.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:review:6102025062 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/3198#pullrequestreview-6102025062). Originally posted by [pigalot](https://github.com/pigalot) on 2026-11-29T08:08:40Z. **Review:** APPROVED --- Independently reviewed `ac13b5d3` integrated over `main` `eab7180c` (clean trial merge, tree `568379e3`). `git diff --cached --check origin/main` is clean. The change is Python tooling, a test, a ctest entry and a docs paragraph, so I did not request a title run. What I traced: each pattern in `tools/startup/refusal_census.py` against the line the runtime prints. - `compute census key ...: N dispatches, T translated` matches `d3d12_compute_dispatch.inl:1104`, and `max(0, N - T)` agrees with the by-reason sum a few lines above it (`dispatches - translated`). - `no RTV translation for`, `translated ExecuteIndirect Draw refused, shader` and `ExecuteIndirect refused, key` match `d3d12_draw.inl:1268`, `d3d12_draw.inl:3564` and `d3d12_xs_device.cpp:3784`. - The `indirect-draw refusal N: key= reason= calls=` form matches what `tests/startup_indirect_draw_indexed.cpp` parses. - `<key>.fail` and `req_<key>.<ext>` match what `gfx2hlsl.py` and `compile_dxil.cpp` write. The earlier asks on this PR are in at this head: 12 dispatches with 10 translated weighs 2, a fully translated key with a cached `.fail` weighs 0, the older line form still parses, a failure counter wins over a use estimate from another log, and the runtime indirect-draw counters are reported separately (2, 5, 5 gives 5; zero key left out). Ran, in the trial merge: - `out\pe-env\Scripts\python.exe -B tests/startup_refusal_census_check.py`: 6 tests OK. - `python -B tests/startup_triage_run_check.py`: 0 failed. `tests/docs_links_check.py` and `tests/run_checks_parallel_check.py`: pass. - `cmake --preset dev` and `cmake --preset release`, then `ctest --test-dir out/build/<preset> --no-tests=error -j 1 -R '^(startup_refusal_census|startup_triage_run|runtime_startup_triage_run_cli_check)$'`: 3/3 passed in both, no skips. - On `main` `eab7180c` the tool and its test do not exist, so `startup_refusal_census` is not registered there. Mutation test of `refusal_census.py` (31 single-edit mutants, each run against `tests/startup_refusal_census_check.py`, file restored and `git diff --quiet` checked afterwards): - Killed, 20: translated count ignored; use estimates overriding failure counters; use-estimate fallback dropped; use estimate not taking the largest; cumulative census totals summed; count lines not added; slots summed per key; zero key kept; indirect calls summed; indirect rows ascending; last `.fail` line instead of first; `--shareable` leaking text; class ranking ascending; row order ascending; positive-weight count using `>=`; missing-log check off; normalized class cut short; `no RTV translation` pattern dead; `.c67` and `.a` stage labels wrong. - Equivalent, 2: dropping the `max(0, ...)` clamp (the later `max` against the Counter default of 0 does the same); dropping the `continue` after an indirect-draw line (no other pattern matches that line). - Survive, 9: the `translated ExecuteIndirect Draw refused` pattern, the `ExecuteIndirect refused, key` pattern and the `not drawn key` pattern can each be made dead with all 6 tests passing (the one ExecuteIndirect line in the fixture is hidden behind two RTV lines for the same key, because the weight is a maximum); `--top` ignored; `|` not replaced in a class label; the `--cache` directory check off; the class tie-break by key count dropped; the `.b` stage label wrong (only visible for a key with `.b` and no `.a`); the `x2w-` prefilter removed. Notes, none blocking: 1. Graphics weights on current `main` are capped line counts, not draws. `no RTV translation for` is logged once when the variant entry is created. The two `ExecuteIndirect` refusal lines are logged for the first call of each (key, reason) pair and then only for the first 32 and 16 refusals overall (`first_calls`). Nothing under `src/` prints `key use` or `not drawn key` yet. So today a compute key is weighed by its real blocked dispatches while a graphics key that blocks many draws weighs about 1, and the ranking across stages leans to compute. The docs paragraph says logs can be sampled; I would add one sentence there saying that the graphics line counts are a lower bound until a build prints per-key draw counts. 2. A fixture row where a key's only log line is an `ExecuteIndirect` refusal (one for each form) and one `not drawn key` row would pin the three surviving patterns. 3. On Windows, a `.fail` whose first line holds a byte that cp1252 cannot decode stops the report: `printf 'bad byte \x81 here\n' > cache/00000000000000aa.fail`, then `python -B tools/startup/refusal_census.py --cache cache --log log.txt --out-md o.md` ends in `UnicodeEncodeError: 'charmap' codec can't encode character '�'`. A UTF-8 `.fail` is read as cp1252 and comes out as mojibake. Passing `encoding="utf-8"` to the `read_text`, `open` and `write_text` calls would fix both; unconfirmed. `--shareable` is not affected for unknown text. 4. `tests/startup_refusal_census_check.py` is registered in ctest but is not in the `Run Python checks` list of the `python-linux` job or in `tests/checks/`, so it runs in the Windows job only. Environment: Windows 11 25H2 build 26200.9974; Python 3.12.10; CMake configure with MSVC 19.52.37029. No GPU tests apply. CI: `Build and test on Windows` passed on `ac13b5d3`. This reply was AI-assisted.
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
R0Y00/Xbox2Windows!3198
No description provided.