Recompiler: pixel comparison samples apply their LOD bias #349
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!349
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-349"
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-bias→main· +116 −0 · 2 files · 1 commits · openPixel-shader
image_sample_c_b*now applies the instruction’s LOD bias to depth comparisons. With point mip filtering, +1 selects the coarser mip and −1 the finer mip. This overlaps #247 inemit.rsand builds directly on main.What is in it
crates/xcl/src/gpu/recomp/emit.rs— Scalesddx(coord)andddy(coord)byexp2(bias). 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 positive, negative and per-pixel bias, the zero-offset form, zero bias and a minimum-LOD clamp against two opposite depth checkerboards with point mip filtering.Tested
7d1c008isfe3011d's two commits squashed into one, with the same tree (git diff fe3011d 7d1c008is empty).cargo test --workspace -- --test-threads=4on7d1c008merged ontomain9e3831e(a clean merge,389c343): 777 passed, 0 failed, 41 ignored (thexcllibrary: 728 passed, 21 ignored). SKIPPED:gpu_geometry_wave32_prefix_count_over_a_maskandgpu_wave32_program_in_wave64_hardware(no wave64), andheap_window_out_of_memory_falls_back_to_the_switch_form(no heap windows;main's own test).fe3011d1b16don18c105af8692. The bias and flat integer selector raster tests both passed (2 passed, 0 failed).cargo build --workspacepassed.cargo test --workspace -- --test-threads=4returned 690 passed, 0 failed, 41 ignored. GPU tests reporting SKIPPED within the pass count:gpu_geometry_wave32_prefix_count_over_a_mask(no wave64),gpu_wave32_program_in_wave64_hardware(no wave64).cccc2c3890efon 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. All six bias cases passed on the full-screen triangle and the partial quads along the diagonal.d25aea141589on9ab7d763197c.cargo build --workspacepassed.cargo test --workspace -- --test-threads=4returned 652 passed, 0 failed, 40 ignored. GPU tests reporting SKIPPED (included in Cargo’s pass count):gpu_geometry_wave32_prefix_count_over_a_mask(no wave64),gpu_wave32_program_in_wave64_hardware(no wave64).9ab7d763197cwith only the tests added failed four of six draw cases. The two controls passed on base, and all six passed on this head.a60db9f3e5f2: two checks passed. Both offset forms read the expected texel at mip 1 with a nonzero offset. SDK DXC compiled 20 opcode and view combinations.CreateReservedResourcereturnedE_OUTOFMEMORYingpu_sparse_vram_descriptors_buffers_and_xmem. Three sparse windows had zero GPU addresses, then pipeline creation returnedDXGI_ERROR_DEVICE_REMOVED.d25aea1merged ontomain7ebf1b8. The new test passes, and withemit.rsfrommainfails in four of its six cases. Their whole suite stopped in the #344 hang in 4 of 4 runs; with #443 merged too: 679 passed, 0 failed, 41 ignored.main9ab7d76and the head tested in that report: 918 and 913 frames, no crash or device removal (https://github.com/ivall/xcl/pull/349#issuecomment-7119194735).Regression run
Our own runs, one after the other on the machine under Tested (RTX 5070 Ti), release builds, no uncommitted changes:
mainat18c105a(this PR's base), then this PR's head7d1c008. 1276 / 1246 frames (102 %), peak commit 26598 / 27160 MB (98 %); no device removal and no crash on either run.main:
PR:
Not tested
AI use
18c105aand its runs, and this description7d1c008🤖 Generated with Claude Code
@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:
d25aea1merged 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.XCL_REQUIRE_GPU=wave64,mesh cargo test -p xcl --lib gpu_ps_compare_mip:gpu_ps_compare_mip_biaspasses.emit.rsback onmain. The test fails withIMAGE_SAMPLE_C_B, scale 0.125, slope 0: pixel (0,0): 0 instead of 1 from mip 1, plus the_C_B_CL,_C_B_Oand slope 0.5 cases.sample_cmp_gradis identical, so git merges it cleanly): both compare-mip tests pass.Not tested
smoke.ps1); cube and array sampling on hardware; NVIDIA.AI use
@Kalmarv on GitHub · 2026-11-24 00:22 UTC · original
Thanks for testing on the RX 9060 XT and checking the negative control where reverting just the emitter change brought back all four mip-selection failures.
🤖 GPT-6.2 Astra
@throny on GitHub · 2026-11-24 01:16 UTC · original
NVIDIA RTX 40 run of
d25aea1onmain7ebf1b8(clean merge): the new test passes and fails without theemit.rschange. The whole suite did not finish on this tree here, for a reason that is not this PR (below).Tested
stable-x86_64-pc-windows-msvc, debug; DXC 1.9.2602.17 (Windows SDK 10.0.26100.0); noXCL_SAMPLE_*cargo test --workspace -- --test-threads=4onmain+ this PR: stopped in the lib tests in 4 of 4 runs (basesa6f5f7a,2997c9atwice,7ebf1b8), in the #344 deadlock (gpu_uma_import_check_at_initand three other GPU tests running for over 60 seconds; the same stop happens here on trees without this PR, stacks in my report on #443).gpu_ps_compare_mip_biashad passed before the stop each time.16fc79d) merged in as well: 679 passed, 0 failed, 41 ignored,gpu_ps_compare_mip_biasok (one run).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_biasfails in four of its six cases (IMAGE_SAMPLE_C_B+1,_C_B_CL−1,_C_B_O+1 and the per-pixel slope case); the two controls pass.13d8a1f): 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)
qevery pixel of the quad computescoord[q] + (its position − q's position) · gradient[q], so the implicit derivativesSampleCmpsees are pixelq's scaled ones, and each pixel keeps the result of its own iteration (delta 0, its own coordinate).xi.xcl_posis always a member ofXclIn.Not tested
scripts/smoke.ps1) on a title, no shader-pack run (XCL_SAMPLE_RPF), wave64 hardware, cube and array forms (the test draws 2D only).AI use
@QemmHD on GitHub · 2026-11-24 01:18 UTC · original
Review: scaling
ddx/ddybyexp2(bias)adds the bias to log2 of the footprint, and the quad construction reproduces those derivatives exactly. Two points (same as on #350):emit.rs:2191-2196: offsets for comparison samples still use level0u, so_c_b_o/_c_b_cl_owith a non-zero offset move by mip-0 texels while the bias selects mip ≥ 1. The test's_Orows use offset 0; a note on the #247 dependency, or a non-zero-offset row after #247, would cover it.QuadReadLaneAtandSampleCmpdepend on here) aren't exercised; an edge through quads would cover that.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
d25aea1, 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 911 frames (PR), also with no device removal or crash. Themainblock is one run, shared with my reports on #348 and #350.memory:line: 6311 MB local / 4619 MB non-local (main), 6311 MB local / 4619 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:26 UTC · original
Thanks for checking the mip calculation and the triangle coverage.
The standalone head uses mip-0 texel units for both offset forms, and its two offset rows pass zero. I added that dependency to the PR body draft. With #247 at
a60db9f, a syntheticIMAGE_SAMPLE_C_B_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. The bias fixture now enters whole-quad mode (
S_WQM_B64 EXEC, EXEC) before computing texture coordinates so helper pixels supply the screen derivatives. It checks the depth comparison for all 96 covered pixels and the clear value for the other 160.Tested
PR head
cccc2c3890efon 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:42 UTC · original
Independent native D3D12 check of
fe3011don RTX 3080 Ti / 621.35, Windows 11 build 26300, DXC 1.8.2502.11 and Rust 1.99.1 MSVC, release.All six bias cases matched the expected pixel values on both the full-screen and partial-quad triangles. The flat integer selector control passed too. The offset variants in this fixture use zero offsets. Two stock tests passed, with zero failures, ignores or skips.
Commands used
XCL_ADAPTER=3080 Tiandcargo test --locked --offline --release -p xcl --lib <filter> -- --test-threads=1 --nocapture, withgpu_ps_compare_mip_biasandgpu_ps_p0_reads_flat_integer_selectors.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 (
7d1c008, 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 bias, 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 bias too, orgpu_image_sample_c_b_d_offset_moves_by_the_mip_readfails (sample_c_b_o, PS: pixel (0,0) = 0). We have that line ready and tested (62f93a3; 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)
@DavidM1911 on GitHub · 2026-11-25 14:29 UTC · original
Verification on RTX 3060 Ti (Windows 11), branch merged with current
main:cargo test -p xcl --lib: all passed, 0 failed, ~26 ignored. (Intermittent single-test flake / 0xc0000005 abort under parallel scheduling — tracked in #1978; clean on single-threaded rerun.)Thanks!
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.