Repository navigation
test(agc): leave the LOD bias -192 case out on lavapipe before Mesa 26.1 - #27777
peacocksir wants to merge 1 commit into
Conversation
lavapipe before Mesa 26.1 lowers sampling with gradients to an explicit LOD and folds an instruction's minimum LOD into it, and llvmpipe adds the sampler's mipLodBias to that explicit LOD afterwards. That clamps before the bias, while Vulkan biases first, so the -192 case that separates the two orders fails there. Mesa 26.1 samples gradients directly. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
No actionable comments were generated in the recent review. Walkthrough
Change: Other Merge Risk:
|
arcwiser
left a comment
There was a problem hiding this comment.
Reviewed the complete one-file diff and the surrounding test flow at be27ea9776. The exception is limited to VK_DRIVER_ID_MESA_LLVMPIPE, parses only an identifiable Mesa major.minor, skips only versions before 26.1, and fails open (runs the original case) for other drivers or unparseable/future versions. I also checked the related NVIDIA report #23232; its failure was traced to the NVIDIA texture-quality override and is not hidden by this gate. Mesa 26.1's release notes list the cited "llvmpipe: pass explicit derivatives to sampling codegen" change.
Local validation: git diff --check and python tools/check_conventions.py --base f73d791b3df4dcaa773297a93f5ae2c062ee95a3 passed. I did not run the Vulkan test because this checkout has no configured build or suitable lavapipe test environment. The author's old-lavapipe focused and full-suite evidence covers the affected path, and the PR explicitly documents that limitation. I found no blocking issue.
AI-assisted review: yes (Codex); I independently inspected the diff, surrounding code, linked issue, overlapping PR diffs, and validation results.
MarcZX10
left a comment
There was a problem hiding this comment.
Reviewed — looks good
Nothing blocks this change; the points below are optional.
What I ran
Reviewed head be27ea9776021f63b42107c1067c666d941eaf69. No commands or tests were run. Read description.md, commits.md, manifest.json, diff.patch, and the changed file core/libs/prx/libSceAgcDriver/tests/execution/ImageSampleLodClamp.cpp at lines 360–432, plus targeted context from VulkanDevice.cpp and VulkanTestDevice.hpp. The sole changed file is listed as reviewed in manifest.json; no changed files were excluded.
Results
| Check | Result | Note |
|---|---|---|
| Diff and targeted source review | passed | One changed test file |
| Tests | not run | Author-reported runs were not independently verified |
Findings
Blocking
None.
Non-blocking
None.
Not verified
Tests, CI, build, real GPU behavior, Mesa lavapipe 26.1 or later, and console behavior were not verified. The author's reported test results and Mesa source analysis were not independently checked. files.json was not available through the review reader, so I relied on manifest.json for the changed-file inventory.
To get this to a good state
Nothing is required.
|
Windows / AMD at this head ( Setup:
The new skip only applies when AI-assisted: yes. |
|
Other open pull requests touch the same code. Merging one will break the other, or both implement the same thing. If this one builds on them, list them in Depends on.
Some comparisons could not be completed because a pull request conflicts with the base branch. Review these shared files manually before concluding that there is no overlap.
|
|
Tested on an Intel Arc B580 (Linux, Mesa ANV 26.2.5, not lavapipe). It passed here on Setup: Intel Arc B580 (BMG-G21,
Full sweep with validation: the same 9 failures as AI-assisted: yes (Claude Code) |
|
Thanks for running this. You're right: this check only covers lavapipe before Mesa 26.1, so on ANV the -192 case still fails, the same as on It looks like the same Mesa lowering. In Mesa 26.2.5, I'd rather not widen the skip to ANV in this PR. lavapipe is a CI device. On ANV this is a wrong mip level that real use would get, so a skip there would hide it rather than work around a test-only quirk. Fixing it would mean changing how the recompiler hands the S# bias and the clamp to the driver on such devices, which is a production change I can't test here. I can record it in |
|
Closing this: #24153 (merged) wraps the same -192 line and skips it when its I haven't checked whether that probe also skips the case on Rug-Ket's B580 run, which was on |
What
Since #23992 changed the clamped LOD case's bias from -96 to -192,
agc_driver_image_sample_lod_clamp_shader_lanefails on Mesa lavapipe 25.2.8:As #23992 says, -192 also separates clamp-then-bias from bias-then-clamp. Vulkan biases first: λ' = λbase + mipLodBias, then λ is clamped to max(minLod, the instruction's MinLod). Thread 5 has λbase -1.25 and an instruction clamp of 1, so Vulkan gives max(-2.0, 1) = 1, which is level 2 over BASE_LEVEL 1. lavapipe returns level 1, which is max(-1.25, 1) - 0.75 = 0.25.
lavapipe before Mesa 26.1 clamps first:
lvp_pipeline.crunsnir_lower_texwith.lower_txd = true(mesa-26.0.8, line 428).replace_gradient_with_lodinnir_lower_tex.cthen turns the gradient sample into an explicit LOD and folds the MinLod operand into it withnir_fmax.lp_build_lod_selector("sampler_lod_bias", mesa-25.2.8 lp_bld_sample.c, line 979).Mesa 56997723 ("llvmpipe: pass explicit derivatives to sampling codegen") set
.lower_txd = false, first released in 26.1.0. From then on llvmpipe adds the bias before the MinLod clamp (mesa-26.1.0 lp_bld_sample.c, lines 1252 and 1283). Mesa 25.2.8 and 26.0.8 both still lower.The test now leaves out only the -192 case when the device is llvmpipe (
VK_DRIVER_ID_MESA_LLVMPIPE) and its driver info names Mesa before 26.1. It printsskipped, the device does not apply the S# LOD bias before an instruction's LOD clamp ...with the driver info. Every other case runs as before. On any other device, or on lavapipe from 26.1 on, or if the version can't be read, the test runs exactly whatmainruns. No production code changes.On old lavapipe this also leaves out the case's
image_sample_landimage_sample_lzresults, which don't use a clamp and pass there.Checkchecks one case's results as a whole, so keeping them would mean restructuring it, which I didn't want to do for a driver bug.Tested
Ubuntu 24.04, kernel 6.8, GCC 13.3.0, Ninja, Release,
BUILD_TESTING=ON. Headbe27ea9776onmain580d1d3e12. GPU: Mesa lavapipe 25.2.8 (llvmpipe (LLVM 20.1.2, 256 bits), driver infoMesa 25.2.8-0ubuntu0.24.04.2 (LLVM 20.1.2)),/dev/udmabufavailable. Validation layer built from source, 1.4.335.Bisect: a first-parent bisect of
00b15fcbb0..afdd33906bon lavapipe, building onlyagc_driver_image_sample_lod_clamp_testsand running--shader-lanewith the test's environment, found #23992's mergea8654598c5as the first bad commit. Its parent2bbf80e857passes.Cause: I printed the level each of the 32 threads sampled for each of the case's 6 instructions on
main. All 192 results match clamp-then-bias. Only 115 match Vulkan's bias-then-clamp, and the 77 that don't are allimage_sample_d_cl,image_sample_clorimage_sample_d_cl_olanes with a clamp above λbase + bias. Every bias I tried from -160 to -256 fails on thread 5 the same way, and -96 passes, as onmainbefore #23992. That local print and the bias change are not part of this PR.Focused runs,
main's test file and this branch's in the same build tree, 3 runs each, withANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1 VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation VK_LOADER_DEBUG=layer ctest --test-dir build -R '^agc_driver_image_sample_lod_clamp' -V:agc_driver_image_sample_lod_clamp_shader_laneagc_driver_image_sample_lod_clampmainVK_EXT_image_view_min_lod)image sample LOD clamp tests passed in the shader-clamp laneEvery log shows
Insert instance layer "VK_LAYER_KHRONOS_validation", none showswas not found but was requested by env var VK_INSTANCE_LAYERS, and none containsVUID-.Full
ctest --test-dir build --output-on-failure -j6on this branch: 7124/7133 pass, and both LOD clamp tests are as in the table. The 9 failures are in other test executables. This PR's only changed file is compiled intoagc_driver_image_sample_lod_clamp_testsalone (build.ninja), so those executables are the same asmain's:agc_driver_gcn_multisample_color_fill: new onmainsince feat(agc): model the color memory of PS4 multisampled 2D surfaces #25802; lavapipe has no target with its sample count (the device cannot render color with the target's sample count). Not addressed here.agc_driver_image_d16_load: since fix(shader): pack D16 image reads toward zero and saturate 32-bit integers as RDNA2 does #22750, a 16_FLOAT signaling NaN comes back quieted on lavapipe. Not addressed here.agc_driver_image_filter_mode_three: lavapipe has no min/max filtering ofR8G8B8A8_UNORM; test(agc): check filter mode 3 on devices without min/max filtering #27671 fixes the test.agc_driver_scattered_runs: Mesa before 26 (fix(agc): probe sparse dma-buf binds before binding imports sparsely #21649).guest_json_copy_failure,guest_json_float_failure(SIGSEGV, 3/3 when rerun alone),guest_libressl3_object_header(timeout),nkwebkit_wtf(abort) andtools_headers_manifest: host-side tests unrelated to AGC.main's Linux CI job has not finished a run since #23992 merged. Its 51 push runs since then are cancelled (49) or queued (2).python3 tools/check_conventions.py --base origin/main: all checks passed.Not tested: any real GPU, Mesa lavapipe 26.1 or later, or any console. I relied on the Mesa sources linked above for 26.1, where the case runs as on
main. On any device other than llvmpipe, the new branch is never taken.Open #10867, #16953 and #24153 change the same lines of
main()in this file, and all of them are older than this PR. None of them changes what lavapipe does with the -192 case. Whichever merges first, I'll rebase this one onto it.Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file.mdfiles or images added to the repository (attach them to this PR)🤖 Generated with Claude Code
Summary by CodeRabbit