Repository navigation
Conversation
|
Verified on Windows 11 10.0.26300, NVIDIA GeForce RTX 5090 (driver 621.24), Rust 1.100.0 MSVC 14.44.35207, debug build, on Two more passing tests than the baseline; the direct QuadReadAcross intrinsics are emitted and their fixtures run green here. Tree restored afterwards (full diff against a clean checkout), hardware adapter, no Wine, no game data. AI-assisted (opencode): applied the patch to a built tree, ran the suite, reverted it. |
|
Independent verification, merged onto current Machine: Windows 11, Ryzen 9 7900X Radeon iGPU (gfx1036 RDNA2, native wave64) + RTX 3060 Ti; Rust stable MSVC, debug.
AI use: test runs by Devin (Cognition, SWE-2); no code changes. |
pvfreis
left a comment
There was a problem hiding this comment.
Review of 8de58c8 against its merge base e74dda2, by reading the code; nothing of the PR was built or run here (one DXC compile of a two-line shader of my own, in finding 1). The six DPP controls and the swizzle offsets do name the three permutations (0xB1 = lanes 1,0,3,2, 0x4E = 2,3,0,1, 0x1B = 3,2,1,0, row_xmask 1..3 and xor-mode 1..3 the same), and in a pixel shader the new read is the one rla already made: for a source in the reader's own quad rla returns QuadReadLaneAt(v, l & 3) (crates/xcl/src/gpu/recomp/emit.rs:5635-5636, :5649), which is QuadReadAcross* as long as a lane's quad index is lane_id & 3, and main assumes that too. bound_ctrl, FI, ROW_MASK / BANK_MASK and the EXEC bit of the source lane are the same expressions as before (the dropped _l >= 0 is always true here), and a helper or inactive source lane is read through a quad read in both versions. So I found no wrong value in the pixel path. The problems are in the other stages, where main did not use quad reads at all.
-
CONFIRMED (that a title's vertex shader uses these controls is not known): a vertex shader with one of these controls no longer compiles. The new branches have no stage check (
emit.rs:2688-2696for DPP16,emit.rs:4015-4020fords_swizzle_b32), soQuadReadAcross*is written in every mode.mainkept quad reads inside#ifdef XCL_PIXEL(emit.rs:5634); elsewhererlais aWaveReadLaneAt. Vertex programs are compiled asvs_6_6(crates/xcl/src/gpu/recomp/pso.rs:505), and DXC refuses quad operations there: a two-line vertex shader callingQuadReadAcrossX, compiled with DXC 1.9.2602.17 (-T vs_6_6), fails validation with "Opcode QuadOp not valid in shader model vs_6_6" (the same call compiles ascs_6_6). Scenario: a console vertex shader withv_mov_b32 ... quad_perm:[1,0,3,2](orrow_xmask:1, ords_swizzle_b32with offset0x041F) translates as complete, DXC refuses it, and the PSO that drew onmainhas no vertex shader. Traced: the emitter writes the intrinsic forMode::Vertex. Fix: take the new path only forMode::Pixel, keeprla/xcl_x_rla_halfelsewhere. -
Possible, from reading the code (not seen in a run): in compute-type modes the result now rests on how the driver forms quads, and nothing is gained there. On
maina kernel, compute, mesh or geometry program readWaveReadLaneAt(v, lane_id ^ n)(one wave read, orxcl_x_rla_halfin the split wave64 form,emit.rs:5547). The PR reads the quad neighbour instead. For compute the SM 6.6 derivatives spec defines quads fromSV_GroupIndex(1-D groups) orSV_GroupThreadID.xy(2-D), says no relation betweenSV_GroupIndexand the lane index should be assumed for 2-D groups, and makes thread groups that are neither "X divisible by 4, Y = Z = 1" nor "X and Y divisible by 2" an error for derivative operations.Mode::Computeuses the title's ownnumthreads(emit.rs:4478) and the emitter's comment there records that drivers lay 2-D groups out differently (emit.rs:4460-4463);Mode::Meshusesnumthreads(t, 1, 1)with the title'st(emit.rs:4538). Scenario: a title compute shader with an 8 x 8 group, or a mesh program whose thread count is not a multiple of 4, that contains one of these controls. I did not establish whether the group-size error applies to quad reads as well as derivatives, or what any driver returns in a 2-D group. The new GPU test runs only the kernel form,numthreads(64, 1, 1). Since the old read here was already a singleWaveReadLaneAt, the same fix as in 1 (pixel only) removes the question. -
CONFIRMED: the new GPU test does not run the path the change is for.
gpu_direct_quad_swizzles(crates/xcl/src/gpu/recomp/tests.rs:7447-7496) compares against values written out in the test ((l & !3) | ((l & 3) ^ n)), not againstswizzle_lane, so the expected result is independent, as CONTRIBUTING asks. But it runsrunner::run_code, i.e.Mode::Kernelcompiled ascs_6_6, with full EXEC,FI = 0,BOUND_CTRL = 0and both masks0xF. The saving described (fourQuadReadLaneAtand a ladder) exists only underXCL_PIXEL, and no test at this head puts0xB1/0x4E/0x1B/0x161..0x163or a quad swizzle through a pixel shader (the only other uses are kernel tests,tests.rs:1396,:6932,:6938). The copiedbound_ctrl/FI/ mask lines of the new DPP branch (emit.rs:2691-2702) are not run with a disabled source lane either;gpu_ds_swizzle_and_bpermute_zero_inactive_lanescovers that for the swizzle only. Fix: a pixel-stage test (a quad a primitive's edge splits, so that a helper lane is read) and one DPP case with a cleared EXEC bit underbound_ctrland without it. -
CONFIRMED (minor): code that cannot run, and an unrelated deletion. The three arms added to
dpp16_src(emit.rs:189-191) and the early return added toswizzle_source(emit.rs:291-293) are unreachable: their only callers testdpp16_quad_intrinsic/swizzle_quad_intrinsicfirst (emit.rs:2688,:4015). The PR also deletes the comment inrlathat says why quad reads are used for the reader's own quad (emit.rs:5634-5635), which still holds. The new DPP branch repeats the mask andbound_ctrllines instead of sharing them with the old one. -
Description. (a) "single-cycle", "dedicated quad swizzle hardware" and the Intel Arc claim are not measured anywhere in the PR; the two smoke blocks show 1665 and 1675 frames (a difference of 0.6 %, my arithmetic). (b) Tested names an Intel Arc A770, both smoke blocks say
gpu: AMD Radeon RX 9070 XT, and Not tested does not mention the mismatch; the description should say which machine made which run. (c) No whole-suite counts (cargo test --workspace -- --test-threads=4), only filtered runs. The two test reports on the PR supply some of this: 739 passed / 0 failed / 41 ignored on an NVIDIA adapter, and 190 / 0 / 18 for therecompfilter on a Radeon iGPU, both with the patch applied to a newermainrather than at this head. (d) AI use names tools but no model. (e) The subject prefixgpu/recomp:is not one of the areas (Recompiler:).
Overlap: #134 (open) also changes pixel-shader quad reads and adds pixel tests with 0xB1 / 0x4E; #518 (open) tests every ds_swizzle_b32 offset; #925 and #1022 (open) edit the DS permutes next to the swizzle branch and will conflict textually.
Verdict: not ready to merge as it is. Limited to Mode::Pixel, with a pixel-stage test, it looks correct to me; as written it writes quad intrinsics into vertex and compute-type shaders that used a plain wave read before, without a test of either.
Review by Claude Code (written by Claude Fable 5.2, checked and edited with Claude Opus 5.5); each point checked by a person before posting.
8de58c8 to
5fb6e7e
Compare
|
Thank you for the thorough and insightful review. Every point has been addressed:
Pushed to branch �rc-quad-swizzle as commit 5fb6e7e. GitHub Actions CI check is green. |
|
Thanks. Read at
Reply by Claude Code (Claude Opus 5.5); checked by a person before posting. |
5fb6e7e to
53d52b2
Compare
|
Added \gpu_pixel_dpp16_bound_ctrl_and_exec_masks_across_primitive_edge\ in \crates/xcl/src/gpu/recomp/tests.rs:
|
|
Thanks. Checked at Reply by Claude Code (Claude Opus 5.5); checked by a person before posting. |
|
AMD RDNA4 run of Tested
The same failure every run, also in the suite run: The previous head Not tested
AI use
|
…swizzles in pixel shaders
53d52b2 to
f488b9b
Compare
|
@Toons29 Thanks for the catch and detailed test report on RDNA4. The root cause of the failure in gpu_pixel_direct_quad_swizzles_across_primitive_edge on the RX 9070 was undefined behavior in reading SV_Position from helper lanes:
Fix: Rebased onto origin/main (9e3831e) at commit 488b9b. The PR description has been updated and CI checks are passing. |
|
Re-read at
Question: what shows that the RDNA4 result is Reply by Claude Code (Claude Opus 5.5, checked with Claude Fable 5.2); checked by a person before posting. |
Detect symmetric quad cross-lane permutations in DPP16 and ds_swizzle_b32 controls in pixel shaders (
Mode::Pixel) and emit direct HLSL SM 6.0 intrinsics:QuadReadAcrossXQuadReadAcrossYQuadReadAcrossDiagonalIn pixel shaders, this replaces the 4-way
QuadReadLaneAtlookup and selection ladder with single direct quad swizzle intrinsics. Non-pixel shaders (Mode::Vertex,Mode::Compute,Mode::Kernel, etc.) continue usingrla/WaveReadLaneAt, ensuring full compatibility with vertex shader modelvs_6_6(which does not permitQuadOp) and preserving driver-independent wave lane ordering in compute threadgroups.Tested
direct_quad_swizzle_patterns: verifies DPP16 and DS_SWIZZLE symmetric permutation decoding.vertex_shader_quad_swizzle_does_not_emit_quad_ops_and_compiles: validates thatMode::Vertexavoids quad opcodes and compiles cleanly with DXC asvs_6_6.gpu_dpp16_bound_ctrl_and_exec_masks: validates DPP16 execution with cleared EXEC masks underBOUND_CTRL = 1(reads 0) andBOUND_CTRL = 0(preserves destination).gpu_pixel_direct_quad_swizzles_across_primitive_edge: executes a draw call with a triangle covering a quad on the GPU, verifying that active pixels read lanes across X, Y, and Diagonal.gpu_pixel_dpp16_bound_ctrl_and_exec_masks_across_primitive_edge: executes a pixel-stage draw test across primitive boundary withFI = 0, verifying that reading disabled helper lanes returns 0 withBOUND_CTRL = 1, preserves destination withBOUND_CTRL = 0, and returns 0 fords_swizzle_b32.cargo test --workspace(674 passed, 15 failed due to known non-fp64 Arc baseline, 21 ignored).dcastell1.quad_swizzleandrecomptests green byDavidM1911.Regression run
Conducted on AMD Radeon RX 9070 XT (driver 32.0.32015.16001, Windows 11):
main(beaa245):PR (
f488b9b):Not tested
AI use