tests: cache and parallelize form_coverage_check control runs #1527

Manually merged
github merged 2 commits from gh-pr/1527/head into gh-pr/1527/base 2026-11-26 23:14:18 +00:00
Owner

@⁠tedin7 on GitHub · 2026-11-24 13:40 UTC · original
tedin7:x2w-opt-form-coverage → main · +212 −99 · 2 files · 2 commits · merged 2026-11-24 15:38 UTC

Cache and parallelize tests/pixel_aot_check.check_controls across tests/form_coverage_check.py with zero dropped assertions and set-identical ACCEPTED coverage.

Summary

  • tests/form_coverage_check.py:
    • Save and restore pixel.ACCEPTED in check_plain_bitscan_forms (with try ... finally) so it no longer clears the set populated by pixel.check_controls.
    • Add _controls_accepted() to run pixel.check_controls once per process and reuse the cached frozenset across check_shader_records, check_swap_coverage, and check_pk_fmac_coverage.
  • tests/pixel_aot_check.py:
    • Split the independent no-arg sub-checks and sharded binary16 arithmetic reference grid out of _check_controls_inline(directory) and run them via concurrent.futures.ProcessPoolExecutor in check_controls(directory) while the parent executes the inline body, collecting ACCEPTED sets deterministically across workers with a clean serial fallback (X2W_SERIAL_CONTROLS=1, single-core, or pool creation failure).

Verification

Commit under test: x2w-opt-form-coverage on origin/main (1ca0dec1).

  • Baseline (origin/main before change, python -B tests/form_coverage_check.py):
    • 75.017s (exit 0, form coverage checks passed)
  • After (python -B tests/form_coverage_check.py, 2x back-to-back on 16-core Linux):
    • Clean run: 11.574s (exit 0, form coverage checks passed)
    • Back-to-back under machine load (load average: 16.91): 14.050s and 17.400s (both exit 0, form coverage checks passed)
  • python -B tests/pixel_aot_check.py: 6.379s (exit 0)
  • Direct set-equality verification (check_controls(..., parallel=False) vs check_controls(..., parallel=True) vs form_coverage_check._controls_accepted()):
    • SET_IDENTICAL=True count=788 (serial=24.525s, parallel=5.219s)
  • python -B tests/docs_links_check.py: passed (16 Markdown files and 340 links)
  • python -B tests/bidi_controls_check.py: passed (1239 tracked source, script and build/CI files: no bidirectional controls)
  • git diff --check origin/main..HEAD: passed

AI-assisted; commands listed were executed locally.

**@⁠tedin7** on GitHub · 2026-11-24 13:40 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/1527) `tedin7:x2w-opt-form-coverage` → `main` · +212 −99 · 2 files · 2 commits · merged 2026-11-24 15:38 UTC Cache and parallelize `tests/pixel_aot_check.check_controls` across `tests/form_coverage_check.py` with zero dropped assertions and set-identical `ACCEPTED` coverage. ### Summary - `tests/form_coverage_check.py`: - Save and restore `pixel.ACCEPTED` in `check_plain_bitscan_forms` (with `try ... finally`) so it no longer clears the set populated by `pixel.check_controls`. - Add `_controls_accepted()` to run `pixel.check_controls` once per process and reuse the cached `frozenset` across `check_shader_records`, `check_swap_coverage`, and `check_pk_fmac_coverage`. - `tests/pixel_aot_check.py`: - Split the independent no-arg sub-checks and sharded binary16 arithmetic reference grid out of `_check_controls_inline(directory)` and run them via `concurrent.futures.ProcessPoolExecutor` in `check_controls(directory)` while the parent executes the inline body, collecting `ACCEPTED` sets deterministically across workers with a clean serial fallback (`X2W_SERIAL_CONTROLS=1`, single-core, or pool creation failure). ### Verification Commit under test: `x2w-opt-form-coverage` on `origin/main` (`1ca0dec1`). - Baseline (`origin/main` before change, `python -B tests/form_coverage_check.py`): - `75.017s` (`exit 0`, `form coverage checks passed`) - After (`python -B tests/form_coverage_check.py`, 2x back-to-back on 16-core Linux): - Clean run: `11.574s` (`exit 0`, `form coverage checks passed`) - Back-to-back under machine load (`load average: 16.91`): `14.050s` and `17.400s` (both `exit 0`, `form coverage checks passed`) - `python -B tests/pixel_aot_check.py`: `6.379s` (`exit 0`) - Direct set-equality verification (`check_controls(..., parallel=False)` vs `check_controls(..., parallel=True)` vs `form_coverage_check._controls_accepted()`): - `SET_IDENTICAL=True count=788` (`serial=24.525s`, `parallel=5.219s`) - `python -B tests/docs_links_check.py`: passed (`16 Markdown files and 340 links`) - `python -B tests/bidi_controls_check.py`: passed (`1239 tracked source, script and build/CI files: no bidirectional controls`) - `git diff --check origin/main..HEAD`: passed AI-assisted; commands listed were executed locally.
ProcessPoolExecutor starts its workers lazily inside submit(), outside the constructor handler. A refusal to start a process or thread there (for example a process limit) raised instead of taking the serial fallback. Any error from submit() is a startup failure, since submit() runs no check: pending futures are cancelled and the controls run serially. Failures of the checks themselves still propagate.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 23:14:16 +00:00
github manually merged commit 38cf3c00f3 into gh-pr/1527/base 2026-11-26 23:14:18 +00:00
Author
Owner

@⁠tedin7 on GitHub · 2026-11-24 14:23 UTC · original

Verified on Windows Server 2025 (Build 26100, MSVC 14.44.35207 + D3D12 WARP) at commit a4daf98481cedba25989ed41391c11a89c7dbfe7:

  • Debug (--preset dev):
    • Build (cmake --build --preset dev --target offscreen_check -- -j 6): 34.16s (configure 1.85s)
    • Test (ctest --preset dev -R '^pixel_aot_warp$' --parallel 4 --no-tests=error --output-on-failure): 1/1 passed (13.98s: pixel_aot_warp 13.90s)
  • Release /O2 (--preset release):
    • Build (cmake --build --preset release --target offscreen_check -- -j 6): 45.20s (configure 1.93s)
    • Test (ctest --preset release -R '^pixel_aot_warp$' --parallel 4 --no-tests=error --output-on-failure): 1/1 passed (12.84s: pixel_aot_warp 12.76s)
  • Windows Python checks (spawn):
    • tests/form_coverage_check.py: passed (18.02s)
    • tests/pixel_aot_check.py: passed (9.56s)
  • Linux timings & parity:
    • tests/form_coverage_check.py: 75.0s baseline -> 16.90s / 14.60s back-to-back (exit 0, form coverage checks passed)
    • tests/pixel_aot_check.py: 5.86s (exit 0)
    • check_controls(..., parallel=False) vs check_controls(..., parallel=True): identical ACCEPTED set (788 forms), 27.88s serial -> 7.34s parallel
    • Failure-propagation control: worker ValueError raises RuntimeError naming the failing sub-task and cancels pending futures
  • Hardening:
    • Rebased onto latest origin/main
    • Capped ProcessPoolExecutor max_workers at 61 to respect Windows _MAX_WINDOWS_WORKERS on >61-core hosts
    • Cancel pending futures immediately if _check_controls_inline or any worker sub-check fails

AI-assisted; commands listed were executed locally.

**@⁠tedin7** on GitHub · 2026-11-24 14:23 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/1527#issuecomment-7134296170) Verified on Windows Server 2025 (Build 26100, MSVC 14.44.35207 + D3D12 WARP) at commit `a4daf98481cedba25989ed41391c11a89c7dbfe7`: - **Debug (`--preset dev`)**: - Build (`cmake --build --preset dev --target offscreen_check -- -j 6`): `34.16s` (configure `1.85s`) - Test (`ctest --preset dev -R '^pixel_aot_warp$' --parallel 4 --no-tests=error --output-on-failure`): **1/1 passed** (`13.98s`: `pixel_aot_warp` `13.90s`) - **Release `/O2` (`--preset release`)**: - Build (`cmake --build --preset release --target offscreen_check -- -j 6`): `45.20s` (configure `1.93s`) - Test (`ctest --preset release -R '^pixel_aot_warp$' --parallel 4 --no-tests=error --output-on-failure`): **1/1 passed** (`12.84s`: `pixel_aot_warp` `12.76s`) - **Windows Python checks (`spawn`)**: - `tests/form_coverage_check.py`: passed (`18.02s`) - `tests/pixel_aot_check.py`: passed (`9.56s`) - **Linux timings & parity**: - `tests/form_coverage_check.py`: `75.0s` baseline -> `16.90s` / `14.60s` back-to-back (`exit 0`, `form coverage checks passed`) - `tests/pixel_aot_check.py`: `5.86s` (`exit 0`) - `check_controls(..., parallel=False)` vs `check_controls(..., parallel=True)`: identical `ACCEPTED` set (`788` forms), `27.88s` serial -> `7.34s` parallel - Failure-propagation control: worker `ValueError` raises `RuntimeError` naming the failing sub-task and cancels pending futures - **Hardening**: - Rebased onto latest `origin/main` - Capped `ProcessPoolExecutor` `max_workers` at `61` to respect Windows `_MAX_WINDOWS_WORKERS` on >61-core hosts - Cancel pending futures immediately if `_check_controls_inline` or any worker sub-check fails AI-assisted; commands listed were executed locally.
Author
Owner

@⁠chatgpt-codex-connector[bot] on GitHub · 2026-11-24 14:23 UTC · original · edited 2026-11-24 14:30 UTC

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-24T14:30:57.481959Z a4daf98 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.

**@⁠chatgpt-codex-connector[bot]** on GitHub · 2026-11-24 14:23 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/1527#issuecomment-7134301849) · edited 2026-11-24 14:30 UTC <!-- codex-pull-request-review-summary --> <!-- codex-review-state:v1 {"code_review":{"commit_sha":"a4daf98481cedba25989ed41391c11a89c7dbfe7","has_any_findings":true,"has_unresolved_findings":true,"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-24T14:30:57.481959Z">2026-11-24T14:30:57.481959Z</relative-time> | `a4daf98` | 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>
Author
Owner

@⁠chatgpt-codex-connector[bot] on GitHub · 2026-11-24 14:30 UTC · original

P2 Badge Extend the serial fallback to lazy worker startup

When worker creation is denied or a process limit is exhausted, this submission raises instead of taking the serial fallback: ProcessPoolExecutor starts workers lazily in submit(), outside the constructor-only exception handler. Reproduced on Linux/Python 3.12 in an unprivileged process with RLIMIT_NPROC=(0, 0): the parent commit passes with 788 accepted forms, but this commit raises BlockingIOError(11, 'Resource temporarily unavailable'); explicit serial mode also passes under the same limit. Consequently, the default pixel-control and form-coverage checks regress on these hosts. Include initial submission and worker startup in the startup-failure fallback while continuing to propagate actual check failures.

Useful? React with 👍 / 👎.

**@⁠chatgpt-codex-connector[bot]** on GitHub · 2026-11-24 14:30 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/1527#discussion_r4681496473) **<sub><sub>![P2 Badge](https://img.shields.io/badge/P2-yellow?style=flat)</sub></sub> Extend the serial fallback to lazy worker startup** When worker creation is denied or a process limit is exhausted, this submission raises instead of taking the serial fallback: `ProcessPoolExecutor` starts workers lazily in `submit()`, outside the constructor-only exception handler. Reproduced on Linux/Python 3.12 in an unprivileged process with `RLIMIT_NPROC=(0, 0)`: the parent commit passes with 788 accepted forms, but this commit raises `BlockingIOError(11, 'Resource temporarily unavailable')`; explicit serial mode also passes under the same limit. Consequently, the default pixel-control and form-coverage checks regress on these hosts. Include initial submission and worker startup in the startup-failure fallback while continuing to propagate actual check failures. Useful? React with 👍 / 👎. <!-- codex-code-review-finding:v1 -->
Author
Owner

@⁠tedin7 on GitHub · 2026-11-24 14:44 UTC · original

Fixed in 1ed17b653be6eb6ba628cf1c3911d75ec55e7ea0.

check_controls() now wraps executor.submit() in the startup-failure fallback handler: if lazy worker/thread creation fails during submission (e.g. BlockingIOError under RLIMIT_NPROC or PermissionError), any already-submitted futures are cancelled, the pool exits cleanly via with executor:, and the inline + serial control checks run to completion. Actual worker check failures from future.result() still cancel pending futures and propagate as RuntimeError without falling back to serial.

Verified locally:

  • Partial worker spawn failure (BlockingIOError on 2nd Process.start with real ProcessPoolExecutor) falls back cleanly and validates all 788 accepted forms; worker AssertionError propagates without serial fallback.
  • Linux: tests/pixel_aot_check.py and tests/form_coverage_check.py pass.
  • Windows Server 2025 (MSVC 14.44.35207 + D3D12 WARP, Debug & Release /O2): tests/form_coverage_check.py (16.1s), tests/pixel_aot_check.py (8.9s), and pixel_aot_warp / pixel_aot_f16_arith_warp pass (2/2 Debug, 2/2 Release).

AI-assisted; commands listed were executed locally.

**@⁠tedin7** on GitHub · 2026-11-24 14:44 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/1527#discussion_r4681701585) Fixed in `1ed17b653be6eb6ba628cf1c3911d75ec55e7ea0`. `check_controls()` now wraps `executor.submit()` in the startup-failure fallback handler: if lazy worker/thread creation fails during submission (e.g. `BlockingIOError` under `RLIMIT_NPROC` or `PermissionError`), any already-submitted futures are cancelled, the pool exits cleanly via `with executor:`, and the inline + serial control checks run to completion. Actual worker check failures from `future.result()` still cancel pending futures and propagate as `RuntimeError` without falling back to serial. Verified locally: - Partial worker spawn failure (`BlockingIOError` on 2nd `Process.start` with real `ProcessPoolExecutor`) falls back cleanly and validates all 788 accepted forms; worker `AssertionError` propagates without serial fallback. - Linux: `tests/pixel_aot_check.py` and `tests/form_coverage_check.py` pass. - Windows Server 2025 (MSVC 14.44.35207 + D3D12 WARP, Debug & Release `/O2`): `tests/form_coverage_check.py` (16.1s), `tests/pixel_aot_check.py` (8.9s), and `pixel_aot_warp` / `pixel_aot_f16_arith_warp` pass (2/2 Debug, 2/2 Release). AI-assisted; commands listed were executed locally.
Author
Owner

@⁠chatgpt-codex-connector[bot] on GitHub · 2026-11-24 14:30 UTC · original · reviewed

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: a4daf98481

ℹ️ 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@⁠codex address that feedback".

**@⁠chatgpt-codex-connector[bot]** on GitHub · 2026-11-24 14:30 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/1527#pullrequestreview-6041100303) · **reviewed** <!-- codex-review-receipt:v1 --> ### 💡 Codex Review Here are some automated review suggestions for this pull request. **Reviewed commit:** `a4daf98481` <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". If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@⁠codex address that feedback". </details>
This discussion has been locked. Commenting is limited to contributors.
No description provided.