Skip to content

Tests: the GPU tests load the D3D12 Agility SDK, as victory.exe does - #2878

Open
lhnizdo wants to merge 4 commits into
Marvisak:mainfrom
lhnizdo:pr/tests-agility-sdk
Open

lhnizdo wants to merge 4 commits into
Marvisak:mainfrom
lhnizdo:pr/tests-agility-sdk

Conversation

@lhnizdo

@lhnizdo lhnizdo commented Nov 25, 2026

Copy link
Copy Markdown
Contributor

What this fixes

On Windows 10 the system's D3D12 runtime has no shader model 6.6, so every GPU test in victory-shader and victory-gpu skipped its hardware device ("no SM 6.6 hardware device; skipped"), and then failed its "at least one device ran" check where WARP has no 6.6 either (Windows 10's WARP stops at 6.2). #2460 makes victory.exe load the Agility SDK from .\D3D12\; the test binaries had no such exports.

Changes

  • The test binaries of victory-shader and victory-gpu export D3D12SDKVersion (620) and D3D12SDKPath, like victory.exe. A test binary sits in target\<profile>\deps\, so the path is ..\D3D12\: the runtime is looked for in target\<profile>\D3D12\, where D3D12Core.dll from the NuGet package is copied once (as for victory.exe in victory.exe: load the D3D12 Agility SDK from .\D3D12\ #2460). Without that folder nothing changes: Windows uses its own runtime.
    • The exports are MSVC linker directives in a .drectve section of a cfg(test) static, so only test binaries get them. cargo:rustc-link-arg-tests is refused in a package without a tests\ target, and rustc-link-arg would also reach the shader crate's benchmark, which doesn't define the values.
  • On NVIDIA the shader crate's test host makes structured buffer views raw, as victory-gpu's buffer_srv does with GPU: on NVIDIA, structured buffer views are made raw #2464, with the same VICTORY_RAW_STRUCTURED override. With the hardware device running, a_heap_buffer_read_by_element_takes_the_views_stride read the wrong records there: lane l got the first word of element 3l + 1.
    • The test host works this out from its device's adapter when it makes the view, so the shared WARP device, the hardware device and Host::from_device all get it.

Tested

RTX 2080 (32-lane waves), Windows 10 19045, driver 32.0.16.1742, main f3578e3 plus this PR, with target\debug\D3D12\ holding D3D12Core.dll 1.620.2:

  • Before: every GPU test skipped the hardware device ("no SM 6.6 hardware device; skipped"), then failed its "at least one device ran" check (all 6 stride_tests, for example).
  • cargo test -p victory-gpu --lib: 226 passed, 2 failed. The two are the NVIDIA view-heap cap pair (dynamic_slots_are_held_until_released, lists_share_a_table_and_copies_keep_their_views), which GPU and shaders: a host that caps its view heaps gets heaps at its ca… #2461 fixes.
  • cargo test -p victory-shader --lib: 300 passed, 2 failed:
  • With the raw views, a_heap_buffer_read_by_element_takes_the_views_stride passes on NVIDIA.
  • cargo clippy -p victory-shader -p victory-gpu --all-targets -- -D warnings is clean.

Still skipped here, as before: WARP (no 6.6 on Windows 10) and the tests that need the console's shader compiler.

AI-assisted (Claude Code); the runs were on my machine.

🤖 Generated with Claude Code

https://claude.ai/code/session_018sSQTfPXZpSkjMMNa7RB5G

lhnizdo and others added 2 commits November 25, 2026 23:43
On Windows 10 the system's D3D12 has no shader model 6.6, so every GPU
test skipped its hardware device (and failed where WARP has none
either). The test binaries of victory-shader and victory-gpu now export
D3D12SDKVersion and D3D12SDKPath like victory.exe, looking for the
runtime in target\<profile>\D3D12\ (one level up from deps\). Without
that folder nothing changes. The exports are linker directives in a
cfg(test) object, so only test binaries get them (the shader crate's
benchmark does not define the values).

RTX 2080, Windows 10 19045: 247 shader tests and 143 GPU tests pass
on the hardware device; before, they skipped it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018sSQTfPXZpSkjMMNa7RB5G
…aw, as victory-gpu does

The view of a structured buffer read raw read the wrong records on an
RTX 2080 (lane l got the first word of element 3l+1), the same NVIDIA
behaviour victory-gpu's buffer_srv works around. The test host now
makes those views raw too, by its adapter's vendor, with the same
VICTORY_RAW_STRUCTURED override.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018sSQTfPXZpSkjMMNa7RB5G
@fuzeofficlal

Copy link
Copy Markdown
Contributor

Tested 6fc5deff on Windows 11 (RTX 5090 + WARP) and hit a blocking regression when target\<profile>\D3D12\D3D12Core.dll is not present (default cargo test and CI):

1. Exporting D3D12SDKVersion/D3D12SDKPath fails with 0x887E0003 instead of falling back

  • The comment assumes Windows falls back to the inbox system D3D12 runtime when ..\D3D12\D3D12Core.dll is missing. In practice, once a test binary exports D3D12SDKVersion = 620 and D3D12SDKPath = "..\\D3D12\\", the D3D12 loader hard-fails both D3D12CreateDevice and D3D12SerializeVersionedRootSignature with 0x887E0003 (DXGI_ERROR_SDK_COMPONENT_MISSING / -2005008381).
  • Local Windows 11 results without a manually copied D3D12Core.dll:
    • victory-shader --lib stride_tests: 0/8 passed, 8/8 failed (neither hardware nor WARP SM 6.6 device available).
    • victory-gpu --lib root::tests: 4/4 host tests failed (host_serialized_blobs_create_root_signatures, our_blobs_deserialize_on_the_host, versioned_descriptions_serialize_on_the_host, malformed_blobs_are_rejected_by_the_host all returned -2005008381 = 0x887E0003 on both RTX 5090 and WARP), while all other GPU tests silently skipped via host() -> None.

2. Other issues

  • Bundled unrelated commit (6fc5deff): mixes an NVIDIA raw_structured SRV-only workaround in emit/host.rs that overlaps (and is less complete than) #2885.
  • Non-Windows & build hygiene: D3D12SDKVersion/D3D12SDKPath are gated only on #[cfg(test)] without #[cfg(target_os = "windows")], MSVC emits linker stdout .lib/.exp warnings, apps/victory/src/main.rs on main does not have these exports, and #[cfg(test)] does not apply to integration tests (tests/*.rs).

Suggest dropping 6fc5deff and gating Agility SDK test exports behind an explicit opt-in feature or build-script deployment that guarantees D3D12Core.dll is staged beside the test binary.

@kotekompotek kotekompotek left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Mechanically right: the .drectve export trick under cfg(test) puts the Agility SDK exports only in test binaries (mirroring victory-shader and victory.exe's own load path), and the ..\D3D12\ relative path matches where the NuGet runtime lands. This is what makes the SM 6.6-dependent GPU tests actually run on Win10 hosts. LGTM.

@fyernald fyernald left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Tested on an RTX 3080 (driver 617.42), Windows 10 19045, main 63bcca4 + this head (6fc5def), --test-threads=1, D3D12Core.dll 1.620.2 in target\debug\D3D12\.

With the runtime staged it does what it says. The .drectve exports reach the linker here.

cargo test -p victory-gpu --lib passed failed
main 226 5
main + #2878 229 2

The three it fixes:

  • compute_view_marks_rebind_after_depth_twin_conversion (#2155) and depth_bounds_control_a_title_draw (#158) are new on main today. On Windows 10's in-box runtime, they fail because it refuses the root signature flags 0xC00 (*_HEAP_DIRECTLY_INDEXED) with E_INVALIDARG.
  • a_texture_written_in_one_format_reads_in_another_through_a_placed_view fails because there is no ID3D12Device10 in the in-box runtime.

The two left are the NVIDIA heap-cap pair.

victory-shader (main + #2596 for #2571, the suite crashes here without it): 298 passed / 4 failed with #486 in place of this PR, 300 / 2 with this PR. The raw structured views fix a_heap_buffer_read_by_element_takes_the_views_stride, and also gathers_at_a_level_match_the_hardware, whose coordinates come from a Structured(16) view. Both fail with VICTORY_RAW_STRUCTURED=0 and pass with =1, deterministically.

Without the runtime it is worse than main, and that is what CI hits. Same build, folder renamed away:

  • The 4 root::tests fail with -2005008381 (0x887E0003), as on CI.
  • Every other hardware test returns early because host() is None, and counts as passed. The heap-cap pair that fails on main "passes" here (227 / 4). So on a machine without the folder, this turns off the GPU suite's hardware coverage silently, not just those four tests.

What worked here: decide at build time and export only when the runtime is staged, as #486's build.rs does (cfg(agility_runtime) only if target/<profile>/D3D12/D3D12Core.dll exists). I copied that build script into victory-gpu locally. With the DLL: 229 / 2. Without it: 226 / 5, the same five as main, with nothing skipped.

Also:

  • #486 and this PR can't both land. Merged together, victory-shader's test build fails with symbol `D3D12SDKPath` is already defined. One of the two should own the shader crate's opt-in.
  • In emit/host.rs, raw_structured went in between on_software_adapter's doc comment and its fn. That comment now documents raw_structured, and on_software_adapter has none.
  • The raw-view change overlaps #2885 and doesn't depend on the Agility part. Splitting it out would let each be judged on its own.

Marvisak commented Nov 26, 2026 •

Copy link
Copy Markdown
Owner

Automated triage for the maintainers.

Thanks. The NVIDIA change is reverted, and the exports now depend on cfg(agility_runtime), so the 0x887E0003 failure is gone and CI passes. Needs the maintainer's decision: this adds a new crates/victory-gpu/build.rs and changes crates/victory-shader/build.rs, and build scripts need the maintainer's approval. Two smaller points:

  • D3D12SDKVersion is fixed at 620. If someone stages a D3D12Core.dll from a different Agility release, the loader may still refuse to make a device. A note on which version to stage would help.
  • I believe Cargo treats a rerun-if-changed path that does not exist as always stale. If so, without a D3D12 folder (the default) both build scripts rerun on every build, and victory-shader's script hashes its sources each time. Please check this, and emit the line only when the folder exists if needed.

CI: passing.


Generated by Claude Code

lhnizdo and others added 2 commits November 26, 2026 07:03
…t of their own

Review of Marvisak#2878: the NVIDIA raw-structured change in the shader crate's
test host is a separate matter (and is to be checked against Marvisak#2885).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018sSQTfPXZpSkjMMNa7RB5G
Review of Marvisak#2878: exported without target\<profile>\D3D12\D3D12Core.dll,
the loader refused to make a device (0x887E0003) instead of using the
in-box runtime, which failed CI's root tests and quietly skipped every
other hardware test. build.rs now sets cfg(agility_runtime) only when the
runtime is there (as Marvisak#486 does for victory-shader), and the exports hang
off it. The comments no longer lean on code that is not in main.

RTX 2080, Windows 10 19045: with the runtime staged, victory-gpu 226
passed, 2 failed (the NVIDIA heap-cap pair, Marvisak#2461); without it, 224
passed, 4 failed, the same failures as main, and no 0x887E0003.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018sSQTfPXZpSkjMMNa7RB5G
@lhnizdo

lhnizdo commented Nov 26, 2026

Copy link
Copy Markdown
Contributor Author

Thanks @fyernald, and for the triage. You're right, and my description was wrong: exported without the runtime, the loader refuses to make a device instead of falling back. Changes, pushed as new commits (405d851, 5e63ca3):

  • The exports are opt-in at build time. Both crates' build.rs set cfg(agility_runtime) only when target/<profile>/D3D12/D3D12Core.dll exists, as shader: opt the test binaries into an app-local Agility SDK runtime #486 does for victory-shader, and the statics and the .drectve directive hang off it. The scripts watch the D3D12 folder rather than the missing file, so they don't rerun on every build.
  • The NVIDIA raw-structured change is reverted here. GPU, Shaders: view structured buffers raw on host for NVIDIA heap reads (FIND-11) #2885 covers it more completely: it also handles views that don't start on 16 bytes (with their own copies) and the table-bound path. So I've left it to that PR rather than opening a third one.
  • The comments no longer refer to code that isn't on main. The on_software_adapter doc-comment mix-up went with the revert.

On an RTX 2080, Windows 10 19045, cargo test -p victory-gpu --lib --test-threads=1:

passed failed 0x887E0003
runtime staged in target\debug\D3D12\ 226 2 0
folder removed 224 4 0

github-actions Bot added a commit to KevinPratap/VIctory that referenced this pull request Nov 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants