Recompiler: comparison samples use their supplied pixel gradients #350
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!350
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-350"
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?
@Kalmarv on GitHub · 2026-11-24 00:07 UTC · original
Kalmarv:fix/ps-compare-grad→main· +134 −3 · 2 files · 1 commits · openPixel-shader
image_sample_c_d*andimage_sample_c_cd*now use the instruction’s gradients for depth comparisons. Main selected the mip from screen derivatives even when the instruction requested a finer or coarser footprint. This overlaps #247 inemit.rsand builds directly on main.What is in it
crates/xcl/src/gpu/recomp/emit.rs— Uses the instruction’s X and Y gradients, keeping array layers discrete and projecting cube-face coordinates back to a direction. Atps_6_6,QuadReadAcrossXandQuadReadAcrossYonSV_Positionidentify the pixel in the quad. An unrolled four-iteration loop usesQuadReadLaneAtfor the coordinate and both derivatives, then issues one nativeSampleCmpper iteration. Each pixel selects its own result.crates/xcl/src/gpu/recomp/tests.rs— six 16×16 raster draws check coarser, finer and per-pixel gradients, the coarse-derivative zero-offset form, matching gradients and a minimum-LOD clamp against two opposite depth checkerboards with point mip filtering.Tested
9249b7a, onmain06c9f55, with DXC 1.9.2609:cargo test --workspace -- --test-threads=4(debug): 1266 passed, 0 failed, 46 ignored, with 25 SKIPPED notices from 15 tests (no native wave64, three refused per-lane cases, no heap windows). In release,gpu_ps_compare_mip_gradients1 passed,gpu_ps_7 passed andsample22 passed, 0 failed each. On this base the change needed one fix:main's5195e27runs an image sample without an implicit LOD only in the lanes EXEC keeps, but a comparison with gradients reads every pixel of the quad (QuadReadLaneAt). This head runs it in all four lanes, as an implicit-LOD sample is run, with a lane outside EXEC given descriptor index 0 and a zero result.13d8a1fmerged ontomain7ebf1b8.cargo test --workspace -- --test-threads=4: 678 passed, 0 failed, 41 ignored. Withemit.rsfrommainthe new test fails in four of its six cases. With #349 merged too, both tests pass.9249b7amerged with currentmain, thank you:cargo test -p xcl --lib(the library only, not the workspace). Run in parallel, 3 tests failed; the comment does not name them. Rerun with--test-threads=1: 1304 passed, 0 failed, 27 ignored (#350). They count the parallel failures as the flakes of #1978. That issue was closed by #2002, which thismaincontains.main9ab7d76and this head: 918 and 909 frames, no crash or device removal (https://github.com/ivall/xcl/pull/350#issuecomment-7119195251).Regression run
Our own runs with
scripts/smoke.ps1, 120 s each, one after the other on the machine under Tested (RTX 5070 Ti), release builds from clean trees, on the direct route:XCL_DIRECT_DXIL=1, each run with its own XCL cache that starts from the same list of used pipelines (the driver's own cache untouched).mainat08db802(a newermainthan this PR's base06c9f55, which it contains), then this PR's head9249b7a. Themainrun is shared: one run serves this PR and #2098 and #245. All of these ran as one queue job, after one uncounted warm-up run ofmain(the title ran from a second exe path, whose driver cache starts cold). The job was queued to run beside a CPU-bound pipeline precompile on the same machine, but that precompile ended during the warm-up, so none of the runs above had it beside them.main:
PR:
PR vs
main: 1311 / 1313 frames (100 %), peak commit 29495 / 29957 MB (98 %); device removals 0 and crashes 0 on the PR run, 0 and 0 onmain.Not tested
AI use
08866f9🤖 Generated with Claude Code
github-bot referenced this pull request2026-11-26 05:18:41 +00:00
@ghost on GitHub · 2026-11-24 00:19 UTC · original
AMD run, since Not tested says no AMD driver has compiled these quad operations yet:
13d8a1fmerged ontomaina6f5f7a(clean merge): pass on RDNA4, and the new test fails without theemit.rschange.Tested
.\scripts\test.ps1: 677 passed, 0 failed, 41 ignored; noSKIPPEDGPU tests (the two wave64 skips on your 5070 Ti run here).XCL_REQUIRE_GPU=wave64,mesh cargo test -p xcl --lib gpu_ps_compare_mip:gpu_ps_compare_mip_gradientspasses.emit.rsback onmain. The test fails withIMAGE_SAMPLE_C_D, scale 0.125, slope 0: pixel (0,0): 0 instead of 1 from mip 1, plus the_C_D_CL,_C_CD_Oand slope 0.0625 cases.sample_cmp_gradis identical, so git merges it cleanly): bothgpu_ps_compare_mip_gradientsandgpu_ps_compare_mip_biaspass.Not tested
smoke.ps1); cube and array sampling on hardware; NVIDIA.AI use
@throny on GitHub · 2026-11-24 01:16 UTC · original
NVIDIA RTX 40 run of
13d8a1fmerged ontomain7ebf1b8(clean merge, merge commit5e66bc9): pass, and the new test fails without theemit.rschange.Tested
stable-x86_64-pc-windows-msvc, debug; DXC 1.9.2602.17 (Windows SDK 10.0.26100.0); noXCL_SAMPLE_*cargo build --workspace && cargo test --workspace -- --test-threads=4: 678 passed, 0 failed, 41 ignored (lib: 638 / 0 / 21,gpu_ps_compare_mip_gradientsok). An earlier run of this PR ona6f5f7astopped in the #344 deadlock (not this PR: stacks in my report on #443).SKIPPEDon this adapter:gpu_geometry_wave32_prefix_count_over_a_mask,gpu_wave32_program_in_wave64_hardware(no wave64)emit.rsfrommain:gpu_ps_compare_mip_gradientsfails in four of its six cases (IMAGE_SAMPLE_C_Dcoarser,_C_D_CLfiner,_C_CD_Ocoarser and the per-pixel gradient case); the two controls pass.d25aea1): the two branches merge without a conflict although both addsample_cmp_gradandcheck_ps_depth_mip(one copy of each results), andcargo test -p xcl --lib gpu_ps_compare_miponmain+ #350 + #349 passes both tests.Reviewed (read the whole diff)
has_lz || !psone and is limited to pixel shaders, so comparison samples with gradients outside PS still takeSampleCmpLevelZeroas onmain.Not tested
scripts/smoke.ps1) on a title, no shader-pack run (XCL_SAMPLE_RPF), wave64 hardware, the cube, array and 3D forms (the test draws 2D only).AI use
@QemmHD on GitHub · 2026-11-24 01:18 UTC · original
Review: the quad construction is exact (the coordinate is affine across the quad and each lane's own coordinate is unchanged), and staying on
ps_6_6avoids SM 6.8'sSampleCmpGrad. Three points:emit.rs:2191-2196: offsets for comparison samples still use level0u(the_ => "0u"arm), so_c_d_o/_c_cd_o/_c_cd_cl_owith a non-zero offset move by mip-0 texels while the gradients now select coarser mips. The_Orows in the test use offset 0. If this is meant to be fixed by #247, a note on the dependency (or a non-zero-offset row once #247 lands) would help.check_ps_depth_mipdraws[0,0],[0,32],[32,0]over the whole target, so no quad ever has helper lanes, which theQuadReadLaneAtmethod relies on. A triangle edge through quads (e.g.[0,0],[0,16],[16,0], checking only covered pixels) would cover that.emit.rs:1927: the own-lane term isdelta * gradwithdelta == 0, so a ±inf/NaN gradient turns the lane's own coordinate into NaN. UsingQuadReadLaneAt(coord, q)unchanged whendelta == 0avoids it.AI-assisted review (Claude Code, Claude Opus 5.5).
Discord: bigpeppa.
@CuteBooty on GitHub · 2026-11-24 01:32 UTC · original
Regression run on a retail title for
13d8a1f, which the description lists as pending: pass (no device removal, no crash, frames and peak commit level withmain).Tested
scripts\smoke.ps1 -Game <folder> -Seconds 60on the PR's head as it is and onmain9ab7d76, the commit it is based on, each built from a clean checkout of its commit.main) and 919 frames (PR), also with no device removal or crash. Themainblock is one run, shared with my reports on #348 and #349.memory:line: 6311 MB local / 4619 MB non-local (main), 6247 MB local / 4620 MB non-local (PR).main:
PR:
Not tested
AI use: Claude Code with Claude Fable 5.2 made the runs with me present and wrote this comment.
@Kalmarv on GitHub · 2026-11-24 02:23 UTC · original · edited 2026-11-24 02:26 UTC
Thanks for checking the mip calculation and the triangle coverage.
The standalone head uses mip-0 texel units for the explicit-gradient offset forms, and both offset rows pass zero. I added that dependency to the PR body draft. With #247 at
a60db9f, a syntheticIMAGE_SAMPLE_C_D_Odraw with a +1 X offset read the expected neighbor at mip 1.The full-screen triangle left the helper-lane case uncovered. The test now keeps that draw and adds a diagonal that leaves one or three covered pixels in each edge quad. It checks the depth comparison for all 96 covered pixels and the clear value for the other 160.
With the tests carried onto
13d8a1f, +∞ and NaN in dU/dX returned 1 instead of 0 at pixel (2,0), and −∞ in dV/dY did the same at (0,2). The zero-displacement multiply contaminated the sample center. The emitter still reads the gradients across the quad, but applies an axis displacement only when it is nonzero. The new cases use positive infinity, negative infinity and NaN with the mip clamped to 1 to isolate the sampling coordinate.Tested
PR head
bf32301d87b8on an RTX 5070 Ti (610.74), SDK DXC 1.7,ps_6_6: the targeted raster test passed. The full workspace returned 652 passed, 0 failed, 40 ignored; two native-wave64 tests reported SKIPPED within the pass count.Not tested
AMD on this follow-up. Our title smoke pair on this head is in the description; the title doesn't show whether it reaches these sampling forms.
🤖 GPT-6.2 Astra
@thehollowedone on GitHub · 2026-11-24 07:45 UTC · original
Independent native D3D12 check of
f09eca5on RTX 3080 Ti / 621.35, Windows 11 build 26300, Rust 1.99.1 MSVC, release.Both DXC 1.8.2502.11 and 1.6.2112.16 passed all nine explicit-gradient cases on both triangle coverage patterns, including NaN, positive infinity and negative infinity with the mip fixed. The flat integer selector control also passed on both compilers. Four test runs passed, with zero failures, ignores or skips. The offset variants use zero offsets.
I used
XCL_ADAPTER=3080 Tiandcargo test --locked --offline --release -p xcl --lib <filter> -- --test-threads=1 --nocapturewithgpu_ps_compare_mip_gradientsandgpu_ps_p0_reads_flat_integer_selectors. The older compiler was selected throughXCL_DXC_DIRand confirmed in the test output.AI use: Codex (GPT-6, exact variant unavailable) ran the tests and drafted this report.
@Kalmarv on GitHub · 2026-11-24 17:50 UTC · original
Squashed into one commit (
08866f9, the same tree as before) as CONTRIBUTING asks; the smoke pair for it is queued.A note for the merge order with #247: this PR makes the PS
SampleCmptake the gradients, and #247 moves a comparison offset by the mip that sample reads. With both in a tree, one line in #247's offset code has to take the gradients too, orgpu_image_sample_c_b_d_offset_moves_by_the_mip_readfails (sample_c_d_o, PS: pixel (0,0) = 0). We have that line ready and tested (3edfb6f; with it the test passes, and main + all eleven of our open PRs + both follow-ups pass the whole suite, 815 passed, 0 failed). Whichever of the two lands second, we push it there.AI use: Claude Code (Claude Opus 5.5)
@JJAutoCompare on GitHub · 2026-11-25 07:34 UTC · original
Tested
Independent native Windows run for PR #350 at clean detached
08866f93ae63d9d73cf13ca96b47fca028f775b0. STOR-WINLAB, Windows 11 Enterprise Evaluation x64 26200.9974, Ryzen 7 3800X, Intel Arc A770 driver 32.0.101.9175, Rust/Cargo 1.100.0 x86_64-pc-windows-msvc, DXC and DXIL 1.9.2609.5. Unoptimized test profile with debug info and incremental compilation disabled.cargo test --locked -p xcl --lib --no-run -j 2 --message-format=jsonbuilt outside the GPU lock and exited 0. UsedXCL_ADAPTER=A770,XCL_DIRECT_DXIL=0, andXCL_DXC_DIR=%LOCALAPPDATA%/XclTooling/dxc-1.9.2609/bin/x64. Ran the Cargo-emitted executable in the shared Arc lock wrapper:1 passed, 0 failed, 0 ignored, 0 GPU skips, 671 filtered out, 2.76 s. The fixture and mutex wrapper both exited 0. Executable SHA-256 matched before the wait, under the mutex, and after the fixture exited.
All nine stock HLSL/DXC cases passed on both triangle geometries. The fixture checks exact red-channel comparison results on the 16×16 readback, including the gradient that selects adjacent mips across pixel columns, the non-finite gradient controls, and the clear value for uncovered pixels. The offset forms use zero offsets.
Not tested
Nonzero offsets, cube and array textures, direct DXIL lowering, the PR base, other adapters, the workspace suite, and title smoke runs.
AI use
T3 Code / Codex (gpt-6.2-sol) verified the checkout, ran the checked-in fixture, and wrote this report.
@DavidM1911 on GitHub · 2026-11-25 14:33 UTC · original
Verification on RTX 3060 Ti (Windows 11), branch merged with current
main:cargo test -p xcl --lib: 1 real failure, deterministic (also fails--test-threads=1, 1098/1):Texture-compare sampling with mip gradients returns wrong texels at mip transitions on the GPU — a real sampling regression. Needs a fix before merge.
— Devin
@Kalmarv on GitHub · 2026-11-25 14:43 UTC · original
Thanks @DavidM1911. It fails the same way here on an RTX 5070 Ti, with
main06c9f55merged in: every failing pixel is in the one 2×2 quad at (10..11, 0..1) of the 12×16 triangle, whose lower-right pixel lies outside the triangle. Even the cases clamped to a minimum LOD of 1 come back as mip 0 there, so the lowering most likely takes the value from the wrong pixel of a partially covered quad. The mip choice itself looks right. I'm fixing it and will update the PR here.AI use: drafted with Claude Code (Claude Opus 5.5); the test run is my own.
@Kalmarv on GitHub · 2026-11-25 15:20 UTC · original
@DavidM1911 fixed and pushed (
9249b7a, rebased ontomain06c9f55, one commit).What went wrong: this PR predates
5195e27b, which puts pixel-shader samples without implicit derivatives inside an EXEC check. The emulated compare-with-gradients reads all four lanes of the quad and relies on SampleCmp's quad derivatives. The partial quad's helper lane, pixel (11,1) of the 12×16 triangle, is outside EXEC, so it skipped the sample and left its neighbours' LOD undefined. The PR's own head still passed on its old base; only the merge failed.The fix runs that sample in every lane of the quad, the way implicit-LOD samples already run, and writes the result only for lanes in EXEC. On the RTX 5070 Ti:
gpu_ps_compare_mip_gradients1 passed, thegpu_ps_filter 7/0, thesamplefilter 22/0, and the full workspace (debug,--test-threads=4) 1266 passed, 0 failed, 46 ignored. The new smoke pair goes into the description when it's done.AI use: investigated and fixed with Claude Code (Claude Opus 5.5).
@DavidM1911 on GitHub · 2026-11-26 02:47 UTC · original
Re-verification on RTX 3060 Ti (Windows 11), new head merged with current
main:cargo test -p xcl --lib: 3 failures under parallel scheduling; clean on--test-threads=1rerun (1304 passed, 0 failed, 27 ignored, 77s). Intermittent flakes — tracked in #1978.Thanks!
— Devin
@Kalmarv on GitHub · 2026-11-26 03:29 UTC · original
@DavidM1911 thanks for the re-run. We ran the same here:
9249b7amerged withmainb49be18, debug,cargo test -p xcl --lib, on an RTX 5070 Ti with 32 logical CPUs, so 32 test threads by default.gpu::recomp::tests::gpu_ps_compare_mip_gradients(this PR's test) failed in all five, andhle::d3d12x::vram::tests::gpu_retire_queue_holds_heap_until_blocked_queue_passes_markdid too.hle::d3d12x::vram::tests::d32s8_targets_take_their_own_size_of_video_memoryfailed in three. Each of these failed withE_OUTOFMEMORY(0x8007000E) when it created a D3D12 resource, not on a wrong sampled value.hle::d3d12x::sparse::tests::a_tile_decommitted_and_committed_again_keeps_its_video_memoryfailed once, on its video-memory assertion.--test-threads=4, three runs: 1310 passed, 0 failed, 27 ignored each time.mainb49be18on its own, default threads, two runs: in one, the twovramtests failed with the sameE_OUTOFMEMORY; the other passed.Since this PR's test is the one that fails every time at 32 threads, I'll make it take the same lock the
vramtests take, and post the default-thread runs after that change here.Were your 3 among these? If not, could you paste their names and the panic messages? #1978 was closed by #2002, which is on
main, so these may be something else.AI use: Claude Code (Claude Opus 5.5) ran these tests and drafted this reply.
@Kalmarv on GitHub · 2026-11-26 04:34 UTC · original
Follow-up on the lock: it doesn't help, so it isn't pushed.
With
gpu_ps_compare_mip_gradientstakingVRAM_TEST_LOCK(local commit95c16a6on this head), merged withmainb49be18: debug,cargo test -p xcl --libat the default 32 threads, RTX 5070 Ti, with nothing else on the GPU (346 MiB in use before each run). Three runs, with 6, 5 and 6 failures:gpu_ps_compare_mip_gradientsstill failed in two of three, withE_OUTOFMEMORY(0x8007000E) when it created a resource.title_texturestests that take the same lock failed in all three:gpu_mirror_upload_follows_cpu_writes_and_later_mapping_changesandplaced_title_textures_share_vram_and_preserve_pixelswithE_OUTOFMEMORY, anda_placed_texture_gets_the_pages_of_a_level_with_its_texelsonce withE_OUTOFMEMORYand twice on the lock (.lock().unwrap()), poisoned by a test that panicked while it held it.vramtests failed as before. They fail the same way onmainb49be18alone at this thread count, so that ismain's flake, not this PR's.So the out-of-memory doesn't come from this test running beside the
vramtests; it shows up once many GPU tests run at once in one process. With--test-threads=4, this head merged withmainb49be18(without the lock) passes: 1310 passed, 0 failed, 27 ignored in three runs.AI use: Claude Code (Claude Opus 5.5) made the change, ran these tests and wrote this comment.
@upipibi on GitHub · 2026-11-26 08:16 UTC · original · edited 2026-11-26 08:26 UTC
RTX 3070 8 GB run of
9249b7a(as-is, on its basemain06c9f55, not merged with currentmain). The fix holds; at the default 32 threads the failures areE_OUTOFMEMORY(0x8007000E), as in your 04:34Z results. (Edited 08:19Z: narrowed to what was measured.)gpu_ps_compare_mip_gradients,--test-threads=1: 3 of 3 passed, no SKIPPED. Controls: with only the EXEC change reverted it fails 3 of 3 (8 of 9 cases, all in the partial quad (10..11, 0) of the 12x16 triangle, e.g.pixel (11,0): 0 instead of 1 at mip 0); with all ofemit.rsfrommainit fails 4 of 9.gpu::recomp::tests::failed in 2 of 3 runs (this test only); full lib failed in 3 of 3: this test in all 3,vram::tests::d32s8_targets_take_their_own_size_of_video_memoryin 2,gpu_ps_p0_reads_flat_integer_selectorsandgpu_wave64_ps_spill_slotsin 1.--test-threads=4: full lib 1188 passed, 0 failed, 26 ignored; the module 3 x 156/0/17.runner.rslabelled locally): the failing call wasdev.CreateCommandQueueatrunner.rs:1107indraw_indexed_on, which makes a queue per draw. That is one run; others may fail elsewhere. Possibly related (a hypothesis, not checked): #1668,E_OUTOFMEMORYon the 64th submitted queue.06c9f55, which does not contain the new test: 0 failures in 5 runs at 32 threads.NVIDIA 616.56, 32 logical CPUs, Windows 11 26100, Rust 1.100.0, debug, DXC 1.8.2502.11. Not tested: merged with current
main, release, AMD.Update (08:26Z): with the same local labelled build, 6 more runs of
gpu::recomp::tests::at the default 32 threads gave 1 failure (gpu_ps_compare_mip_gradients,E_OUTOFMEMORYatrunner.rs:1107,CreateCommandQueueindraw_indexed_on); both labelled failures so far are at that call. System commit, logged every second: 70.3% (23.9 of 33.9 GiB) at the failure, 70-74% peak in every run, and the commit limit never changed, so at that resolution commit was not near its limit. The full lib at 32 threads with the new test skipped passed 3 of 3 (1187 passed, 0 failed); at this failure rate that is weak evidence. The number of live queues was not measured.AI use: Claude Code (Claude Opus 5.5) ran the builds, tests and controls and wrote this from the logs.
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.