gpu: reject invalid adapter selectors in the wave startup fixture #3685
No reviewers
Labels
No labels
accessibility
awaiting author
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
priority: P0
question
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/R0Y00--Xbox2Windows!3685
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-3683"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
@timbot103 on GitHub · 2026-12-01 01:27 UTC · original
timbot103:gpu-wave-startup-invalid-selector→main· +81 −33 · 4 files · 1 commits · merged 2026-12-01 03:12 UTCWave startup now reports an unmatched or overlong
XBOX2WINDOWS_ADAPTERon stdout and exits 1. CTest previously treated both selections as capability skips. If device creation fails on every matching hardware adapter, the fixture prints the requested selector and exits 77.The fixture shares selector parsing and diagnostic text with
AdapterNameFilterand keeps its Win32 stdout writer. The newwave_startup_adapter_filtercheck lives intests/cmake/wave_startup_adapter_filter.cmakeand validates both input errors before device creation or shader dispatch.Refs #1161.
Verification
Run from the repository root in PowerShell. Set up the Python environment and load the developer shell.
Red on
a3bfd019Start at this PR’s revision so the Python check and CMake fragment are in place. The commands temporarily substitute only the base C++ fixture, then restore the original bytes.
Both presets listed
wave_startup_adapter_filter. Both invalid selectors returned 77 on the base. The check failed in each preset with CTest exit 8 because the overlong case expected exit 1.Green
Both invalid selectors returned 1 in Debug and Release. The unmatched selector printed
No D3D12 hardware adapter matches XBOX2WINDOWS_ADAPTER=x2w-no-such-hardware-adapter. The overlong selector printedXBOX2WINDOWS_ADAPTER is longer than 127 characters.In each preset, the Radeon and WARP matrix had seven passes and two skips. This includes passes for
wave_startup_adapter_filter,startup_indirect_dispatch_adapter_filter, andstartup_stream_adapter_filter. The RTX 5080 matrix had two passes and one skip. Radeon and RTX 5080 passed widths 0 and 32 with a 32-lane readback across 64 invocations, and skipped width 4 with exit 77 afterE_INVALIDARG. WARP passed widths 0 and 4 with a 4-lane readback, and skipped width 32 with exit 77 afterE_INVALIDARG.An earlier revision of this branch was also built (the six wave targets and two neighbors) in Debug and
/O2Release, and passed the neighboring adapter-filter tests in both presets. Both rounds ofdumpbin /dependentsshowed onlyKERNEL32.dll,d3d12.dllanddxgi.dllin all six Release wave binaries. The wave binaries link with/ENTRY:fixture_entry /NODEFAULTLIB.Mutation and device-creation failure
At
tests/wave_startup_exe.cpp:214, replaceif (!name_matched) return exit_fail;withif (!name_matched) return exit_skip;. Rebuild the same eight targets and rerun the locked matrix in both presets.Both mutants linked and both matrices returned CTest exit 8. Only
wave_startup_adapter_filterfailed because the unmatched selector returned 77. Restoring the line, rebuilding and repeating the locked matrix gave exit 0 in both presets.There is no existing fault-injection hook for the fixture’s direct
D3D12CreateDevicecall. A name match followed by device-creation failure remains a gap in automated coverage. On an earlier revision of this branch, replacingname_matched = true;with(void)name_matched;passed the conventional Release matrix. A manual control forced the hardware device-creation condition toif (SUCCEEDED(E_FAIL)) {, rebuiltwave_startup_0_hardware, and ran it withRadeon. It returned 77 with the old generic diagnostic. Also removing the assignment changed the result to exit 1 with the unmatched diagnostic.Repeating that manual Release control at
tests/wave_startup_exe.cpp:202returned 77 withNo D3D12-capable hardware adapter matches XBOX2WINDOWS_ADAPTER=Radeon. With the selector unset it returned 77 withNo D3D12-capable hardware adapter visible. The paired assignment mutant at line 201 returned 1 withNo D3D12 hardware adapter matches XBOX2WINDOWS_ADAPTER=Radeon. Both temporary edits were restored.The GPU-less hosted-runner path was reviewed in source and remains unverified on a hosted runner. The unmatched case handles empty or software-only enumeration through DXGI. The overlong case returns before enumeration.
Environment
0x887a002d). Both physical adapters created devices during the regular matrix.Prepared with AI assistance; all commands above were run locally.
@lukaslw-lab on GitHub · 2026-12-01 02:03 UTC · original · approved these changes
Reviewed
6b53cef2by reading the diff; not built or run.Verdict: approve. A bad selector now fails instead of skipping, and real skips (no hardware adapter, or device creation failing on every matching adapter) still return 77. No MUST, no SHOULD.
contains_ignoring_case(wave_startup_exe.cpp:111), whileAdapterNameFilter::matchesuses_wcsnicmp. For a description with non-ASCII letters, the same selector could match in one fixture and not the other. A comment saying the matching is deliberately ASCII here would keep the "shares selector parsing" claim exact.select_adapterreturnsexit_pass(0) only after setting*selectedand the device, soif (const int result = ...)inrun()is correct, and the early return releasesfactoryanddebug.name_matched, but the!*wantedbranch still prints "visible" and returns 77, as before.adapter_name_filter.hadds onlyconstexprarrays and two inline accessors. Itsfprintf/_wcsnicmpmembers are never used by the/NODEFAULTLIBfixture, so they are not emitted, which agrees with the reporteddumpbinimports.hardware_adapter_filter_check.pyare unchanged:startup_indirect_dispatch_adapter_filterpasses<exe> hardware count, whichREMAINDERkeeps whole, andstartup_stream_rasterizer_check.pyimportscheck()with the old defaults (exit 4, stderr).Tests:
wave_startup_adapter_filterproves both selector errors exit 1 with their stdout text on the hardware build, and the body's mutant (exit_fail→exit_skip) shows it catches the old skip. Match-then-create-failure remains manual only, as stated. CI built the targets but did not run the new test: it is not in theprpreset filter.