tests: honor hardware adapter selection in native Compute replay #3155

Merged
RonLogic merged 2 commits from upstream-pr/3155 into main 2026-11-27 20:36:31 +00:00
RonLogic commented 2026-11-27 18:59:44 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by RonLogic on 2026-11-27T18:59:44Z.


Change

Refs #3052 and its adapter-selection report. native_store_replay created the default D3D12 device even when the caller requested a specific adapter via XBOX2WINDOWS_ADAPTER. With the old runner, XBOX2WINDOWS_ADAPTER='no adapter has this name' still ran both packed-U8 cases and matched all 2,064 words in each case.

Use the shared hardware selector for explicit filters and retain the default-device path when the variable is unset. An unmatched or overlong filter exits with code 2 before a shader runs. Report name, vendor/device IDs, driver version where available, and the LUID of the actual D3D12 device on stderr. Binding rows remain on stdout.

Verification

Tested 1330c2530d16d5527606b3cb9bf93b85d36b0396 based on 88cddb0919fd4044ff45211c0919c3aefda73c35. Windows 11 26300.10075, Visual Studio 2026 18.12.1, Windows SDK 10.0.26100.0, RTX 4070 driver 32.0.16.2124, and WARP for the sampled Pixel regression. Native compute replay used its normal configuration without the debug layer.

$env:XBOX2WINDOWS_ADAPTER = 'rtx 4070'
$tests = '^native_(store_replay_adapter_controls|cvt_pk_u8_(controls|hardware)|sdwa_f16_(ir|hardware)|scalar_lds_hardware|adjacent_srv_hardware|indexed_atomic_hardware|mtbuf_hardware|sampled_pixel_(warp|hardware))$'
foreach ($preset in 'dev', 'release') {
    cmake --build --preset $preset --target native_store_replay compile_dxil native_compute_ir_dump native_sampled_pixel_gpu
    ctest --preset $preset --no-tests=error -j 1 -R $tests -V
}
Remove-Item Env:XBOX2WINDOWS_ADAPTER
ctest --preset release --no-tests=error -j 1 -R '^native_cvt_pk_u8_hardware$' -V
  • Debug 11/11 and Release 11/11, with no skips. The unmatched and overlong controls exited with code 2, produced no binding rows and created no readback. The old runner failed the new control.
  • The explicit and default paths both reported the RTX 4070 with the same LUID. The default-path repeat matched both 2,064-word packed-U8 readbacks.
  • The sampled Pixel tests passed on RTX 4070 and WARP. Documentation link and bidi checks passed.

Evidence and follow-up

The tests use source-built shaders and synthetic adapter filters. The experiment note gives the output contract and reproduction. Selection between multiple physical GPUs was not available on this test machine.

I used Codex to prepare the change and ran verification locally.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:issue:5531731100 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/3155). Originally posted by [RonLogic](https://github.com/RonLogic) on 2026-11-27T18:59:44Z. --- ## Change Refs #3052 and its [adapter-selection report](https://github.com/R0Y00/Xbox2Windows/issues/3052#issuecomment-7224882175). `native_store_replay` created the default D3D12 device even when the caller requested a specific adapter via `XBOX2WINDOWS_ADAPTER`. With the old runner, `XBOX2WINDOWS_ADAPTER='no adapter has this name'` still ran both packed-U8 cases and matched all 2,064 words in each case. Use the shared hardware selector for explicit filters and retain the default-device path when the variable is unset. An unmatched or overlong filter exits with code 2 before a shader runs. Report name, vendor/device IDs, driver version where available, and the LUID of the actual D3D12 device on stderr. Binding rows remain on stdout. ## Verification Tested `1330c2530d16d5527606b3cb9bf93b85d36b0396` based on `88cddb0919fd4044ff45211c0919c3aefda73c35`. Windows 11 `26300.10075`, Visual Studio 2026 18.12.1, Windows SDK 10.0.26100.0, RTX 4070 driver `32.0.16.2124`, and WARP for the sampled Pixel regression. Native compute replay used its normal configuration without the debug layer. ```powershell $env:XBOX2WINDOWS_ADAPTER = 'rtx 4070' $tests = '^native_(store_replay_adapter_controls|cvt_pk_u8_(controls|hardware)|sdwa_f16_(ir|hardware)|scalar_lds_hardware|adjacent_srv_hardware|indexed_atomic_hardware|mtbuf_hardware|sampled_pixel_(warp|hardware))$' foreach ($preset in 'dev', 'release') { cmake --build --preset $preset --target native_store_replay compile_dxil native_compute_ir_dump native_sampled_pixel_gpu ctest --preset $preset --no-tests=error -j 1 -R $tests -V } Remove-Item Env:XBOX2WINDOWS_ADAPTER ctest --preset release --no-tests=error -j 1 -R '^native_cvt_pk_u8_hardware$' -V ``` - **Debug 11/11 and Release 11/11**, with no skips. The unmatched and overlong controls exited with code 2, produced no binding rows and created no readback. The old runner failed the new control. - The explicit and default paths both reported the RTX 4070 with the same LUID. The default-path repeat matched both 2,064-word packed-U8 readbacks. - The sampled Pixel tests passed on RTX 4070 and WARP. Documentation link and bidi checks passed. ## Evidence and follow-up The tests use source-built shaders and synthetic adapter filters. The [experiment note](docs/experiments/native-replay-adapter.md) gives the output contract and reproduction. Selection between multiple physical GPUs was not available on this test machine. I used Codex to prepare the change and ran verification locally.
tedin7 commented 2026-11-27 20:36:19 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-27T20:36:19Z.

Review: COMMENTED


Review of d78b3871f2 (updated with main). Comment only.

native_store_replay now goes through the shared create_device selector when XBOX2WINDOWS_ADAPTER is set, returns 2 with a diagnostic when no adapter matches (instead of silently using the default device), keeps the old default-device path and its exit 77 when the variable is unset, and prints the adapter it actually used. xmem_test_device.h only gains a diagnostics stream parameter that defaults to stdout, so its existing callers print the same as before. The new native_store_replay_adapter_controls test checks both refusals (unmatched and over-long filter) and that nothing is written, and it runs without a GPU.

tests/native_store_replay.cpp is also changed on the cpp-migration branch; this merges cleanly there, and the native sweep on that merge is in the comment below.

Windows results are in the comment below.

Commands: git diff origin/main...pull/3155/head (read), git merge-tree --write-tree origin/cpp-migration pull/3155/head, plus the Windows commands listed in the comment.

AI-assisted; commands listed were executed locally.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:review:6093127312 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/3155#pullrequestreview-6093127312). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-27T20:36:19Z. **Review:** COMMENTED --- Review of d78b3871f23b862ee3bb79616131d917253d583e (updated with main). Comment only. `native_store_replay` now goes through the shared `create_device` selector when `XBOX2WINDOWS_ADAPTER` is set, returns 2 with a diagnostic when no adapter matches (instead of silently using the default device), keeps the old default-device path and its exit 77 when the variable is unset, and prints the adapter it actually used. `xmem_test_device.h` only gains a `diagnostics` stream parameter that defaults to `stdout`, so its existing callers print the same as before. The new `native_store_replay_adapter_controls` test checks both refusals (unmatched and over-long filter) and that nothing is written, and it runs without a GPU. `tests/native_store_replay.cpp` is also changed on the `cpp-migration` branch; this merges cleanly there, and the native sweep on that merge is in the comment below. Windows results are in the comment below. Commands: `git diff origin/main...pull/3155/head` (read), `git merge-tree --write-tree origin/cpp-migration pull/3155/head`, plus the Windows commands listed in the comment. AI-assisted; commands listed were executed locally.
tedin7 commented 2026-11-27 20:36:20 +00:00 (Migrated from github.com)

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


Windows Server 2025 verification of d78b3871f23b862ee3bb79616131d917253d583e (D3D12 WARP, MSVC 14.44.35207):

  • dev: cmake --build --preset dev --target compile_dxil native_store_replay plus the 15 device-check targets that include tests/xmem_test_device.h; ctest --preset dev -R <native sweep>|^(linear_buffer_backing|startup_committed|startup_null_views|startup_plane_size|startup_small_texture_4k|startup_title_heap|startup_view_heap|unified_buffer_paths|vm_copy_queue|vm_translation|xmem_|cpu_placed_dxr): 100% tests passed out of 283 (221 passed, 62 hardware or capability skips), including native_store_replay_adapter_controls
  • release: same targets and regex with --preset release: 100% tests passed out of 283 (221 passed, 62 skipped)
  • The native sweep on this head merged with cpp-migration (a0f67731), dev and release: 100% tests passed out of 134 in both presets

<native sweep> = every native_* test except native_startup_request_cache_hardware, which fails on WARP-only hosts with or without this PR.

AI-assisted; commands listed were executed locally.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7227666560 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/3155#issuecomment-7227666560). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-27T20:36:20Z. --- Windows Server 2025 verification of `d78b3871f23b862ee3bb79616131d917253d583e` (D3D12 WARP, MSVC 14.44.35207): - dev: `cmake --build --preset dev --target compile_dxil native_store_replay` plus the 15 device-check targets that include `tests/xmem_test_device.h`; `ctest --preset dev -R <native sweep>|^(linear_buffer_backing|startup_committed|startup_null_views|startup_plane_size|startup_small_texture_4k|startup_title_heap|startup_view_heap|unified_buffer_paths|vm_copy_queue|vm_translation|xmem_|cpu_placed_dxr)`: 100% tests passed out of 283 (221 passed, 62 hardware or capability skips), including `native_store_replay_adapter_controls` - release: same targets and regex with `--preset release`: 100% tests passed out of 283 (221 passed, 62 skipped) - The native sweep on this head merged with `cpp-migration` (`a0f67731`), dev and release: 100% tests passed out of 134 in both presets `<native sweep>` = every `native_*` test except `native_startup_request_cache_hardware`, which fails on WARP-only hosts with or without this PR. AI-assisted; commands listed were executed locally.
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!3155
No description provided.