Repository navigation
shader: opt the test binaries into an app-local Agility SDK runtime - #486
naixue2233 wants to merge 3 commits into
Conversation
|
Verified The Agility SDK path itself is not exercised here: To validate the intended effect, copy NuGet |
|
Thanks — the Wine run is worth more than my Windows check here, because it verifies the part I most wanted to keep: no DLL, Good catch on 1.620.2. I pushed The reason it matters is the one I put in the body: with 610 in the code and a 620 DLL on disk the loader silently falls back to the in-box runtime. No error, no warning — you just see the same seven failures and assume the patch did nothing. I only found it because I had cached a mismatched pair while testing. Which raises a design question I would like your view on: should the constant be derived rather than typed? On that: #463 uses 614. If both land, one of them has to bend, and I would rather it be mine. |
|
Tested
All seven So the opt-in also works on pre-RDNA AMD hardware: Polaris on the Adrenalin driver reports SM 6.6 through the Agility runtime. Note: AI-assisted (setup and write-up); the test runs above are real runs on my machine. |
|
Tested on Windows 10 + Pascal (GTX 1060 6GB): 76 passed / 13 failed → 89 passed / 0 failed. Setup: Windows 10 Education 22H2 (19045), NVIDIA GeForce GTX 1060 6GB (Pascal), driver 582.66 (32.0.15.8266), i7-10700K, Rust 1.98.1, Runtime:
Notes:
AI-assisted (Claude Code); the results are real runs on my machine. |
mercuryVM
left a comment
There was a problem hiding this comment.
Tested 6179b10 on Windows 11, RTX 5070, MSVC: the workspace passes (195 outside victory-shader; victory-shader --lib with --test-threads=1: 69 passed). This machine has no target/<profile>/D3D12/D3D12Core.dll, so the opt-in stays off here, as designed. Windows 11's in-box runtime already reports SM 6.6. I couldn't test the Windows 10 path.
I read build.rs by hand first, since it runs at build time. It only copies a file already inside target/ and adds two /EXPORT linker args. Nothing is downloaded or executed.
- Gating the exports on the DLL being present is important: with the exports but no DLL, the loader refuses to create any device (
0x887e0003), as the module doc says. A checkout without the runtime is therefore unchanged. #[cfg(test)]on the module keeps the symbols out of the library, soapps/victory(#463) can define its own copy without duplicate symbols.- Caveat:
rustc-link-argapplies to every binary this package links, so the exports land in every test binary of the crate, which is the intent. Writing intotarget/<profile>/deps/D3D12/from a build script is outsideOUT_DIR, which cargo tolerates but doesn't track: acargo clean -p victory-shaderwon't remove it. That's worth a line in the doc. D3D12SDKVersion = 620must match the DLL someone places there. A different package version fails device creation with a clear HRESULT rather than silently.
AI-assisted (Claude Code).
… app-local Agility SDK runtime Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
catminou4
left a comment
There was a problem hiding this comment.
Nice approach for the Agility SDK opt-in — exporting D3D12SDKVersion/D3D12SDKPath from test binaries so d3d12.dll picks up an app-local D3D12Core.dll instead of the in-box one (Win10 caps at SM 6.6-less 6.5).
What I verified:
- The two symbols are actually defined (
agility.rs,#[cfg(test)]+#[no_mangle]), so the/EXPORT:...,DATAlink args resolve. Gating tocfg(test)correctly avoids the duplicate-symbol clash with the app's own copy, as the comment notes. D3D12SDKPathas&[u8; 9]= pointer to".\D3D12\"matches what the loader expects (it dereferences the symbol to get the path).build.rsearly-returns on non-Windows, so macOS/Linux builds are unaffected; theOUT_DIRancestor math (nth(3)→ profile dir) is correct fortarget/<profile>/build/<pkg>-<hash>/out.- Test-merge with current main (
ffe310e) clean;cargo test -p victory-shader --locked(macOS arm64, rustc 1.98.1) → 96 passed / 0 failed (the new module compiles in test config).
What I could NOT verify on macOS (Windows-only behavior):
- Whether
/EXPORT:D3D12SDKVersion,DATAviacargo:rustc-link-argfrom a library build script actually lands on the final test-binary link (build-script link args apply to the package's own bin/test/example targets — test binaries of victory-shader qualify, but the app's own tests would need the same treatment or the symbols fromapps/victory). - The
D3D12SDKVersion = 620value against the actual Agility SDK package header. - The DLL mirroring:
rerun-if-changedon a possibly-nonexistent DLL, and whether.\D3D12\resolves relative to the test exe (deps/) as the comment assumes.
Suggest a Windows run of the SM 6.6 shader tests with an app-local D3D12Core.dll to confirm before merge — the parts I can check are sound.
|
I tested
|
A write-watched texture was read and detiled whole whenever any of its pages was written, without the hash check the unwatched path has: the title writes next to its textures and rewrites what it wrote, so the world frame detiled gigabytes of unchanged texels. And every list that sampled a title texture recorded the copy of its whole staging buffer into the host texture, unchanged or not, in every submission. The watched path now hashes what it read and detiles only if the hash changed (as xcl #486 does). Each detiling bumps the staging buffer's generation; the host texture notes the generation it was copied from. The copy moves from the list into the list's submission-time prelude, after the list's refreshes, and is recorded only when the host texture lacks the current generation: real state -> copy destination, copies, then the state the list starts with. Unchanged textures are copied once. Diagnostics log "texture uploads per frame: N copied X MB, N skipped unchanged X MB" with the copy counters line. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…gility SDK runtime
…gility SDK runtime
|
Independent hardware verification on an AMD RDNA3 card, Windows 10 (not WARP): this branch gets the shader suite its SM 6.6 device.
No test needed |
|
Independent check of Environment: Windows 10 22H2 (10.0.19045), Rust 1.98.1 MSVC host, 1. With no runtime staged, 2. With the runtime staged, the same command fails: The So the mechanism is right and the bench is the one target that breaks — and it breaks exactly where the runtime is staged, which is the setup the PR's own instructions ask for. Minimal fix, if useful: have the bench reference the static, e.g. in // The Agility opt-in exports these; a bench links the archive member only if
// something in it refers to them.
#[allow(clippy::no_effect_underscore_binding)]
let _ = &victory_shader::agility::D3D12SDKVersion;That keeps the link-arg form for every target, gives the bench the SM 6.6 runtime instead of the in-box one, and needs no One documentation point: the missing AI-assisted (DeepSeek V4.1), no game data. |
…gility SDK runtime
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
…gility SDK runtime
What this does
The same opt-in as #463, for the test binaries. #463 covers
apps/victory, sovictory.exegets shader model 6.6 on Windows 10 — butcargo test -p victory-shaderstill runs against the in-box runtime, which reports 6.5, and the sevenemit::valu_testskeep panicking withneither hardware nor WARP SM 6.6 device available.With this branch on Windows 10 19045 + RTX 3080:
The seven now execute on the GPU:
v_med3with NaN operands,v_fractnear 1.0,v_sin/v_costurn reduction, signed and unsignedbfe.How
crates/victory-shader/build.rs:target/<profile>/D3D12/D3D12Core.dll;target/<profile>/deps/D3D12/, because the loader resolvesD3D12SDKPathnext to the running module and test binaries run fromdeps;D3D12SDKVersion/D3D12SDKPath;The symbols are exported with the linker's
/EXPORT:...,DATArather than a.deffile, because.defis not on the asset-policy allowlist.cargo xtask policyreports155 files okwith this branch.Relationship to #463
Disjoint files — this only adds
crates/victory-shader/{build.rs, src/agility.rs}and one module line inlib.rs, so the two can land in either order. Together they cover both binaries; #463 alone leaves the test suite red on Windows 10.If you would rather have one implementation, the two
agility.rsfiles are identical and could move to a shared build helper; I kept them separate to stay out of #463's diff.Two things that cost me time
D3D12SDKPathmust be exported as aconst char*. As a byte array the loader dereferences the first eight bytes and the process dies inDllMainwith0xC0000142, beforemainruns.D3D12SDKVersionmust match the shipped DLL exactly. With 610 in the code and 620 on disk the loader silently falls back to the in-box runtime — no error, and the tests fail again with the same message. The constant here is 610 to match the runtime I tested; GPU: load an app-local D3D12 Agility SDK runtime when present #463 uses 614. Someone should pin one, probably by deriving it from the package version.Also worth knowing: WARP stays below 6.6 even with the runtime present (
no SM 6.6 warp device; skipped), so the software-adapter half of these tests remains skipped. Only hardware coverage improves.Testing
Windows 10 Pro 22H2 (19045.0), RTX 3080 10 GB driver 32.0.16.1742, MSVC 14.44.35207, Windows SDK 10.0.26100.0, Rust 1.98.1,
Microsoft.Direct3D.D3D121.610.5. Based2a4bae.cargo test -p victory-shader --lib→ 69 passed, 0 failed (withtarget/debug/D3D12/D3D12Core.dllin place, 610).cargo xtask policy→155 files ok.