Skip to content

Scripts: reject invalid shader coverage counters - #2536

Open
JiyouProt wants to merge 1 commit into
xcl-dev:mainfrom
JiyouProt:codex/coverage-gate-integrity
Open

JiyouProt wants to merge 1 commit into
xcl-dev:mainfrom
JiyouProt:codex/coverage-gate-integrity

Conversation

@JiyouProt

@JiyouProt JiyouProt commented Nov 25, 2026 •

Copy link
Copy Markdown

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

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.

@DavidM1911

Copy link
Copy Markdown
Contributor

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

Thanks!

@RavenCurseBurg

RavenCurseBurg commented Nov 25, 2026 •

Copy link
Copy Markdown

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 Scripts: preserve the coverage baseline on empty sweeps #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.

@KOLESNiii KOLESNiii mentioned this pull request Nov 25, 2026

@luckyteagirl luckyteagirl left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

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.
@JiyouProt
JiyouProt force-pushed the codex/coverage-gate-integrity branch from 60bb165 to b8a336d Compare November 26, 2026 07:04
@Foniass

Foniass commented Dec 1, 2026

Copy link
Copy Markdown
Contributor

Triage (#1607) – head b8a336d

No open or merged PR validates the counters: #2099 checks only that stages is a mapping and file/IO errors, #2253 refuses empty sweeps, #2265 failed sweeps, #2645 atomic baseline writes. validate_counts matches what coverage.rs emits (total = sum of the five outcomes in StageCounts::total) and the committed baseline passes it.
No problems found in the diff.
Recommendation: keep open.

AI review: Claude Code (Claude Opus 5.5), diffs read only, not built or run; not checked by a human.

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.

5 participants