Repository navigation
Shaders: preserve raw scalar buffer loads on NVIDIA - #437
bodnjenie14 wants to merge 3 commits into
Conversation
|
Verified on an NVIDIA RTX 5070 (driver 621.24, the only adapter in the machine), Windows 11, rustc 1.98.1, debug, each head built in its own target directory:
Not covered: the title (no game data here) and other GPU vendors. |
|
Tested
No game data used. AI-assisted (Claude Code, Claude Opus 5.5). |
|
I tested the descriptor reconstruction on For comparison, independent DXC HLSL on the same 32-byte allocation returned |
|
Corpus run on the full retail shader pack (26,503 containers), Windows 11, AMD RX 9070 (Adrenalin), dxil.dll from SDK 10.0.26100. This PR conflicts with current main, so it was built at its own base (main before #612; there
So one of the modules this PR emits seems to crash the host pipeline path (the driver or our D3D12 calls) on AMD. My earlier #136 run did not create pipelines, so I cannot say yet whether the crash comes from #136 or from this PR. I have not isolated the module yet. |
catminou4
left a comment
There was a problem hiding this comment.
Test-merge with current main (ffe310e) conflicts — needs a rebase. Main moved recently (PR #566 waterfall loops touched lower.rs/resource.rs/valu_tests.rs), so shader PRs opened before it need rebasing. I'll re-review once it merges cleanly.
Merge upstream main, retain both shader regression tests, and pass absent PSV metadata in the three synthetic fixtures that construct lowering inputs directly. Refs: Marvisak#136, Marvisak#329, Marvisak#437
Marvisak#437 orders a container signature by row alone, keeping declaration order within a row (main ordered by row, then column). A vertex shader declaring two outputs of row 0 with the higher columns first validates with Marvisak#437's order; with main's, dxil.dll answers "Container part 'Program Output Signature' does not match expected for module", since the metadata keeps declaration order. The test keeps that from coming back. Also rustfmt of the shader host's adapter choice.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…tive depth centroid position
… phis, PSV0/ISG1 fixes, calculateLOD and image_gather4_l
A console buffer descriptor can carry a stride while its host view is raw. Lower the scalar loads with byte addressing so the DXIL matches that view. A synthetic GPU regression used to read zero at byte offset 20 and now reads the expected dword. Builds on Marvisak#136 by mpDom. Adapted from 0628716 in the local RTX bring-up branch.
598d221 to
7a29f52
Compare
|
Rebased onto |
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>
Two testers bisected #136 as making every frame black on RTX 5080 and 4080, loading screens included (upstream issue #71); the tester tree leaves it out. A plain revert of 5254cfa conflicts with #160, #437 and the tester merge, so each of #136's constructs is set to the tester tree's form: - s_load through a tracked descriptor: SRV only, as before #136 (no UAV raw reads); #437's byte offsets and its test stay. - A descriptor read as data: the first use found, not #136's preference for an image or vector buffer use; #136's s_buffer_ arm is gone. - PSV0 interpolation modes (psv_interp) are no longer read; the conservative-depth centroid and the row harmonisation stay (tester). - calculateLOD passes cs[0..2] as the tester tree does. - Dead descriptor dwords at data joins: the tester's undef arm (descriptor_dword) only, not #136's zero for has_data joins. Kept because the tester tree has the same form: the signature sort by row, barycentrics (23 => 28), the comparison-sample check, and #160's gather and a16 sampling. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Tested head
AI-assisted (Claude Code). |
|
Translation census with this PR merged alone onto Setup: release build,
The first refusal per program changes like this (
In game (diag build, two runs each, stopped after 180 s): AI use: Claude Code (Claude Opus 5.5) merged and built the commits, ran the census and the title, compared the outputs and wrote this comment. The numbers come from the runs above. |
Depends on #136 by mpDom. This draft carries that PR's commits. The focused follow-up is 598d221.
Scalar GPU loads use byte offsets. When the host descriptor is a raw buffer, emitting a structured DXIL handle based on the console stride can return zero on NVIDIA. This change emits a raw handle and uses the byte offset directly. The plain-buffer descriptor data path also uses the raw handle.
A synthetic shader test binds a raw SRV, supplies console metadata with a 16-byte stride, and reads at byte offset 20. On the same Windows machine, the test returned
0on the unpatched #136 head and86with this change. The shader suite reported 70 passing tests. The asset policy check passed.The executable built from this draft rendered the intro and loading screens in a local run. World loading later ended with
DXGI_ERROR_DEVICE_HUNG. The synthetic test above isolates the startup shader fix.