shader: lower gfx1030 comparison sample LOD and bias #1561
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1568"
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?
Imported from R0Y00/Xbox2Windows. Originally posted by stan495 on 2026-11-24T14:19:06Z.
Summary
Lower gfx1030
image_sample_c_l,image_sample_c_l_o,image_sample_c_bandimage_sample_c_b_ofor the two-mip 2D point-comparison profile. UseSampleCmpLevelfor an explicit level andSampleCmpBiasfor an instruction bias. The profile accepts statically known+0.0or1.0, reddmask:0x1and contiguous full-width operands with an optional signed XY offset. Bias requires whole-quad UVs. The sampler uses normalized clamp-to-edge addressing, point XY and mip filtering, and LOD range 0 through 1.Refs #1487
Verification
Tested clean head
97a4bb5e6efd3ed7aaeb5e8970d9e2986cf1db45on9e7bed97fe4e0371be12dccdc83e7556ec5f0c4a.CTest reported 13 passes, 0 failures and 1 capability skip. Both adapters passed both level forms. WARP passed both bias forms. Arc B390 reported
Comparison bias requires SampleCmpGradientAndBiasSupportedand returned 77. The two passing WARP records contain all four forms. The hardware level record contains both level forms.Translated pixels matched the CPU reference at 8×8 and 16×16. Setting the level or bias operand to zero first changed red from
1to0at(2,0)without an offset and at(0,0)with an offset. Setting the signed offset to zero first changed red from1to0at(0,0). The translator rejects a dynamic level, unsupported sampler modes and an unwaited read. Both DXC compile checks and the three Python checks passed.Windows 11 build
26300.9974, Intel Arc B390 driver32.0.101.8509, Microsoft WARP10.0.26100.9818. The debug layer was unavailable.All five LLVM checks passed. The four added forms assembled, disassembled and translated through the synthetic-container CLI.
git diff --check origin/main...HEADandgit merge-tree --write-tree origin/main HEADpassed. A separate simulation merged #1562, #1565 and this branch in that order against800a4500e27fd36221bd0373081967f69770c043.Physical GPU follow-up
Tested the clean PR head
97a4bb5e6efd3ed7aaeb5e8970d9e2986cf1db45on Windows 11 x64 (25H2, build26200.9974) with MSVC19.44.35228.0and DXC from Windows SDK10.0.26100.0. The same 14-test CTest selection above passed with no failures or capability skips.32.0.32029.201010.0.26100.9818The RX 7900 XTX passed the SM 6.8 and
D3D12_OPTIONS21.SampleCmpGradientAndBiasSupportedchecks. Bothimage_sample_c_bandimage_sample_c_b_omatched the CPU pixel reference at 8×8 and 16×16 on the physical GPU. Both backends recorded all four level and bias forms. The D3D12 debug layer reported zero errors and warnings on the level and bias tests.For the bias mutations, setting the bias operand to zero first changed red from
1to0at(2,0)forimage_sample_c_band at(0,0)forimage_sample_c_b_o. Setting the signed offset to zero first changed red from1to0at(0,0). The first mismatch coordinates were the same at both sizes and on both backends.To rerun the physical GPU checks after building
offscreen_checkas above, run the following from the repository root.Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-24T14:30:45Z.
Review: COMMENTED
Dual-platform peer review of PR #1568 (
97a4bb5e6efd3ed7aaeb5e8970d9e2986cf1db45).Code & Hygiene Audit
image_sample_c_l,image_sample_c_l_o,image_sample_c_b, andimage_sample_c_b_otoSampleCmpLevel/SampleCmpBiasintools/pixel_aot.py, plus two-mip support intests/pixel_compare_render.cppandtests/offscreen_check.cpp. Merges cleanly againstorigin/main.offset,bias,reference,U,V,explicit_lod), poppingoffsetfirst if_o, thenlodfrom the back (_l) orbiasfrom the front (_b), leaving[reference, u, v].+0.0(0) or1.0(0x3f800000) for the LOD/bias operand,MAX_LOD = 1, point XY and mip filtering,vmcntwait before use, and whole-quad UV provenance for_b(not required for_l).tests/offscreen_check.cppgates SM 6.7AdvancedTextureOpsSupported(level) and SM 6.8SampleCmpGradientAndBiasSupported(bias), returning skip (77) when unavailable or on older SDK headers.tests/pixel_compare_render.cppvalidatestexWidth >= 2 && texHeight >= 2for two-mip cases and uploads both subresources cleanly.tests/pixel_compare_lod_check.pychecks 8x8 and 16x16 readbacks, zeroed LOD/bias and zeroed offset mutations against predicted first pixel mismatches, and translator rejections (dynamic/out-of-range LOD/bias, unsupported sampler modes,dmask,a16, unwaited operand, missing quad provenance for bias, out-of-range offset).Verification
git diff --check origin/main..HEAD: passedpython3 tests/docs_links_check.py: passed (16 Markdown files, 345 links)python3 tests/bidi_controls_check.py: passed (1255 tracked files)python3 -B tests/pixel_compare_lod_check.py binary llvm-mc-19 llvm-objcopy-19 /usr/lib/llvm-19/lib/libLLVM-19.so: passed97a4bb5e6efd3ed7aaeb5e8970d9e2986cf1db45:tests/form_coverage_check.pypassed (43.16s)--preset dev):cmake --build --preset dev --target offscreen_check -- -j 6succeeded;ctest --preset dev -R '^pixel_aot_compare_lod_' --parallel 4 --no-tests=error --output-on-failure— 4/4 passed (pixel_aot_compare_lod_level_warp,pixel_aot_compare_lod_bias_warp,pixel_aot_compare_lod_level_hardware,pixel_aot_compare_lod_bias_hardware; note: this VM only has WARP)/O2(--preset release):cmake --build --preset release --target offscreen_check -- -j 6succeeded;ctest --preset release -R '^pixel_aot_compare_lod_' --parallel 4 --no-tests=error --output-on-failure— 4/4 passed (same 4 tests)Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-24T17:18:09Z.
Review: COMMENTED
Re-review at
head_sha:bc49d1ec103a0f987e36102a1800881f43fbce48(previously reviewed at97a4bb5e).Findings
No P1/P2. No defect found.
maininto the branch. Comparing the PR's patch against its merge-base before and after, the added and removed lines are identical except for one: the LLVM check that used to be a standalonepython3 -B tests/pixel_compare_lod_check.py binary llvm-mc-15 ...step in.github/workflows/windows.ymlis now an entry in theCHECKSlist,(["tests/pixel_compare_lod_check.py", *COMMON_LLVM], {}), next topixel_sample_offset_checkandpixel_compare_sample_check. That matches howmainnow runs its sibling checks, andCOMMON_LLVMexpands to the samebinary llvm-mc-15 llvm-objcopy-15 libLLVM-15.so.1arguments, so the CI coverage is unchanged.git merge-treeagainst currentmain(bc65bb1b) reports no conflicts (tree185387b7).tools/pixel_aot.pyonce more against RDNA 2 address order (offset, bias, reference, U, V, explicit LOD):_opops the offset first,_bthen pops the bias from the front,_lpops the LOD from the back, leaving[reference, u, v]; the HLSL argument order ofSampleCmpLevel/SampleCmpBias(location, compare value, LOD or bias, offset) is respected. TheMAX_LOD == 1and point-filter checks use the right operator precedence (&binds tighter than!=).Verified
Limits: Linux x86-64 only. No D3D12 device, no shader model 6.7/6.8 capability, so
drawand theoffscreen_checkchanges were not run. Those rest on the unchanged patch and the earlier Windows results on the previous head.python3 -B tests/pixel_compare_lod_check.py(controls) -> "gfx1030 depth-comparison LOD/bias checks passed", exit 0.python3 -B tests/pixel_compare_lod_check.py binary /usr/bin/llvm-mc-19 /usr/bin/llvm-objcopy-19 /usr/lib/x86_64-linux-gnu/libLLVM-19.so-> passed (two fixture records, 29 and 30 instructions), exit 0.(sampler[2] >> 26) & 3 != 1changed to!= 2; the check fails withValueError: Comparison LOD/bias requires MAX_LOD 1 and point mip filtering(exit 1). Restored."image_sample_c_l": "SampleCmpLevel"changed to"SampleCmpBias"; the check fails with anAssertionError(exit 1). Restored;git status --shortclean.AI-assisted; commands listed were executed locally.
Imported from R0Y00/Xbox2Windows. Originally posted by thepatrickworld on 2026-11-25T03:56:37Z.
Hardware run,
draw biasmode — RX 9070 XT, driver 32.0.32029.2010:The count of expected mismatches comes out the same on the card as in the check, so the bias is applied to the depth-comparison sample rather than to a plain one.
Limits: AMD only, no NVIDIA;
ps_6_7/ps_6_8needed DXC 1.9 here, and thelodmode name is not aFORMSkey (KeyError: 'lod'), so only thebiaspath was run.AI-assisted.
Imported from R0Y00/Xbox2Windows. Originally posted by stan495 on 2026-11-25T05:36:18Z.
Verified head
bc49d1econ Windows x64 (MSVC19.44.35228.0, SDK10.0.26100.0) in bothdevandrelease(/O2) configurations:python -B tests/pixel_compare_lod_check.py-> passed (gfx1030 depth-comparison LOD/bias checks passed)python -B tests/docs_links_check.py-> passed (16 Markdown files, 350 links)ctest --preset dev --no-tests=error -R '^pixel_aot_compare_lod_' -V-> 4/4 passed (pixel_aot_compare_lod_level_hardware,pixel_aot_compare_lod_bias_hardware,pixel_aot_compare_lod_level_warp,pixel_aot_compare_lod_bias_warp)ctest --preset release --no-tests=error -R '^pixel_aot_compare_lod_' -V-> 4/4 passedAdapters (
debug_layer=enabled,debug_errors=0 debug_warnings=0):AMD Radeon RX 7900 XTX(vendor=1002 device=744c, driver32.0.32029.2010)Microsoft Basic Render Driver(vendor=1414 device=008c, driver10.0.26100.9818)Imported from R0Y00/Xbox2Windows. Originally posted by stan495 on 2026-11-25T11:12:10Z.
Friendly ping on
bc49d1ec: all required CI checks are green (Assemble and translate gfx1013 fixtures,Run platform-independent Python checks on Linux, andBuild and test on Windows), the branch isMERGEABLE, andbc49d1echas Windowsdev/releaseverification, an RX 9070 XT hardware run, and a P1/P2-free re-review from @tedin7.@tedin7 @R0Y00 Please let me know if anything else is needed before an approval or merge.
Imported from R0Y00/Xbox2Windows. Originally posted by Makto94 on 2026-11-25T13:32:11Z.
Hardware run on head
bc49d1ec(NVIDIA; I did not see an NVIDIA report in this thread):levelandbiasboth pass.Environment: NVIDIA GeForce RTX 3070 Ti (
10de:2482), driver 32.0.16.2101, Windows 11 build 26300.9974, Debug build, dxc 1.9.2602.17, D3D12 debug layer enabled. The hardware run was serial on an idle machine.Command:
.\tools\dev.ps1; ctest --preset dev --no-tests=error -j1 -R '^pixel_aot_compare_lod_(level|bias)_hardware$' -Vgave 2/2 passed, 0 capability skips (77). Thebiastest was not skipped on this card.I also ran
-R '^pixel_aot_compare_lod_(level|bias)_warp$': 2/2 passed.Each log has 32
debug_errors=lines; none has a nonzero value. The RTX and WARP sequences ofpixels=/mismatches=lines are identical for both modes, andlevelandbiasmatch each other too.c_l/c_b8x8, operand-zeroc_l/c_b16x16, operand-zeroc_l_o/c_b_o8x8, operand-zeroc_l_o/c_b_o8x8, offset-zeroc_l_o/c_b_o16x16, operand-zeroc_l_o/c_b_o16x16, offset-zeroAll the unmutated and mutated-readback draws report 0 mismatches.
The 60 for
c_b_o16x16 offset-zero is the same on RTX, on WARP and in the RX 9070 XT report above (that report does not state its head). The test only compares the firstpixel_mismatchline of each negative control, not the count, so these counts are extra observations and not asserted.One card and one driver.
Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-25T22:57:44Z.
I resolved the current
tools/pixel_aot.pyconflict locally by keeping main’s per-dword load assignments alongside the new comparison-LOD/bias opcode match. On that candidate,ctest --preset release --no-tests=error -R '^pixel_aot_compare_(lod_(level|bias)|sample)_(warp|hardware)$' -Vpassed 6/6 on WARP and RTX 4060 Laptop, with zero skips. GitHub still shows this PR atbc49d1ec, but the fork branch advertises335d19f5, so I left the branch untouched. Please make sure the PR is tracking the intended focused branch. Once GitHub shows its current head, we can verify the combined hunk and its exact CI.