Scripts: reject invalid shader coverage counters #2536

Open
github-bot wants to merge 1 commit from github-bot/gh-2536 into main AGit
Owner

@⁠JiyouProt on GitHub · 2026-11-25 22:04 UTC · original
JiyouProt:codex/coverage-gate-integrity → main · +179 −0 · 3 files · 1 commits · open

The shader coverage gate can report success with NaN counters and can save invalid or inconsistent counts as its baseline. For example, total=10, translated=11 with the other outcomes zero passes comparison and update; a later genuine 10-of-10 sweep then looks like a regression.

Require non-negative integer stage counters and total == translated + unsupported + validator_failed + panicked + timeout, matching StageCounts::total in coverage.rs. Validate saved/live sweeps and comparison baselines before use. Invalid counters return 2 with the stage/field named; rejected updates preserve existing bytes and do not create an absent baseline.

What is in it

  • scripts/coverage_gate.py: counter type/range and total-consistency checks; valid comparison thresholds unchanged. Total check addresses review 6068816616.
  • scripts/test_coverage_gate_counts.py: synthetic regressions for saved and child output, baseline preservation, sums above/below total, every outcome, invalid baseline, valid mixed outcomes and zero/large counts. Extra metadata is not summed.
  • README.md: documents the report contract and rejected-update behavior. RavenCurseBurg also independently reproduced the total mismatch and proposed the same invariant; the results below are our own runs.
  • Separate scopes remain with #2099 (outer mappings), #2265 (child exit status), #2253 (empty stages), #2354 (new-stage failures).

Tested

  • Windows 11 Pro 10.0.26300, Ryzen 7 5800X, 64 GB, RTX 3080 Ti 12 GB / NVIDIA 616.92; Python 3.11.9, DXC 1.9.2609.5, portable Rust 1.100.0 Windows GNU / LLVM-MinGW 23.1.6. Session-local LLD/self-contained support libraries and -C target-feature=+fma on this FMA-capable CPU, as in the prior validation.
  • python -B -m unittest discover -s scripts -p 'test_*.py' -v: 36 passed, 0 failed. The review regression produces 16 failing subcases on original PR head 60bb165; all pass after the sum check. Original counter regressions also remain green.
  • 12 real CLI checks passed using saved JSON and a synthetic child command, compare and update, for valid counts and outcome sums both above/below total. Rejections return 2, name CS.total, and preserve baseline bytes.
  • Exact code revision 0452c949b6e5, clean tree: cargo build --locked --workspace -j 4 and cargo test --locked --workspace --no-fail-fast -j 4 -- --test-threads=4 --show-output, both Debug and Release (--release), pass. Each test run: 1,423 passed / 0 failed / 46 ignored. Session-local XCL_DXIL_CACHE points to a writable workspace directory; caching remains enabled. Final head b8a336de4332 differs only by the README paragraph documenting this input contract; its Python suite and Debug/Release builds were checked again. Native test sources and runtime are identical to the tested revision.
  • Each full run has 29 explicit SKIPPED lines: 21 native-wave64 cases, three unsupported per-lane f16 cases, three unavailable D3D12-debug-layer cases, one disabled opt-in heap-window case and one unavailable cold-driver-cache-control case. Harness passes include these skips and sample-dependent early returns; no XCL_SAMPLE_* files supplied.
  • Changed-file git diff --check and PR-description checks pass.

Regression run

  • Scripts/tests only; no runtime/build-input changes or title data.

Not tested

  • No retail shader sweeps/titles, MSVC, AMD/WARP parity, native wave64, D3D12 debug layer or controlled cold driver-cache run. No game data, system/driver setting change or GPU performance claim.
  • Upstream CI approval is still required; local results are not an upstream CI pass.

AI use

  • OpenAI Codex (GPT-6; exact model variant unavailable) investigated, implemented and reviewed the fix and review follow-up, ran the reported tests, and prepared this description. Publication authorized by the user.
**@⁠JiyouProt** on GitHub · 2026-11-25 22:04 UTC · [original](https://github.com/xcl-dev/xcl/pull/2536) `JiyouProt:codex/coverage-gate-integrity` → `main` · +179 −0 · 3 files · 1 commits · open The shader coverage gate can report success with `NaN` counters and can save invalid or inconsistent counts as its baseline. For example, `total=10, translated=11` with the other outcomes zero passes comparison and update; a later genuine 10-of-10 sweep then looks like a regression. Require non-negative integer stage counters and `total == translated + unsupported + validator_failed + panicked + timeout`, matching `StageCounts::total` in `coverage.rs`. Validate saved/live sweeps and comparison baselines before use. Invalid counters return 2 with the stage/field named; rejected updates preserve existing bytes and do not create an absent baseline. **What is in it** - `scripts/coverage_gate.py`: counter type/range and total-consistency checks; valid comparison thresholds unchanged. Total check addresses [review 6068816616](https://git.gtahub.st/github/xcl-dev--xcl/pulls/2536). - `scripts/test_coverage_gate_counts.py`: synthetic regressions for saved and child output, baseline preservation, sums above/below total, every outcome, invalid baseline, valid mixed outcomes and zero/large counts. Extra metadata is not summed. - `README.md`: documents the report contract and rejected-update behavior. RavenCurseBurg also [independently reproduced the total mismatch](https://git.gtahub.st/github/xcl-dev--xcl/pulls/2536) and proposed the same invariant; the results below are our own runs. - Separate scopes remain with #2099 (outer mappings), #2265 (child exit status), #2253 (empty stages), #2354 (new-stage failures). **Tested** - Windows 11 Pro 10.0.26300, Ryzen 7 5800X, 64 GB, RTX 3080 Ti 12 GB / NVIDIA 616.92; Python 3.11.9, DXC 1.9.2609.5, portable Rust 1.100.0 Windows GNU / LLVM-MinGW 23.1.6. Session-local LLD/self-contained support libraries and `-C target-feature=+fma` on this FMA-capable CPU, as in the prior validation. - `python -B -m unittest discover -s scripts -p 'test_*.py' -v`: **36 passed, 0 failed**. The review regression produces **16 failing subcases** on original PR head `60bb165`; all pass after the sum check. Original counter regressions also remain green. - **12 real CLI checks passed** using saved JSON and a synthetic child command, compare and update, for valid counts and outcome sums both above/below total. Rejections return 2, name `CS.total`, and preserve baseline bytes. - Exact code revision `0452c949b6e5`, clean tree: `cargo build --locked --workspace -j 4` and `cargo test --locked --workspace --no-fail-fast -j 4 -- --test-threads=4 --show-output`, both Debug and Release (`--release`), pass. Each test run: **1,423 passed / 0 failed / 46 ignored**. Session-local `XCL_DXIL_CACHE` points to a writable workspace directory; caching remains enabled. Final head `b8a336de4332` differs only by the README paragraph documenting this input contract; its Python suite and Debug/Release builds were checked again. Native test sources and runtime are identical to the tested revision. - Each full run has **29 explicit SKIPPED lines**: 21 native-wave64 cases, three unsupported per-lane f16 cases, three unavailable D3D12-debug-layer cases, one disabled opt-in heap-window case and one unavailable cold-driver-cache-control case. Harness passes include these skips and sample-dependent early returns; no `XCL_SAMPLE_*` files supplied. - Changed-file `git diff --check` and PR-description checks pass. **Regression run** - Scripts/tests only; no runtime/build-input changes or title data. **Not tested** - No retail shader sweeps/titles, MSVC, AMD/WARP parity, native wave64, D3D12 debug layer or controlled cold driver-cache run. No game data, system/driver setting change or GPU performance claim. - Upstream CI approval is still required; local results are not an upstream CI pass. **AI use** - OpenAI Codex (GPT-6; exact model variant unavailable) investigated, implemented and reviewed the fix and review follow-up, ran the reported tests, and prepared this description. Publication authorized by the user.
Validate stage counters before comparing or updating the reference so NaN cannot hide regressions and invalid updates leave the baseline unchanged. Synthetic tests reproduce the original false passes and baseline corruption.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 05:33:13 +00:00
Author
Owner

@⁠DavidM1911 on GitHub · 2026-11-25 22:17 UTC · original

Verification on RTX 3060 Ti (Windows 11), branch merged with current main:

  • cargo test -p xcl --lib: all passed, 0 failed, ~26 ignored. (Intermittent single-test flake / 0xc0000005 abort under parallel scheduling — tracked in #1978; clean on single-threaded rerun.)

Thanks!

**@⁠DavidM1911** on GitHub · 2026-11-25 22:17 UTC · [original](https://github.com/xcl-dev/xcl/pull/2536#issuecomment-7176184206) Verification on RTX 3060 Ti (Windows 11), branch merged with current `main`: - `cargo test -p xcl --lib`: all passed, 0 failed, ~26 ignored. (Intermittent single-test flake / 0xc0000005 abort under parallel scheduling — tracked in #1978; clean on single-threaded rerun.) Thanks!
Author
Owner

@⁠RavenCurseBurg on GitHub · 2026-11-25 22:35 UTC · original · edited 2026-11-26 07:45 UTC

I tested 60bb165ab20756a6d5c7d9b2ede307b68060cd59 alongside #2253 (4b29d00). git merge-tree --write-tree 60bb165 4b29d00 gave a clean combined tree 71f1fe88b85d86fa9b2d0d297128de84fd0d7dea. I used a private copy of the checked-in five-stage baseline for each case.

I ran 20 CLI checks on each of the two heads and on the combined tree, 60 in all. Each input went through both --run-json <file> and --xcl <stand-in.cmd> --rpf synthetic.

  • On the combined tree, an empty stage map and each of five invalid CS.translated values (boolean, fractional, negative, NaN and missing) returned 2 on update. Every rejected update preserved the original bytes. A malformed baseline also returned 2 on comparison and stayed unchanged.
  • The standalone heads isolated their respective fixes. The counter patch alone allowed the empty update; the empty-stage patch alone allowed those five invalid non-empty updates. On all three trees an identical report passed, one fewer CS translation returned 1, and a valid update wrote the expected counts.
  • python -B -m unittest discover -s scripts -p "test_*.py" passed 33 tests on this head, 27 on #2253 and 35 on the combination.

Windows 11 26100.9711, Core i7-13700, Python 3.14.3. Synthetic inputs and child process only. OpenAI Codex (GPT-6) prepared and ran this compatibility check.

Follow-up on the latest review

I reproduced review 6068816616 with a saved stage whose five outcomes add to 10. On the PR head, totals of both 9 and 11 passed comparison and update. Each update replaced the baseline.

The candidate returns 2 for both mismatches in compare and update, and all four invocations preserved the existing baseline bytes. A balanced 10-of-10 run still passed, a balanced regression returned 1, and a valid update with all five outcomes represented succeeded. All 35 Python script tests passed. These were saved-input CLI runs, with no real shader pack.

Candidate commit 5b290526 is based directly on 60bb165ab207. Reproduce with python -B -m unittest discover -s scripts -p test_*.py. OpenAI Codex (GPT-6) prepared the fix and ran these Windows CPU fixtures. No game, GPU benchmark or workspace build.

Recheck after the update

I rechecked the revised head b8a336de4332499dffa023614871bf4832fdea10 with synthetic saved reports. Stage totals one below and one above the sum each returned 2 on compare and update, with the baseline unchanged. On the previous head all four returned 0 and both updates replaced the baseline. All 36 Python script tests passed on the revised head.

The new head still merges cleanly with #2253 at 4b29d00cbeaa (tree 2d2a01055d0a17940de8a8a9bb54972bee577238). I ran the same four cases on the combined script, plus an empty-stage update. All five returned 2 and preserved the file. The standalone revised head still accepts the empty-stage update, which is the separate case covered by #2253.

OpenAI Codex (GPT-6) ran the checks and prepared this update. No game or GPU workload.

**@⁠RavenCurseBurg** on GitHub · 2026-11-25 22:35 UTC · [original](https://github.com/xcl-dev/xcl/pull/2536#issuecomment-7176549096) · edited 2026-11-26 07:45 UTC I tested `60bb165ab20756a6d5c7d9b2ede307b68060cd59` alongside #2253 (`4b29d00`). `git merge-tree --write-tree 60bb165 4b29d00` gave a clean combined tree `71f1fe88b85d86fa9b2d0d297128de84fd0d7dea`. I used a private copy of the checked-in five-stage baseline for each case. I ran 20 CLI checks on each of the two heads and on the combined tree, 60 in all. Each input went through both `--run-json <file>` and `--xcl <stand-in.cmd> --rpf synthetic`. - On the combined tree, an empty stage map and each of five invalid CS.translated values (boolean, fractional, negative, NaN and missing) returned 2 on update. Every rejected update preserved the original bytes. A malformed baseline also returned 2 on comparison and stayed unchanged. - The standalone heads isolated their respective fixes. The counter patch alone allowed the empty update; the empty-stage patch alone allowed those five invalid non-empty updates. On all three trees an identical report passed, one fewer CS translation returned 1, and a valid update wrote the expected counts. - `python -B -m unittest discover -s scripts -p "test_*.py"` passed 33 tests on this head, 27 on #2253 and 35 on the combination. Windows 11 26100.9711, Core i7-13700, Python 3.14.3. Synthetic inputs and child process only. OpenAI Codex (GPT-6) prepared and ran this compatibility check. **Follow-up on the latest review** I reproduced review 6068816616 with a saved stage whose five outcomes add to 10. On the PR head, totals of both 9 and 11 passed comparison and update. Each update replaced the baseline. The candidate returns 2 for both mismatches in compare and update, and all four invocations preserved the existing baseline bytes. A balanced 10-of-10 run still passed, a balanced regression returned 1, and a valid update with all five outcomes represented succeeded. All 35 Python script tests passed. These were saved-input CLI runs, with no real shader pack. [Candidate commit 5b290526](https://github.com/RavenCurseBurg/xcl/commit/5b2905263077a4a6053c9a7a050eeb1b610cc896) is based directly on `60bb165ab207`. Reproduce with `python -B -m unittest discover -s scripts -p test_*.py`. OpenAI Codex (GPT-6) prepared the fix and ran these Windows CPU fixtures. No game, GPU benchmark or workspace build. **Recheck after the update** I rechecked the revised head `b8a336de4332499dffa023614871bf4832fdea10` with synthetic saved reports. Stage totals one below and one above the sum each returned 2 on compare and update, with the baseline unchanged. On the previous head all four returned 0 and both updates replaced the baseline. All 36 Python script tests passed on the revised head. The new head still merges cleanly with #2253 at `4b29d00cbeaa` (tree `2d2a01055d0a17940de8a8a9bb54972bee577238`). I ran the same four cases on the combined script, plus an empty-stage update. All five returned 2 and preserved the file. The standalone revised head still accepts the empty-stage update, which is the separate case covered by #2253. OpenAI Codex (GPT-6) ran the checks and prepared this update. No game or GPU workload.
Author
Owner

@⁠luckyteagirl on GitHub · 2026-11-26 05:04 UTC · original · reviewed

Could validate_counts also check that each stage's total equals the sum of its five outcome counters after validating their types? The producer in coverage.rs computes the JSON total from exactly those five values. Against a baseline with total=10 and translated=10, a saved report with total=10, translated=11, and the other counters zero currently passes comparison and can replace the baseline with --update. A later genuine 10-of-10 sweep then appears to regress. A fixture could check that compare and update reject the inconsistent report and that update preserves the existing baseline bytes. Source review only at head 60bb165a; no test run. AI-assisted with Codex (GPT-6.2 Sol).

**@⁠luckyteagirl** on GitHub · 2026-11-26 05:04 UTC · [original](https://github.com/xcl-dev/xcl/pull/2536#pullrequestreview-6068816616) · **reviewed** Could `validate_counts` also check that each stage's `total` equals the sum of its five outcome counters after validating their types? The producer in `coverage.rs` computes the JSON total from exactly those five values. Against a baseline with `total=10` and `translated=10`, a saved report with `total=10`, `translated=11`, and the other counters zero currently passes comparison and can replace the baseline with `--update`. A later genuine 10-of-10 sweep then appears to regress. A fixture could check that compare and update reject the inconsistent report and that update preserves the existing baseline bytes. Source review only at head `60bb165a`; no test run. AI-assisted with Codex (GPT-6.2 Sol).
github-bot force-pushed github-bot/gh-2536 from 60bb165ab2 to b8a336de43 2026-11-26 07:10:05 +00:00 Compare
This pull request can be merged automatically.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/2536/head:github-bot/gh-2536'
git switch 'github-bot/gh-2536'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-2536'
git switch 'github-bot/gh-2536'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-2536'
git switch 'github-bot/gh-2536'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-2536'
git switch 'main'
git merge --squash 'github-bot/gh-2536'
git switch 'main'
git merge --ff-only 'github-bot/gh-2536'
git switch 'main'
git merge 'github-bot/gh-2536'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No description provided.