Recompiler: gather4 with an explicit LOD reads the mip it names #1812
No reviewers
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
goal:world-load
good first issue
help wanted
invalid
keep-open
off-goal
question
stale
test-only
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/xcl-dev--xcl!1812
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-1812"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
@brothernog on GitHub · 2026-11-24 21:03 UTC · original
brothernog:gather4-explicit-lod→main· +320 −11 · 3 files · 1 commits · openimage_gather4_landimage_gather4_l_oread mip 0 in the HLSL backend, whatever LOD the program passes:Gather{ch}()has no level argument, and the texel offset was scaled with mip 0's size (emit.rs, thehas_lz || gather4arm). #1951 (merged) fixed the same forms in the direct DXIL backend; this PR does the HLSL side with the same level rule and adds GPU tests that run both backends. In the retail title's shader pack,image_gather4_lappears in 16 programs andimage_gather4_l_oin 16.What changes
LOD_BIAS, clamped to the S#MIN_LOD..MAX_LOD(u4.8), raised to the T#MIN_LOD(word1[19:8], u4.8), thenfloor(l + 257/512), then clamped to the view's last mip.floor(l + 257/512)does both steps;round()in DXIL goes to even.MIP_FILTERnone it readsfloor(T# MIN_LOD)at every LOD (1.75 → 1, 2.5 → 2). The T#MIN_LODcomes after the S# clamp.MIN_LODis taken relative to the view's base level, like the LOD. Ashortcut:comment marks it: the tests only useBASE_LEVEL0.Loads at that level, so the host sampler's MinLOD/MaxLOD, bias and filter, and the view'sResourceMinLODClamp, can't move them to another level. The S# addressing is applied per axis in the shader (gat_axin the HLSL prelude):desc::sampler_d3d12and #1951. Not measured on RDNA2.floor(coord * size(level) - 0.5)plus the 6-bit signed offset, counted in texels of that level. The output is inGather's component order, for the dmask channel.gather4 explicit LOD (not 2D)instead of silently reading mip 0.gather4_c_l,_c_l_o), the bias forms (gather4_b,_b_cl,_c_band their_oforms), and plaingather4/gather4_cin a pixel shader.Files
gpu/recomp/emit.rs: the explicit-LOD gather path and thegat_axhelper.gpu/recomp/runner.rs: kernel test textures can carry mips.TestTexture::mips()works the count out from the data's length (SRV-only 2D and 2D arrays whose data holds each slice's full chain to some level; 1 otherwise). It is a method, not a field, so no other test's literal changes.gpu/recomp/tests.rs:gpu_gather4_explicit_lod_hlslandgpu_gather4_explicit_lod_directrun the same cases through each backend (one test per backend, so a driver crash names it). The direct one runs #1951's code on a GPU. They use an 8×8 texture and a 2-layer array, 4 mips each, with distinct values per mip and per texel, and 18 S# / T# cases: point, linear and no mip filter;MAX_LOD1,MIN_LOD2, bias ±1; wrap, mirror, mirror once and mixed axes; the border and half-border variants; T#MIN_LOD1.75 and 2.5 with no mip filter, 1.75 with a point mip filter, and 1.75 over an S#MAX_LODof 1. LODs include the ties 0.5 and 2.5, 0.499, one past the last mip and one below 0, plus negative and far offsets.gpu_ps_image_gather4_l_s_sharp_level: @upipibi's three review cases, in a pixel shader through the runtime's ownsampler_d3d12(HLSL only: the draw helper is HLSL-only).Tested
main68a284a+ this PR (a56538a):cargo test -p xcl --lib -- gather4 --test-threads=1(debug): 8 passed.cargo test --release -p xcl --lib -- --test-threads=4: 1222 passed, 1 failed, 26 ignored. The failure,gpu::recomp::lower_dxil::tests::a_bridged_mask_write_where_one_half_is_elsewhere_meets_no_barrier, fails the same way onmain68a284aalone.emit.rsback tomain(tests kept):gpu_gather4_explicit_lod_hlslfails (gather4_l hlsl [clamp, point mip] lane 8 (uv 0, 1; lod 0.5; offset (-1, 0))) and so doesgpu_ps_image_gather4_l_s_sharp_level((a) LOD 1, full range, point mip);gpu_gather4_explicit_lod_directpasses.cargo clippy --release -p xcl --all-targets: no new warnings (818 on68a284aand on this branch, same count).8eb5a5c; see the thread), @upipibi (RTX 3070) and @JJAutoCompare (Arc A770).Regression run
With
XCL_NETWORK=0 XCL_PAGE_BUDGET_MB=4096, back to back,mainfirst (one run each; frame counts vary from run to run, so the difference is noise-level):main68a284a:This PR (
a56538a):Overlap
levelmatch inemit.rs(sample offsets), so whichever lands second needs a small rebase._lzforms only.Not tested
8eb5a5cis not reproduced or explained here) and Intel at this head; wave64-native hardware.MIN_LODwithBASE_LEVEL> 0, the half-border modes on hardware, integer-format textures.AI use
AI-assisted.
@upipibi on GitHub · 2026-11-24 21:18 UTC · original · edited 2026-11-24 21:20 UTC
Checked on Ampere: RTX 3070 8 GB, driver 616.56, Windows 11, debug,
5f3e9ecmerged ontomain177cd40.Merge with
main. There is one conflict, inlower_image.rs:mainmoved the sampler choice intoself.mimg_sampler(d.pc, has_c, s3). Keeping that line and yourglodlines below it builds cleanly.Results.
gpu_gather4_explicit_lodpasses on both backends. My own check also passes: a pixel-shaderimage_gather4_lat LOD 1 on a 4-level 8×8 RGBA32F texture, with exact footprints for all 256 pixels.A gap: the sampler's LOD clamp. The mip is chosen from the raw LOD, but the four
SampleLeveltaps go through the host sampler. That sampler has the S#'sMinLOD/MaxLOD(desc.rs:323-324). When the sampler clamps the LOD to another level, the taps land on that level at the chosen mip's texel centres, which fall between its texels. Same texture, clamp to edge, point x/y:MAX_LOD1.0[100,101,101,100]vs[100,100,100,100]MIP_FILTERnone (host MaxLOD = MinLOD)[0,1,1,0]vs[0,0,0,0]"Console level" follows a hardware measurement on RDNA2 (gfx1036) in boykopovar/AnyPS5#23856. For
image_gather4_lit found:LOD_BIASis added first, then the S#MIN_LOD/MAX_LODclamp applies;MIP_FILTERnone reads the T#MIN_LODrounded down; a linearMIP_FILTERgathers like point. Clamping the LOD the same way before choosing the mip would make the host's clamp a no-op. A sampler with the full LOD range, no bias and a point mip filter is not affected.On rounding versus truncation: the same measurement found the level changes at exactly
n + 0.5, and ties go up (0.5 → 1, 1.5 → 2, 2.5 → 3).round()in HLSL is round-half-to-even in DXIL, so this PR picks one level lower than the hardware at 0.5, 2.5, 4.5, and so on.floor(lod + 0.5)matches at the ties. Values up to 1/512 below a tie also went up there, consistent with the LOD being rounded to 1/256 first (their fit, not a measured mechanism). (Edited: an earlier version of this comment said I had found no measurement.)Test (pixel shader, 3 cases)
AI-assisted (Claude Code). Synthetic tests only.
@futurepro62 on GitHub · 2026-11-24 21:34 UTC · original · edited 2026-11-24 22:20 UTC
Full-suite run, since this PR has no test report yet. Tested exact head
5f3e9ec(on its baseb9b6ea6).Tested
cargo build --workspace, thenXCL_REQUIRE_GPU=mesh cargo test --workspace -- --test-threads=4 --skip heap_window_out_of_memory_falls_back_to_the_switch_form --skip pso_measurement_compiles_an_exact_synthetic_record: 888 passed, 0 failed, 42 ignored. SKIPPED (no wave64):gpu_geometry_wave32_prefix_count_over_a_mask,gpu_wave32_program_in_wave64_hardware.gpu_gather4_explicit_lod.XCL_ADAPTER=radeon),cargo test --workspace -- --test-threads=4: 890 passed, 0 failed, 42 ignored. SKIPPED:heap_window_out_of_memory_falls_back_to_the_switch_form(no heap windows).--skipon NVIDIA. Both fail on main7f7e768too, not because of this PR: underXCL_REQUIRE_GPU=mesh,runner::skip_testturns their skips into failures.heap_window_out_of_memory_falls_back_to_the_switch_formskips whenXCL_HEAP_WINDOWSis unset (#1651), andshaders::tests::pso_measurement_compiles_an_exact_synthetic_recordskipped because Developer Mode was off. Developer Mode was turned on before the AMD run, and therepso_measurement_compiles_an_exact_synthetic_recordran and passed.Not tested
AI use
@brothernog on GitHub · 2026-11-24 22:27 UTC · original
@upipibi thanks, both points were real, and the measurement pointer settled the rounding question I had left open. I rebased onto
main689f2db(themimg_samplerconflict, resolved as you did, plusmips: 1on the two new MSAA test textures from #1679) and pushed7f804be:LOD_BIAS, clamped toMIN_LOD..MAX_LOD, thenfloor(l + 0.5), so ties go up. WithMIP_FILTERnone it reads level 0 of the view. That is a stated shortcut: I don't know how the T#MIN_LODrelates toBASE_LEVELhere. A linear mip filter gathers like point.Loads at the chosen level. The S# addressing (wrap, mirror, clamp, mirror once, the border modes with the S# border colour type) is applied per axis in the shader, so neither the host sampler's MinLOD/MaxLOD, bias and filter nor the view'sResourceMinLODClampcan move a tap to another level.gpu_ps_image_gather4_l_s_sharp_level: a pixel shader throughsampler_d3d12, on the HLSL path, since the draw helper is HLSL only.gpu_gather4_explicit_lodnow runs 14 S# cases on both backends: LOD ranges, bias ±1, point / linear / none mip filters, wrap, mirror, mirror once, mixed axes, three border variants, the ties 0.5 and 2.5, and negative offsets.lower_image.rsreverted,gather4_l direct dxil [clamp, point mip] … lod 0.5fails.cargo test --release -p xcl --lib: 928 passed, 0 failed, with and withoutXCL_HEAP_WINDOWS=1(RTX 3050, 610.88). The smoke pair on the new head is in the description.@futurepro62 thanks for the full-suite run on the 5070 Ti. It was on
5f3e9ec, the head before this change, so7f804behasn't run on Blackwell yet.Not covered by a test: a static (constant) S#. The words come from the code there, through the same expressions.
This comment was AI-assisted.
@upipibi on GitHub · 2026-11-24 22:29 UTC · original
Re-tested
7f804be(onmain689f2db), RTX 3070, driver 616.56: all three of my cases now pass on both backends. That's LOD 1 full range, LOD 2 with S#MAX_LOD1.0, and LOD 1 withMIP_FILTERnone: 0 of 256 pixels wrong each, with and withoutXCL_DIRECT_DXIL=1.gpu_gather4_explicit_lodpasses on both too. Thanks for the quick change.On the remaining
shortcut:("how the T# MIN_LOD / BASE_LEVEL relate is unknown"): the same gfx1036 measurement (boykopovar/AnyPS5#23856) covers it.MIP_FILTERnone reads the T#MIN_LODrounded down (1.75 → 1, 2.5 → 2), at every LOD. Otherwise the T#MIN_LODraises the level after the S#MAX_LODclamp (bias, S# clamp, then T# MIN_LOD; the other order was 128 lanes off there). With a T#MIN_LODof 0, as in these tests, both reduce to what the PR does now.AI-assisted (Claude Code). Synthetic tests only.
@futurepro62 on GitHub · 2026-11-24 23:44 UTC · original
Follow-up from reading
7f804be, not from a GPU run: the new path is gated onglod = gather && lod.is_some() && !has_c(lower_image.rs, and the same inemit.rs), so a few sibling gather forms still go throughGather{ch}()/GatherCmp{ch}()and read mip 0 of the view:image_gather4_c_l,image_gather4_c_l_o: an explicit LOD, buthas_cexcludes them. They take the plainGatherCmppath.image_gather4_b,image_gather4_b_cl,image_gather4_c_b(and their_oforms): the bias is decoded (i_bias), butlodisNonefor these, soglodis false and the bias is dropped.image_gather4/image_gather4_cin a pixel shader:whole_quad()already treats these as implicit-LOD instructions (they need whole quads for derivatives), but the lowering still gathers at level 0. On RDNA2 only the_lzforms are fixed at level 0, as far as I know.I can't say how many programs in the retail pack use these, and I haven't measured any of them on a GPU, so I'm not suggesting they block this PR. They might be worth a line in the description, or a
return err(d, …)the way the non-2D case is refused now, so they show up in coverage counts instead of quietly reading the wrong mip.@DavidM1911 on GitHub · 2026-11-25 00:28 UTC · original
Verification on RTX 3060 Ti (Windows 11): merge conflict with current
main— needs a rebase before it can be tested.@raylitebull on GitHub · 2026-11-25 01:08 UTC · original
To move this forward before merge:
mainto resolve the current merge conflict._c_l/_bforms.Build and test (Windows, no GPU)passes and get a fresh AMD retest on the rebased head.@brothernog on GitHub · 2026-11-25 01:09 UTC · original
@upipibi thanks for the retest, and for the T# rule. It's in as
51361a6, on both backends:MIP_FILTERnone readsfloor(T# MIN_LOD), at every LOD.MIN_LOD..MAX_LOD, then raised to the T#MIN_LOD, thenfloor(l + 0.5). The T#MIN_LODisword1[19:8], u4.8, asgpu/desc.rsalready reads it.gpu_gather4_explicit_lodgained four cases with a T#MIN_LOD(18 now): 1.75 and 2.5 withMIP_FILTERnone (levels 1 and 2), 1.75 with a point mip filter, and 1.75 over an S#MAX_LODof 1 (level 2; the other order would give 1). With either backend's change reverted, that backend fails on the first new case and reads mip 0.Two things your summary doesn't settle, so I wrote them down as assumptions:
MIN_LODis applied before the+ 0.5rounding, so 1.75 gives level 2. If the measurement saw 1 there, it's a one-line change.MIN_LODis taken relative to the view's base level, like the LOD. The tests only useBASE_LEVEL0, so ashortcut:comment stays forBASE_LEVEL> 0.@DavidM1911 thanks, the conflict was real: #1969 moved the direct DXIL sample path into a guarded closure. The branch is rebased onto
mainde36462. The explicit-LOD gather now sits inside that closure, so it inherits the heap index guard. The branch is two commits now: the first is the old two folded together.cargo test --release -p xcl --lib: 957 passed, 0 failed, with the default settings, withXCL_HEAP_WINDOWS=1and withXCL_DIRECT_DXIL=1(RTX 3050 8 GB desktop, 610.88). A new smoke pair is in the description.@futurepro62 agreed on all three. They are outside this PR, and I've listed them in the description as known gaps:
gather4_c_l/_c_l_okeep the mip-0GatherCmp. Doing them withLoads means doing the depth compare in the shader.gather4/gather4_cin a pixel shader read level 0 instead of the implicit LOD.I'd rather not refuse them here. They translate today and read mip 0, and a refusal would turn every program that uses them into a translation failure. That trade belongs in its own PR, with pack counts. #1951 covers the compare forms in the direct DXIL backend.
This comment was AI-assisted.
@raylitebull on GitHub · 2026-11-25 01:34 UTC · original
CI
Build and test (Windows, no GPU)failed on51361a6atcrates/xcl/src/gpu/recomp/tests.rs:2548witherror[E0063]: missing field 'mips' in initializer of 'TestTexture'(a newly merged test onmainusesTestTexturewithoutmips: 1).Next step before merge: please rebase onto
main, addmips: 1attests.rs:2548(and any other newTestTextureinitializers), and run CI + one independent AMD GPU pass on the rebased head.@upipibi on GitHub · 2026-11-25 01:49 UTC · original
Re-checked
51361a6on the RTX 3070 (driver 616.56, Windows 11, debug) with the pixel test from before, on both backends. LOD 1.0, LOD 2.0 under S#MAX_LOD1.0,MIP_FILTERnone, LOD 0.5 and LOD 2.0 with an S#LOD_BIASof −0.75 all read the expected level.One case doesn't: LOD 0.499 (as a literal) reads level 0 on both backends, where RDNA2 reads level 1. boykopovar/AnyPS5#23666 measured the level change at LOD·256 = 127.5: 127.495 reads level 0, and 127.5 already reads level 1. That's because the LOD is first rounded to 1/256 with halves up, and then the nearest level is taken with ties up.
floor(l + 0.5)on the unrounded LOD misses the window [0.498046875, 0.5) below every n + 0.5.floor(l + 0.501953125)gives both steps in one (0.501953125 is exact in f32).On your two assumptions:
MIN_LODapplied after the S#MAX_LOD, and before the rounding to a level. So 1.75 with a point filter gives level 2.MIP_FILTERnone reads the T#MIN_LODrounded down (1.75 → 1, 2.5 → 2), as you have it.BASE_LEVEL: #23666 ran T#MIN_LOD1.5 withBASE_LEVEL1 (andBASE_LEVEL1 withLAST_LEVEL3) against its rule, all matching. Its summary doesn't spell out the relation to the base, though, so the fixture there is the place to confirm it; I haven't measured that myself.AI-assisted (Claude Code). Synthetic tests only.
@raylitebull on GitHub · 2026-11-25 02:11 UTC · original
Reviewed
b0f160f: switching toTestTexture::mips(&self)incrates/xcl/src/gpu/recomp/tests/runner.rscleanly fixes the rebase without changing existing struct literals, and both HLSL (emit.rs) and direct DXIL (lower_image.rs) paths plus pixel-shader tests are covered (action_requiredCI run approved).Two items remain before merge:
@upipibi's review note on theu4.8bias (+ 0.5vs+ 0.501953125soLOD 0.499samples mip 1 rather than mip 0) is still+ 0.5inb0f160f.@brothernog on GitHub · 2026-11-25 04:21 UTC · original
@raylitebull Thanks for catching the rounding edge case. It’s fixed in
8eb5a5cin both backends, andgpu_gather4_explicit_lodnow checks that LOD 0.499 selects mip 1. An independent AMD run on that head is still pending. AI-assisted draft.@upipibi on GitHub · 2026-11-25 04:32 UTC · original
Re-checked
8eb5a5con the RTX 3070 (driver 616.56, Windows 11, debug) with the same pixel-shader gather test as before, on both backends. All six cases read the expected level withXCL_DIRECT_DXIL=0and1: LOD 1.0; LOD 2.0 under S#MAX_LOD1.0;MIP_FILTERnone; LOD 0.5; LOD 2.0 withLOD_BIAS−0.75; and LOD 0.499, which now reads level 1 (floor(lod + 0.501953125)), as on the hardware. The gather tests in the tree pass too (4 of 4,XCL_DIRECT_DXIL=1).AI-assisted (Claude Code). Synthetic tests only.
@brothernog on GitHub · 2026-11-25 04:36 UTC · original
@upipibi Thanks for retesting both backends on
8eb5a5cand confirming the 0.499 case on the RTX 3070. An independent AMD run on this head is still pending. AI-assisted reply.@JJAutoCompare on GitHub · 2026-11-25 01:36 UTC · original · edited 2026-11-25 07:02 UTC
Tested
Clean PR head
51361a6a02ebe251b6c91bee7310ae05f6510fcdon Intel Arc A770 (driver 32.0.101.9175), AMD Ryzen 7 3800X, Windows 11 Enterprise Evaluation 26200.9974, Rust 1.100.0x86_64-pc-windows-msvc, and DXC/DXIL 1.9.2609.5. I verified the live PR head before and after the run.I prebuilt with
cargo test --locked -p xcl --lib -j 2 --no-runin the unoptimized test profile withCARGO_INCREMENTAL=0,CARGO_PROFILE_DEV_DEBUG=0andCARGO_PROFILE_TEST_DEBUG=0. WithXCL_ADAPTER=A770,XCL_REQUIRE_GPU=wave64,XCL_DXC_DIRpointing to the verified 1.9.2609.5 x64 DLLs, andXCL_DIRECT_DXILunset, I ran the resulting libtest executable under the shared Arc lock.2 passed, 0 failed, 0 ignored, 0 skipped. Each invocation filtered out 981 tests.
gpu_gather4_explicit_lodexplicitly dispatched HLSL compiled with DXC and direct DXIL within the same test. All 18 descriptor cases passed on each backend, with 64 lanes and three four-tap footprints per lane (2D, 2D with offsets, and 2D array). That is 3,456 footprint comparisons per backend. Cases cover LOD bias and clamps, point/linear/no mip filter, 0.5 and 2.5 ties, out-of-range LODs, address and border modes, negative offsets, and the four texture minimum-LOD cases, including a T# minimum above the S# maximum.gpu_ps_image_gather4_l_s_sharp_levelused HLSL/DXC through the draw helper and the S# host sampler. Zero mismatches across all 256 pixels in each of its three cases. LOD 1 with point mip selected level 1, LOD 2 with S#MAX_LOD=1selected level 1, and LOD 1 with no mip filter selected level 0.Not tested
Direct DXIL pixel shaders, static S#, nonzero texture base levels, comparison or implicit-LOD gathers, other GPUs, the current
mainmerge result, the full workspace suite, and retail smoke runs.AI use
Codex in T3 Code (
gpt-6.2-sol) ran the checked-in tests and wrote this report.Arc A770 rerun at
8eb5a5cTested
Both stock fixtures passed on the Intel Arc A770 at
8eb5a5c352084eda4fcce6b9332e2fa3aff193f2. PR #1812 was open at that exact head before and after the run, and the detached checkout stayed clean.STOR-WINLAB ran Windows 11 Enterprise Evaluation build
26200.9974, Ryzen 7 3800X, Arc A770 driver32.0.101.9175, Rust1.100.0(x86_64-pc-windows-msvc), and DXC/DXIL1.9.2609.5. The unoptimized prebuild ran outside the Arc lock with two jobs, incremental compilation disabled, and dev/test debuginfo disabled. Both fixtures ran under the shared Arc lock withXCL_ADAPTER=A770,XCL_REQUIRE_GPU=wave64, andXCL_DXC_DIRpointed at the installed DXC 1.9.2609 directory.Each fixture reported 1 passed, 0 failed, 0 ignored, 0 skipped, with 1,125 filtered out. Cargo, both test processes, the Arc wrapper, and the outer process each exited
0. The binary SHA-256 matched before the wait and after lock acquisition:a4d17e2dda2f14f366b654769fdc67f87cf498c4efa38698fec29f0fb82bf870.gpu_gather4_explicit_lodverified that0.499selects mip 1 in the full-range point-mip case on both HLSL and direct DXIL. Across 18 descriptor cases, it compared 3,456 footprints per backend for 2D gather, offset 2D gather, and 2D array gather.gpu_ps_image_gather4_l_s_sharp_levelchecked all 256 pixels in each of three HLSL cases covering full-range point mip filtering, samplerMAX_LOD, and disabled mip filtering.Combined: 2 passed, 0 failed, 0 ignored, 0 skipped. Compute ran in 1.37 s and pixel in 0.56 s. The Arc mutex was released.
Not tested
Full workspace suite, retail smoke, AMD hardware, direct DXIL pixel draws, or
0.499in the pixel fixture.AI use
T3 Code / Codex (
gpt-6.2-sol) ran the verification, inspected the stock assertions, and wrote this report.@brothernog on GitHub · 2026-11-25 15:21 UTC · original
Thanks @JJAutoCompare for rerunning both fixtures on the Arc A770! Could someone with an AMD GPU independently verify that explicit LOD 0.499 selects mip 1 on both the HLSL and direct DXIL paths at
8eb5a5c? Please include the GPU and driver version. AI-assisted.@futurepro62 on GitHub · 2026-11-25 17:10 UTC · original
AMD run of head
8eb5a5c(oncbc296a), for the AMD verification asked for above. Follows up on my earlier report.Result: the new test
gpu::recomp::tests::gpu_gather4_explicit_lodcrashes the test process on an RDNA2 iGPU.Tested
XCL_ADAPTER=radeon, Windows 11 Home 26300, Rust 1.100.0 MSVC, DXC + dxil.dll 1.9.2602.17, debug.cargo test -p xcl --lib -- --test-threads=1 --nocapture --skip gpu::dxil::fuzz_tests::fuzz_validate_and_gpu_1: 408 tests passed, then the process died while runninggpu::recomp::tests::gpu_gather4_explicit_lod, with exit code0xc0000005(STATUS_ACCESS_VIOLATION). No panic message or test output was printed before the crash.cargo test --workspace -- --test-threads=4run on the Radeon crashed the same way at this head, in two separate runs, so no pass/fail counts were produced. Because the process dies there, the PR's other new test,gpu_ps_image_gather4_l_s_sharp_level, did not get to run on AMD.06c9f55(which doesn't have this test) runs the whole suite on the same iGPU without a crash: 2 known failures,fuzz_validate_and_gpu_1andfine_timer_makes_short_sleeps_short.XCL_REQUIRE_GPU=mesh, same main-failing--skips as the earlier report), the same head is clean: 1144 passed, 0 failed, 44 ignored, andgpu_gather4_explicit_lodpasses.Not tested
AI use
@brothernog on GitHub · 2026-11-25 18:38 UTC · original
Rebased onto
main68a284aas one commit,a56538a. #1951 now covers the direct DXIL side, so this PR drops itslower_image.rschanges and keeps the HLSL path, the runner's mip chains and the GPU tests.@futurepro62 thanks for the AMD run. I have no AMD GPU here, so I couldn't reproduce the crash. Two changes should make a rerun more telling:
gpu_gather4_explicit_lodis now two tests,gpu_gather4_explicit_lod_hlslandgpu_gather4_explicit_lod_direct, so with--test-threads=1the test that is running when the process dies names the backend.8eb5a5cthe direct half ran this PR's ownlower_image.rscode; it now runs #1951's (mimg_gather4_lod).I read the host side again (
runner.rs: the upload of every slice's mip chain, the footprints and the SRV mip counts) and found nothing wrong there, so my guess is the driver, compiling or running one of the two programs. That is only a guess.Running the direct test against #1951 turned up one disagreement: the half-border address modes 4 (
CLAMP_HALF_BORDER) and 5 (MIRROR_ONCE_HALF_BORDER). #1951 anddesc::sampler_d3d12give no border colour for them (clamp / mirror once); this PR's HLSL path and test gave the border colour. Neither side was measured on RDNA2. I aligned the HLSL path and the test withmain, so both backends now agree. If anyone has an RDNA2 measurement, the case to check isclamp half border, black.Tested
a56538aon Windows 11 26300, RTX 3050 8 GB (desktop), NVIDIA 610.88, Rust 1.100.0 MSVC, DXC 1.9.2602.17 (a 60 s smoke run of the title againstmainis in the updated description):cargo test -p xcl --lib -- gather4 --test-threads=1(debug): 8 passed, including both new tests andgpu_ps_image_gather4_l_s_sharp_level.emit.rsback tomain:gpu_gather4_explicit_lod_hlslfails ([clamp, point mip] lane 8 … lod 0.5),gpu_ps_image_gather4_l_s_sharp_levelfails ((a) LOD 1), andgpu_gather4_explicit_lod_directpasses (it runsmain's code).cargo test --release -p xcl --lib -- --test-threads=4: 1222 passed, 1 failed, 26 ignored. The failure,lower_dxil::tests::a_bridged_mask_write_where_one_half_is_elsewhere_meets_no_barrier, fails the same way onmain68a284aalone.cargo clippy --release -p xcl --all-targets: 818 warnings on68a284aand on this branch, no new ones.This comment was AI-assisted.
@thiagocalile on GitHub · 2026-11-25 19:11 UTC · original
Independent test and smoke report for head
a56538a588f72f053be108b6efedfa044d248839on an AMD Radeon RX 6600 (8 GB VRAM, RDNA2, native wave64).Tested
32.0.21045.29003,XCL_ADAPTER=radeon), AMD Ryzen 7 5700X3D, 47.9 GB RAM, Windows 11 (10.0.26200.0), Rust1.100.0(stable-x86_64-pc-windows-msvc), DXC1.8.2502.11.XCL_ADAPTER=radeon XCL_DIRECT_DXIL=0 cargo test --no-fail-fast -p xcl --lib -- gather4 --test-threads=1: 0 passed, 0 failed, 0 ignored (0skipped).XCL_ADAPTER=radeon XCL_DIRECT_DXIL=1 cargo test --no-fail-fast -p xcl --lib -- gather4 --test-threads=1: 0 passed, 0 failed, 0 ignored (0skipped).Regression run (
scripts/smoke.ps1, release builds,XCL_ADAPTER=radeon)main(2898511):PR
#1812(a56538a):Not tested: targeted gather unit tests (filter gather4 matched 0), full workspace suite, NVIDIA/Intel GPUs, Linux/Wine, or world load past the 60 s smoke window.
AI use: Antigravity (Gemini 4 Neon) ran the builds, tests, and smoke runs and drafted this report; the account owner reviewed and approved posting.
@ClosetPie107 on GitHub · 2026-11-25 19:41 UTC · original
Independent AMD RDNA4 / Linux (RADV, native wave64) test report for head
a56538a588f72f053be108b6efedfa044d248839(merged cleanly ontomain2898511).Hardware & environment
experimental-11.0-20261112),vkd3d-protonmasterec207194(3.2.0) +dxil-spirvb540c8a2+ relaxed-vtable patch (-Db_ndebug=true), DXVKv3.1.1-209, DXC1.9.2609.5, Rustx86_64-pc-windows-gnu(debug)Tests (
XCL_REQUIRE_GPU=wave64,XCL_DXC_DIR,VKD3D_CONFIG=ignore_shared_fence,--test-threads=1 --nocapture)gather4: 8 passed, 0 failed, 0 ignored (0 skipped, 0.40 s)gpu_gather4_explicit_lod_direct,gpu_gather4_explicit_lod_hlsl,gpu_ps_image_gather4_l_s_sharp_level) ran on the RX 9070 and passed cleanly (no crash like the earlier RDNA2 iGPU run at8eb5a5c).gpu::recomp::tests: 169 of 170 ran and passed (17 ignored, 0 skipped, 11.54 s); the single mismatch (gpu_nonfused_mad_and_mac_prevent_fma_contraction:v_fma_f32 overflow control should stay fused,+Inf0x7f800000vs0x73ffffff) is unrelated togather4.Not tested
AI use
main, ran the tests under Proton on this machine, and drafted this report.@futurepro62 on GitHub · 2026-11-25 23:22 UTC · original
Rerun of head
a56538a(on68a284a) with the split tests, as asked above. Follows up on my AMD crash report on8eb5a5c.Result: on the RDNA2 iGPU the HLSL form crashes and the direct form passes.
Tested
XCL_ADAPTER=radeon cargo test -p xcl --lib gather4 -- --test-threads=1 --nocapture, one test at a time:gather4_lod_emits_bias_and_rdna2_half_up_rounding,gather4_lod_honors_tsharp_min_lod_and_mip_filter_none,gather4_lod_variants_translate_and_validate,non_cube_unorm_sampling_translates_and_validate: okgpu_gather4_explicit_lod_direct: okgpu_gather4_explicit_lod_hlsl: the test process ends with0xc0000005(STATUS_ACCESS_VIOLATION) while it runs, sogpu_ps_image_gather4_l_s_sharp_levelandimage_gather4h_is_unsupportednever ran.--test-threads=4) crashes the same way.XCL_REQUIRE_GPU=mesh cargo test --workspace -- --test-threads=4with the usual main-failure skips: all 8 gather4 tests pass, both forms included. One failure there,a_bridged_mask_write_where_one_half_is_elsewhere_meets_no_barrier, is not from this PR: it fails the same way on the base68a284aalone, and currentmainpasses it, so a rebase should clear it.So on this machine it comes down to the HLSL path of the explicit-LOD gather, and the direct form passes on the same iGPU. The same test passes on the discrete RX 9070 above, so this may be specific to the integrated RDNA2 part rather than to AMD in general. The RX 6600 run above (a discrete RDNA2 card, the closest match) matched 0 tests with its filter, so it doesn't settle that yet.
Not tested
AI use
@DavidM1911 on GitHub · 2026-11-26 00:34 UTC · original
Re-verification on RTX 3060 Ti (Windows 11), new head merged with current
main:cargo test -p xcl --lib: all passed, 0 failed, 27 ignored. The earlier merge conflict is resolved.Thanks!
— Devin
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.