Repository navigation
Tests: image instructions in the per-lane lowering and on the GPU - #1825
Draft
MiguelMachado-dev wants to merge 2 commits into
Draft
MiguelMachado-dev wants to merge 2 commits into
MiguelMachado-dev wants to merge 2 commits into
Conversation
`vgpr_uses` took an image instruction's registers from the operand tables, which give the largest case: a 3-D address with every modifier and four data registers. It missed the addresses in the NSA dwords (VADDRA, VADDRB, ...) and a compare-swap's compare value (VDATA + 1), took a G16 sample's address as shorter than the translators read it, took an atomic's data as written only (and written without GLC too), and claimed data registers that DMASK and D16 leave alone. Its callers act on those registers: the direct DXIL VS sets up the initial VGPRs it lists (vertex and instance id, fetched attributes), the HLSL path bounds its movrel switches with them, `xcl shaders` reports the inputs a program reads from them, and the per-lane form of xcl-dev#1745 passes exactly them to xcl-dev#1426's lowering, which refuses an instruction that reads another: every image instruction with NSA addresses. `vgpr_uses` now counts them as `recomp::emit` and `dxil::lower_image` read them: the address dwords from the opcode's modifiers, DIM and A16, at VADDR and the registers after it or VADDR then the NSA bytes; the data from DMASK, D16, TFE/LWE, GLC and the opcode. `dxil::lower_image` read VDATA + 1 for every atomic; it reads it for a compare-swap only now. In xcl-dev#1745's per-lane form (at 3ca3633), a sweep of every IMAGE_* instruction over DIM, A16, D16, DMASK, GLC and sequential or scattered NSA addresses through the per-lane compute lowering: 6562 of 28032 cases refused for a register not passed before (6130 NSA, 288 compare-swap, 144 G16), none after, and no case that lowered before refused. Assisted-by: Claude Code (Claude Opus 5.5, xhigh)
Every IMAGE_* instruction lowers per lane with each register it uses passed, with sequential and NSA addresses, A16, D16, DMASK and GLC. On the GPU, a program with an NSA load and samples, a D16 sample, a store in a coalesced guarded run, a sample at an LOD, resinfo, a gather, GLC compare-swap and add and a load at sequential addresses agrees with the HLSL path (textures and every register the instructions use) and gives the expected values; a BVH ray with NSA addresses under four memory windows gives the memory of one window and of the HLSL path. An implicit-LOD sample stays out of coalesced runs, and a PS refuses it in a block not every lane reaches. Assisted-by: Claude Code (Claude Opus 5.5, xhigh)
Contributor
|
Same results on Ampere: RTX 3070 8 GB (32-lane waves, no wave64), driver 616.56, Windows 11, debug,
The whole workspace was not run. AI-assisted (Claude Code). Synthetic tests only. |
Contributor
|
Verification on RTX 3060 Ti (Windows 11), branch merged with current
Thanks! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Stacked on #1797; only the top commit (
434f428) belongs here. The commit under it,c2b0c00, is #1797's8ec49c0cherry-picked ontomainc4d37bewith the same diff. Once #1797 is inmain, this PR is rebased and only the tests remain.These are tests for image instructions in the per-lane form (#1745), the MIMG follow-up listed on #1269. They need #1797: without its
vgpr_useschange, the per-lane form refuses every image instruction with NSA addresses, and the threelower_dxiltests fail. Part of #1269.What is in it
Tests: image instructions in the per-lane lowering and on the GPU(434f428). Tests only, in the files'#[cfg(test)]modules, +271/−1:crates/xcl/src/gpu/recomp/lower.rs:decode_bytes,mimg(an image instruction with NSA dwords) andimage_program;image_instructions_in_coalesced_runs_and_whole_quads: image instructions join a coalesced guarded run. An implicit-LODIMAGE_SAMPLEstays out of the run, and a PS refuses it in a block that not every lane reaches.crates/xcl/src/gpu/recomp/lower_dxil.rs:image_instructions_pass_every_register_they_use(CPU): everyIMAGE_*instruction, over DIM, A16, D16, DMASK, GLC and sequential or 11 scattered NSA addresses, gets through the per-lane compute lowering with no register missing from the bridge.per_lane_image_instructions_agree_with_the_hlsl_path_on_the_gpu:SAMPLE_L, resinfo,GATHER4_LZ, and GLC compare-swap and add.a_per_lane_bvh_with_nsa_addresses_runs_on_the_gpu: a BVH ray with NSA addresses gives the same memory with four memory windows, with one window, and on the HLSL path.Tested
Setup:
cargo build --workspace && cargo test --workspace -- --test-threads=4:434f428: 965 passed, 0 failed, 43 ignored (lib: 916 / 0 / 23);mainc4d37be: 959 passed, 0 failed, 43 ignored (lib: 910 / 0 / 23).By module at
434f428, 0 failed in each:gpu::dxil::gpu::recomp::lower::gpu::recomp::lower_dxil::gpu::recomp::lane_masks::gpu::rdna2::SKIPPED GPU tests: 23 lines, the same on both runs, and none in the new tests.
V_MUL_F16,V_PK_MUL_F16andV_CVT_F16_F32, whose gpu: direct RDNA2 -> DXIL backend (no HLSL / DXC), behind XCL_DIRECT_DXIL #1426 semantics differ from the console's.heap_window_out_of_memory_falls_back_to_the_switch_form(no heap windows).shaders::tests::pso_measurement_compiles_an_exact_synthetic_record: it cannot disable the driver cache, which needs Windows Developer Mode.The three
lower_dxiltests fail without Recompiler: image instructions name the registers they use #1797's change. I checked that on Recompiler: a per-lane form for the direct DXIL backend (XCL_PER_LANE) #1745's branch at3ca3633, before it was merged.Regression run
crates/xcl/srcthatpr_check.pycounts as runtime, and until Recompiler: image instructions name the registers they use #1797 is merged the diff also has Recompiler: image instructions name the registers they use #1797's commit.mainand this PR is rebased, the diff is test-only. It can then take thetest-onlylabel after review, or a smoke pair.Not tested
AI use