Repository navigation
GPU: ask for an empty pipeline library with a null blob - #347
AugustoZFJ wants to merge 1 commit into
Conversation
e479df5 to
c2a98e8
Compare
An empty slice still has an address, and vkd3d-proton answers E_INVALIDARG to a non-null blob of length 0, so under Wine no pipeline library was ever created and host pipelines were not kept.
c2a98e8 to
197c7ac
Compare
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Tested PR #347 at head
Behavior covered: Runs GPU library unit tests against the null-blob pipeline-library initialization change. |
mercuryVM
left a comment
There was a problem hiding this comment.
Tested 197c7ac on Windows 11, RTX 5070, MSVC: cargo test --workspace --no-fail-fast passes (264 passed, 0 failed). Not tested under vkd3d-proton.
- The root cause is right.
&[]has a dangling non-null pointer, and the D3D12 contract (and vkd3d-proton's check) treats non-null with length 0 as invalid, while null with 0 means "empty library". Native D3D12 accepts both, which is why this only showed up under vkd3d-proton. - The raw vtable call is sound.
CreatePipelineLibrary(null, 0, &IID_ID3D12PipelineLibrary, &mut raw)matches the signature, a nullrawafter success becomesE_POINTER, andfrom_raw+casttoID3D12PipelineLibrary1releases the base reference when it drops. - The non-empty-blob path is untouched.
No issues found.
AI-assisted (Claude Code).
…y with a null blob Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Tested under vkd3d-proton, which fills the gap in @mercuryVM's review. Thanks @AugustoZFJ, the null-blob fix works there too. Setup: Radeon 8060S (Strix Halo, RADV GFX1151, Mesa 25.2.8), Ubuntu 24.04, Wine 11.22 + vkd3d-proton 3.1 (
The test reaches the device here (main fails on it rather than returning early), so the pass means vkd3d-proton now hands back an empty library for the null blob. Everything else in the crate behaves the same on both. The only other failure is AI-assisted test. The runs were done on this machine. |
|
Independent NVIDIA/vkd3d-proton validation on Environment: Linux x86_64, Rust 1.98.1, Windows MSVC cross-build (
Not checked here: native Windows, persistent-cache round trips, or gameplay with this patch. This is synthetic GPU-test validation, not an end-to-end gameplay result. AI-assisted testing with Codex. |
…Marvisak#358 Marvisak#89 Marvisak#331 Marvisak#86 Marvisak#83 Marvisak#211 Marvisak#260 Marvisak#275) Conflict in crates/victory-gpu/src/descriptor/host.rs: gpu-state (Marvisak#251) moved the dynamic-slot search into free_table(); gpu-draw (Marvisak#86) bounds the search by the heap's spare slots instead of DYNAMIC. free_table() works over taken.len(), which is the spare count, so the helper is kept with gpu-draw's spare-based cursor wrap. Both sides' tests kept. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Tested this PR ( Unit Tests (Windows
|
The tester tree (upstream main ffe310e plus its PRs, update 8; see its INTEGRATION.md) ran 11-25 minutes in the world on an RTX 5070 without a device removal. Where both sides carry the same PR (the wave64 stack #223/#233/#320 with #439 and #180, #454, #336, #259, #331 and others), the tester tree's newer head is taken; our own work and the PRs only we merged are kept. Conflicts, file by file: - descriptor/host.rs: the tester layout (`spare`, the guard slot after the dynamic slots, `free_table`, the capped sampler heap). A capped view heap keeps `capped_reserve()` dynamic slots, now 2^18 by default (the tester measurement, and our 91fed158), still `VICTORY_DYNAMIC_SLOTS` in diagnostics builds; uncapped hosts keep our 2^19. Our slot statistics (TAKEN/PEAK/SHORT), the bindless plan cache (`CommittedRegions`, `timed_valid_title_address`, `timed_find`, `title_bounds`) and the revision triple are kept beside the tester's `guard_slot`. - Buffer states: the tester tree's buffer-state tracker (#334: every list moves host copies of title memory between GENERIC_READ and UNORDERED_ACCESS and back to common before it closes) and depth twins (#469) are taken. #40's enhanced/legacy indirect barriers (the indirect prelude, `use_indirect_buffers`, the title buffer handoff mirrored in `host_barrier`) cannot share buffers with that tracker and are dropped; #40's argument checks (`byte_len`, exact spans, overflow-safe clamp shader, aligned counts) stay. `indirect::bound` and #282's `rectangles` go through `buffer_state`, and `indirect::execute` (#334) replaces `done`. #178's DXC fallback compiles both of our passes. Our segments (#387: `close` ends the segment, `close_native` closes a native list) carry the tracker: each native list returns its buffers to common and its twins to their depth targets, and each prelude also holds our texture uploads. - shadow.rs: our write flow (`queue_write`, one `snapshot` after the batch's refreshes, `finish_writes`, the unchanged-page cache) with #261's copy-back that also gives the snapshot the title's bytes; its tests run through our flow. - pipeline/make.rs: #275's per-frame budget and per-pipeline wake pair, with our compute waits (a dispatch waits for its pipeline, up to 20 s). - pipeline/library.rs: the tester version (#347, #275's saver thread); our concurrent-write test kept. shader_cache.rs: our byte-returning cache API with #358's "translated, only not kept". - draw.rs: #493's root SRV tables; where no table can stand in, our drop of a draw whose root view is unset or outside title buffers. Our refusal of a table offset past the capped heap stays. - resource.rs: `HostTexture` has both our `staged` generation and the depth twin. - Shaders: the tester's lower.rs for the wave64 stack, #160's image sampling (it covers our #73 and #136 sample forms) and #453/#587; kept from our side: #136's preference for an image or buffer use of a descriptor read as data and its `s_buffer_` arm, #422's nearest-even narrowing (also for #169's d16 loads and #453's interpolation), #452's spin-wait limit, #391's LDS limit, #302's spilled root arguments (now in `NativeProgram::translation_ir`), #136's PSV0 interpolation beside the tester's row harmonisation. split_tests.rs, lane_read_loop_tests.rs and docs/wave64-on-wave32.md are the tester versions (the same PRs at newer heads). - Tests: #483's heap guard dwords filled in our GPU tests of #200 (v_div_scale) and #437 (scalar loads from a raw view), which read through the guard slot otherwise; #334's debug-layer test passes an offset to our `indirect::bound`. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ied together Merges Marvisak#72 Marvisak#347 Marvisak#1000 Marvisak#358 Marvisak#352 Marvisak#626 Marvisak#1152 Marvisak#1129 Marvisak#1203 Marvisak#24 Marvisak#642 Marvisak#427 Marvisak#485 Marvisak#550 Marvisak#174 Marvisak#1279 onto main (ffe310e), each head unchanged, no conflicts. One change of mine: three of the PRs each add a `mod tests` at the end of pipeline/host.rs, so the merge defines `tests` three times (E0428). The second and third are named `library_tests` and `blend_tests`; nothing else changes. cargo clippy --workspace --all-targets --locked -- -D warnings, with and without --all-features, is clean and cargo test --workspace --locked passes (367 passed, 6 ignored; main has 342 passed, 6 ignored). Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
|
Automated triage for the maintainers. Needs rebase. This PR does not merge cleanly into current The content has not been reviewed yet; it will be once the branch is rebased onto Generated by Claude Code |
…so caching works on Wine/vkd3d-proton (gmankab, based on Marvisak/VIctory#347) An empty slice still has an address, and vkd3d-proton answers E_INVALIDARG to a non-null blob of length 0, so under Wine no pipeline library was ever created and host pipelines were not kept. Co-authored-by: AugustoZFJ <14866271+AugustoZFJ@users.noreply.github.com>
…so caching works on Wine/vkd3d-proton (gmankab, based on Marvisak/VIctory#347) An empty slice still has an address, and vkd3d-proton answers E_INVALIDARG to a non-null blob of length 0, so under Wine no pipeline library was ever created and host pipelines were not kept. Co-authored-by: AugustoZFJ <14866271+AugustoZFJ@users.noreply.github.com>
Summary
Under vkd3d-proton,
pipeline::library::open()never gets a pipeline library, solibrary()logs "no host pipeline library: pipelines are not kept" and nothing is cached between runs.When there is no saved blob, or the saved one is rejected,
open()asks for an empty library with an empty slice. An empty Rust slice still has a non-null address (0x1here). vkd3d-proton rejects a non-null blob of length 0 and accepts null.In outline, not the literal diff:
Only the empty request changes. It goes through the raw vtable, because the
windowswrapper takes a slice and a slice can't be null. Loading a saved blob still uses the wrapper. If the host refuses even the empty library, the error is now logged instead of dropped. Onlycrates/victory-gpu/src/pipeline/library.rschanges.Evidence
Everything below ran on GE-Proton11-14 (its vkd3d-proton is v3.1-83) with an RX 6900 XT on RADV 26.2.6, built with
cargo xwinforx86_64-pc-windows-msvc. No game files were used.What
CreatePipelineLibraryreturns there, from a throwaway test that isn't in this PR:S_OK0x1, 0E_INVALIDARG(0x80070057)D3D12_ERROR_DRIVER_VERSION_MISMATCH(0x887E0002)pipeline::library::tests::a_rejected_blob_gives_an_empty_librarypanics at.expect("an empty library").victory-gpu: 40 passed, 3 failed.After: with this change it passes.
victory-gpu: 41 passed, 2 failed. The two that remain,argument_clamp_builds(Wine/vkd3d: indirect execution is dropped because the argument clamp cannot be compiled there; rewriting its HLSL does not help #170) andbuffer_data_reaches_the_host_texture(Wine/vkd3d: deferred uploads are skipped because VirtualQuery() reports mapped memory as MEM_FREE #128), fail the same way before the change.The same throwaway test also ran one round trip with a trivial compute pipeline.
StorePipelineandSerializesucceed (200 bytes), a second library opens from those bytes,LoadComputePipelinereturns the stored pipeline, and an unknown name givesE_INVALIDARG. So the cache works for one pipeline. I haven't run the title with it.Not checked: Windows, because I have no Windows machine. Only the empty request differs there, null instead of
0x1. Microsoft's page forCreatePipelineLibrarysays an empty blob gives an empty library and doesn't say what the pointer should be, so this needs one run of that test on Windows.Merge Danger
Door: two-way
For the code, a revert is enough. A
host-pipelines.binwritten under vkd3d-proton in the meantime stays in thepipelinescache folder and the reverted code would still load it, so undoing it fully also means deleting that folder.Blast Radius: pipeline-cache
On Windows the empty-library request passes null instead of a dangling pointer. That is untested.
Under vkd3d-proton the whole cache switches on for the first time.
LoadGraphicsPipeline,LoadComputePipelineandLoadPipelineare tried before every pipeline is made, and new ones are stored.save()serialises under the library lock, at most every 20 seconds, and writeshost-pipelines.binandearly-pipelines.txt. On the next run the saved blob is reopened and the pipelines listed inearly-pipelines.txtare started early. Of all that, only the one-pipeline round trip above has been exercised.