Tests: gpu adapter selector parse/fallback and env override contract #1654

Open
amazedturnip wants to merge 1 commit from upstream-pr/1664 into main
amazedturnip commented 2026-11-24 18:57:03 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by amazedturnip on 2026-11-24T18:57:03Z.


Adds an integration test file covering the public Selector contract: parse (empty/auto, warp, positional index, leading-zeros never positional, non-digit/overflow names, lowercased names), from_env_or precedence (XCL_ADAPTER when set and non-blank, configured fallback otherwise), allows (Auto/Warp/Index/Name direct rules), and Display rendering. Env-touching tests serialize on a process-global mutex with restore-on-drop. No production code changed; pure parser coverage, GPU-independent.

What is in it

  • crates/xcl/tests/gpu_adapter.rs: new integration test file covering xcl::gpu::adapter::Selector parse/fallback (auto/empty, warp, digit positional index, leading-zeros never positional, non-digit names, lowercased names, u64/overflow degrades to Name)
  • crates/xcl/tests/gpu_adapter.rs: from_env_or contract — uses XCL_ADAPTER when set and non-blank, otherwise falls back to the configured string; blank/whitespace env values fall back
  • crates/xcl/tests/gpu_adapter.rs: allows — Auto matches every position, Warp matches nothing, Index matches only its position, Name matches case-insensitively by substring
  • crates/xcl/tests/gpu_adapter.rs: Display — auto/warp/{n}/"{s}" rendering for each variant
  • Uses a process-global ENV_LOCK mutex + EnvGuard (restores previous XCL_ADAPTER on drop) so env-touching tests cannot leak process state

Tested

  • Hardware / OS / Rust: AMD Ryzen 7 9800X3D 8-Core Processor, Windows 11 Pro 10.0.26100 (Build 26100), rustc 1.94.1 (e408947bf 2026-03-25), stable-x86_64-pc-windows-msvc, debug build
  • AMD (AMD Radeon(TM) Graphics (driver 32.0.21043.19003, DXC 1.9.2609, native wave64), XCL_ADAPTER=radeon): cargo test --workspace -- --test-threads=2 — 868 passed, 0 failed, 42 ignored (SKIPPED GPU tests: 1 (no heap windows))
  • Verification / negative control: temporarily dropped the leading-zeros guard in crates/xcl/src/gpu/adapter.rs line 39; cargo test --test gpu_adapter failed 3/10 (parse_leading_zeros_are_never_a_positional_index, from_env_or_prefers_env_when_set_and_non_blank, from_env_or_falls_back_to_configured_when_unset_or_blank); reverted via git checkout -- crates/xcl/src/gpu/adapter.rs and re-ran 10/10 passed.

Not tested

  • Retail Xbox Series X|S titles (not available on this host)
  • pub(crate) DXGI device-creation / Selector::select_indices hardware paths (covered by inline tests in crates/xcl/src/gpu/adapter_tests.rs)
  • NVIDIA wave32 GPU (not run in this pass; verified on AMD Radeon native wave64)

AI use

  • Local AI (thinkingmachines_inkling-2-mini) assisted with diagnosis, implementation, tests, review, and description; all tests executed locally on AMD Radeon (native wave64).
<!-- greyfinch-sync:ivall/xcl:issue:5478411414 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1664). Originally posted by [amazedturnip](https://github.com/amazedturnip) on 2026-11-24T18:57:03Z. --- Adds an integration test file covering the public `Selector` contract: `parse` (empty/auto, warp, positional index, leading-zeros never positional, non-digit/overflow names, lowercased names), `from_env_or` precedence (`XCL_ADAPTER` when set and non-blank, configured fallback otherwise), `allows` (Auto/Warp/Index/Name direct rules), and `Display` rendering. Env-touching tests serialize on a process-global mutex with restore-on-drop. No production code changed; pure parser coverage, GPU-independent. **What is in it** - `crates/xcl/tests/gpu_adapter.rs`: new integration test file covering `xcl::gpu::adapter::Selector` parse/fallback (auto/empty, warp, digit positional index, leading-zeros never positional, non-digit names, lowercased names, `u64`/overflow degrades to `Name`) - `crates/xcl/tests/gpu_adapter.rs`: `from_env_or` contract — uses `XCL_ADAPTER` when set and non-blank, otherwise falls back to the configured string; blank/whitespace env values fall back - `crates/xcl/tests/gpu_adapter.rs`: `allows` — `Auto` matches every position, `Warp` matches nothing, `Index` matches only its position, `Name` matches case-insensitively by substring - `crates/xcl/tests/gpu_adapter.rs`: `Display` — `auto`/`warp`/`{n}`/`"{s}"` rendering for each variant - Uses a process-global `ENV_LOCK` mutex + `EnvGuard` (restores previous `XCL_ADAPTER` on drop) so env-touching tests cannot leak process state **Tested** - Hardware / OS / Rust: AMD Ryzen 7 9800X3D 8-Core Processor, Windows 11 Pro 10.0.26100 (Build 26100), rustc 1.94.1 (e408947bf 2026-03-25), stable-x86_64-pc-windows-msvc, debug build - AMD (`AMD Radeon(TM) Graphics (driver 32.0.21043.19003, DXC 1.9.2609, native wave64)`, `XCL_ADAPTER=radeon`): `cargo test --workspace -- --test-threads=2` — 868 passed, 0 failed, 42 ignored (SKIPPED GPU tests: 1 (no heap windows)) - Verification / negative control: temporarily dropped the leading-zeros guard in `crates/xcl/src/gpu/adapter.rs` line 39; `cargo test --test gpu_adapter` failed 3/10 (`parse_leading_zeros_are_never_a_positional_index`, `from_env_or_prefers_env_when_set_and_non_blank`, `from_env_or_falls_back_to_configured_when_unset_or_blank`); reverted via `git checkout -- crates/xcl/src/gpu/adapter.rs` and re-ran 10/10 passed. **Not tested** - Retail Xbox Series X|S titles (not available on this host) - `pub(crate)` DXGI device-creation / `Selector::select_indices` hardware paths (covered by inline tests in `crates/xcl/src/gpu/adapter_tests.rs`) - NVIDIA wave32 GPU (not run in this pass; verified on AMD Radeon native wave64) **AI use** - Local AI (thinkingmachines_inkling-2-mini) assisted with diagnosis, implementation, tests, review, and description; all tests executed locally on AMD Radeon (native wave64).
DavidM1911 commented 2026-11-24 21:30:07 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by DavidM1911 on 2026-11-24T21:26:31Z.


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

  • cargo test -p xcl --lib: all passed, 0 failed, ~22 ignored.

Thanks!

<!-- greyfinch-sync:ivall/xcl:comment:7144934114 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1664#issuecomment-7144934114). Originally posted by [DavidM1911](https://github.com/DavidM1911) on 2026-11-24T21:26:31Z. --- Verification on RTX 3060 Ti (Windows 11), branch merged with current `main`: - `cargo test -p xcl --lib`: all passed, 0 failed, ~22 ignored. Thanks!
JJAutoCompare commented 2026-11-25 05:08:25 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by JJAutoCompare on 2026-11-25T04:44:33Z.


XCL PR #1664 — Windows / Intel Arc A770 verification

Tested clean, detached head 48702fb268a74de9528a833a6c57d4159ec94e8e on STOR-WINLAB. Intel Arc A770 (driver 32.0.101.9175), AMD Ryzen 7 3800X, Windows 11 Enterprise Evaluation build 26200. DXC 1.9.2609.5, verified with dxc.exe --version. Rust 1.100.0 (0ef1bc386, x86_64-pc-windows-msvc). Cargo dev/test profiles were unoptimized with debug info and incremental compilation disabled.

Tested

  • cargo build --workspace passed. cargo test --workspace --no-run compiled 20 test binaries. Both ran outside the Arc mutex.
  • cargo test -p xcl --test gpu_adapter with XCL_ADAPTER=NONE_CPU_ONLY ran outside the mutex. 10 passed, 0 failed, 0 ignored, 0 skipped. The only changed file, crates/xcl/tests/gpu_adapter.rs, covers auto/WARP and name normalization, positional indices, leading-zero and overflow name fallback, nonblank environment override and unset/blank configuration fallback, direct index and name matching, and display formatting. These tests use no DXGI calls.
  • cargo test --workspace --no-fail-fast -- --test-threads=4 ran once inside Invoke-ArcTest.ps1 with XCL_ADAPTER=A770 and RUST_TEST_NOCAPTURE=1. Exit 101. All 21 result lines (20 binaries and one doc-test run) sum to 850 passed, 18 failed, and 42 ignored. All 10 selector tests passed again.

Workspace failures and skips

  • 17 library failures. Compute pipeline creation returned 0x80070057 in 13 tests. Four others reported mismatches in FMA, mip sampling, packed f16, and pixel-shader wave64 reductions.
  • One end-to-end failure. test_title_runs_and_game_folder_is_untouched reported blue where the RSSetDepthBiasX check expected green.
  • Six exact SKIPPED markers already appear in the harness pass tally and provide no coverage. Two reported no wave64, two reported missing D3D12 debug-layer support, one reported tiled tier below 2, and one reported no heap windows.

Not tested

Matched main baseline, retail-title smoke run, other adapters, and sample-backed paths gated by unset XCL_SAMPLE_* variables.

AI use

T3 Code / Codex (gpt-6.2-sol, reasoningEffort: high) ran the build and verification. Coordinator #2 (T3 Code / Antigravity, gemini-4-neon) verified counts against pr1664-suite.log and published.

<!-- greyfinch-sync:ivall/xcl:comment:7153122156 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1664#issuecomment-7153122156). Originally posted by [JJAutoCompare](https://github.com/JJAutoCompare) on 2026-11-25T04:44:33Z. --- # XCL PR #1664 — Windows / Intel Arc A770 verification Tested clean, detached head `48702fb268a74de9528a833a6c57d4159ec94e8e` on STOR-WINLAB. Intel Arc A770 (driver 32.0.101.9175), AMD Ryzen 7 3800X, Windows 11 Enterprise Evaluation build 26200. DXC 1.9.2609.5, verified with `dxc.exe --version`. Rust 1.100.0 (0ef1bc386, x86_64-pc-windows-msvc). Cargo dev/test profiles were unoptimized with debug info and incremental compilation disabled. **Tested** - `cargo build --workspace` passed. `cargo test --workspace --no-run` compiled 20 test binaries. Both ran outside the Arc mutex. - `cargo test -p xcl --test gpu_adapter` with `XCL_ADAPTER=NONE_CPU_ONLY` ran outside the mutex. 10 passed, 0 failed, 0 ignored, 0 skipped. The only changed file, `crates/xcl/tests/gpu_adapter.rs`, covers auto/WARP and name normalization, positional indices, leading-zero and overflow name fallback, nonblank environment override and unset/blank configuration fallback, direct index and name matching, and display formatting. These tests use no DXGI calls. - `cargo test --workspace --no-fail-fast -- --test-threads=4` ran once inside `Invoke-ArcTest.ps1` with `XCL_ADAPTER=A770` and `RUST_TEST_NOCAPTURE=1`. Exit 101. All 21 result lines (20 binaries and one doc-test run) sum to 850 passed, 18 failed, and 42 ignored. All 10 selector tests passed again. **Workspace failures and skips** - 17 library failures. Compute pipeline creation returned 0x80070057 in 13 tests. Four others reported mismatches in FMA, mip sampling, packed f16, and pixel-shader wave64 reductions. - One end-to-end failure. `test_title_runs_and_game_folder_is_untouched` reported blue where the `RSSetDepthBiasX` check expected green. - Six exact `SKIPPED ` markers already appear in the harness pass tally and provide no coverage. Two reported no wave64, two reported missing D3D12 debug-layer support, one reported tiled tier below 2, and one reported no heap windows. **Not tested** Matched main baseline, retail-title smoke run, other adapters, and sample-backed paths gated by unset `XCL_SAMPLE_*` variables. **AI use** T3 Code / Codex (gpt-6.2-sol, reasoningEffort: high) ran the build and verification. Coordinator #2 (T3 Code / Antigravity, gemini-4-neon) verified counts against `pr1664-suite.log` and published.
github-actions[bot] commented 2026-11-28 20:17:51 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by github-actions[bot] on 2026-11-28T20:17:51Z.


Nothing has happened on this PR for 3 days, so it is marked stale and will be closed in 4 days. A push or a comment takes the mark off: rebase it onto main if it conflicts, and say in one line what it still fixes. If it only waits for a maintainer, a comment saying so is enough.

<!-- greyfinch-sync:ivall/xcl:comment:7245182592 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1664#issuecomment-7245182592). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-11-28T20:17:51Z. --- Nothing has happened on this PR for 3 days, so it is marked `stale` and will be closed in 4 days. A push or a comment takes the mark off: rebase it onto `main` if it conflicts, and say in one line what it still fixes. If it only waits for a maintainer, a comment saying so is enough.
amazedturnip commented 2026-11-28 20:36:43 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by amazedturnip on 2026-11-28T20:36:43Z.


Still merges cleanly onto main (765b2c5b) with passing checks; pins GPU adapter selector parsing, fallback, and XCL_ADAPTER env override contracts — waiting on maintainer / post-goal review.

<!-- greyfinch-sync:ivall/xcl:comment:7245412745 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1664#issuecomment-7245412745). Originally posted by [amazedturnip](https://github.com/amazedturnip) on 2026-11-28T20:36:43Z. --- Still merges cleanly onto main (765b2c5b) with passing checks; pins GPU adapter selector parsing, fallback, and XCL_ADAPTER env override contracts — waiting on maintainer / post-goal review.
Foniass commented 2026-12-01 06:26:39 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Foniass on 2026-12-01T06:26:39Z.


Triage (#1607) – head 48702fb

No open or merged PR adds the same tests. Part of the parse/allows coverage repeats main's inline selector_parsing and selector_matching in src/gpu/adapter_tests.rs. The new cases are from_env_or with XCL_ADAPTER set, unset and blank, the Display output, and the overflow and leading-zero name cases.
The expectations match Selector::parse/allows/from_env_or on main. XCL_ADAPTER is changed only under a lock, and a guard restores it.
The title mentions the fallback, but this file does not test the out-of-range numeric fallback (select_indices); that is still covered only by the inline test.
Recommendation: keep open.

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

<!-- greyfinch-sync:ivall/xcl:comment:7302877915 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1664#issuecomment-7302877915). Originally posted by [Foniass](https://github.com/Foniass) on 2026-12-01T06:26:39Z. --- **Triage (#1607)** – head 48702fb No open or merged PR adds the same tests. Part of the parse/allows coverage repeats main's inline `selector_parsing` and `selector_matching` in src/gpu/adapter_tests.rs. The new cases are `from_env_or` with XCL_ADAPTER set, unset and blank, the `Display` output, and the overflow and leading-zero name cases. The expectations match Selector::parse/allows/from_env_or on main. XCL_ADAPTER is changed only under a lock, and a guard restores it. The title mentions the fallback, but this file does not test the out-of-range numeric fallback (`select_indices`); that is still covered only by the inline test. Recommendation: keep open. AI review: Claude Code (Claude Opus 5.5), diffs read only, not built or run; not checked by a human.
This pull request cannot be merged automatically due to conflicts.
Merge manually to resolve the conflicts.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin 'upstream-pr/1664:upstream-pr/1664'
git switch 'upstream-pr/1664'

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch 'main'
git merge --no-ff 'upstream-pr/1664'
git switch 'upstream-pr/1664'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/1664'
git switch 'upstream-pr/1664'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/1664'
git switch 'main'
git merge --squash 'upstream-pr/1664'
git switch 'main'
git merge --ff-only 'upstream-pr/1664'
git switch 'main'
git merge 'upstream-pr/1664'
git push origin 'main'
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
xcl-dev/xcl!1654
No description provided.