fix(shader): translate ds_min/max/add_src2_f32 through dsSrc2 #14247
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/14247"
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 boykopovar/AnyPS5. Originally posted by StarMrGamer on 2026-11-01T03:41:37Z.
What
ds_min_src2_f32,ds_max_src2_f32andds_add_src2_f32threw at translation because LDS float atomics did not model the f32 denormal mode. Since731575c802dsAtomicsetsflushDenormalsandflushDenormalResultsfromFLOAT_MODEbits 4 and 5.dsSrc2now sets the same two fields on theDS[A]atomic, and the three opcodes go through it withSharedAtomicFMin32,SharedAtomicFMax32andSharedAtomicFAdd32. The 64-bit, GDS andoffset1[7]forms still throw.Source of the semantics: the f32 src2 forms are taken to be the measured
ds_min_f32,ds_max_f32andds_add_f32(RDNA2, gfx1035, the oracle's hardware) applied toDS[A]andDS[B], which is how the integer src2 forms were done. No RDNA2 part has the src2 opcodes, so they are not measured on GFX10.1; the DS src2 entry indocs/dev/debt/shader.mdnow says so instead of giving the obsolete reason. This is the inference the question in #14089 asks about.agc_driver_lds_src2replaces the check that the f32 forms are refused with an execution check: for each op it stores the denormals0x1and0x2in LDS, runs the src2 form and the non-src2 form on them underFLOAT_MODE0x00 and 0x30, and requires that both forms give the same result in each mode and that the two modes differ (0 in both forms under 0x00; 1, 2 and 3 under 0x30). With the twodsSrc2flush lines removed, it fails withlds src2: min differs from ds_min_f32 in mode 0x00000000.#14085 rewords the same debt sentence; whichever lands second rebases.
Tested
Arch Linux, AMD Radeon 780M (RADV PHOENIX, Mesa 26.2.5), GCC 16.2.1, Release.
ctest --test-dir build -R 'agc_driver_lds_src2|agc_driver_lds_float_atomic_modes|agc_driver_lds_add_f32' -VwithVK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation,ANYPS5_NO_SHADER_CACHE=1andANYPS5_REQUIRE_VULKAN=1, onmaindc9dc7eaaeand on this branch on top of it: 3/3 passed on both, neither log containswas not found but was requested by env var VK_INSTANCE_LAYERS, and neither has anyVUID-line.ctest -R 'lds|shader|recompiler|ds_'withANYPS5_REQUIRE_VULKAN=1: 165/165 passed (2 skipped by the tests themselves).3741ca9327afterwards; the 53 commits in between change none of the files this PR touches.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
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-01T03:48:31Z.
Review: DISMISSED
Reviewed — changes requested
The implementation and author-reported test evidence are plausible, but the PR overlaps #14085 and does not record an agreed landing order as the repository requires.
What I ran
Reviewed head
0f8ec048111e27629b48385e46b4e98cf6b3eca3against PR base5d3ad2112f60f35d463dc2c9d96d1c9d35871015. The fresh merge preview against currentmain4a58bc29ad656ad7a54c1733b3b683e68b7ccf85was clean. Environment: Linux x86_64, Python 3.11.2, GCC 12.2.0. No build or compile was run.Results
git diff --checkand conventions/template4a58bc29ad656ad7a54c1733b3b683e68b7ccf85; no declared dependency found.--repoargument. No ABI change is claimed.LdsSrc2.cppmay be unregistered. This is a false positive: the execution tests are included through CMake'stests/execution/*.cppglob and registered byagc_add_default_test.eligibility,intake,report, andlibrary-portabilitypassed;conventions,labels, and the relinker/Windows build jobs were queued or in progress; Linux, register-context, and write-watch jobs were skipped. These statuses are hosted CI, not local runs.Raw output excerpts
Precheck:
Fresh stack check:
ABI audit:
Test-quality heuristic:
Negative control
lds src2: min differs from ds_min_f32 in mode 0x00000000; not independently run.Findings
Blocking: The PR changes the same DS src2 debt entry as open #14085. Its description says whichever lands second will rebase, but does not identify an agreed order, and its checklist says
Depends on: none. The repository contribution rule asks authors of overlapping PRs to agree which lands first and record that dependency. Please coordinate with #14085's author and record the agreed order in the checklist.Non-blocking: No implementation or test-source defect was found in the inspected changes.
Sources
Not verified
No local build, CTest, or GPU validation run was performed. The reported test runs are author-provided, not independently reproduced. Hosted CI was still in progress at the latest status refresh.
To get this to a good state
Coordinate with #14085's author and record which PR lands first. I will recheck the overlap and repeat applicable checks on the updated head.
Imported from boykopovar/AnyPS5. Originally posted by XairRrR on 2026-11-03T12:38:49Z.
Review: DISMISSED
Reviewed — changes requested
The translation change is consistent with
dsAtomic, but the rewrittenagc_driver_lds_src2fails on lavapipe, the device CI runs Vulkan tests on. Itsaddcheck requires a denormal f32 sum to be preserved, and whether that happens depends on the host.What I ran
Head
0f8ec048111e27629b48385e46b4e98cf6b3eca3merged with--no-ffintomain4f41f4c375f5abb487dbd184fbc150f31994d762(merged tree1ae4b75e47e4f689f8724fa932feacc07bd37f67). Debian 13 VM, 2× Xeon Gold 6136 (AVX2/FMA), GCC 14.2.0, Release, Vulkan on lavapipe (Mesa 26.1.6, LLVM 19). No GPU.Results
git diff --checkcheck_conventions.pyagc_driver_lds_src2. 7 known failures also fail onmain(agc_driver_f32_denormal_flush,agc_driver_division, …)agc_driver_lds_src2, rerun by melds src2: add ignores the f32 denormal modeagc_driver_lds_add_f32,agc_driver_lds_float_atomic_modesVUID-lines compared withmainagc_driver_lds_src2 output
The
min/maxchecks and every "src2 form equals the non-src2 form" check pass before the failing assertion. So on this device the src2 translation gives the same results asds_*_f32in both modes. Only the "the two modes differ" check foraddfails.Negative control
I did not run one myself. The test already fails with the PR's production code on this device, so a revert could not tell me anything more here. bunbeans2-arch reports a 5/5 failure on an RX 9070 XT with the two source files restored from
main, and the author reports a failure with the flush lines removed. I did not reproduce either.Findings
Blocking
agc_driver_lds_src2fails on lavapipe because it requires a denormal sum to be preserved —core/libs/prx/libSceAgcDriver/tests/execution/LdsSrc2.cpp:156-160.FLOAT_MODE0x30 the test expects0x1 + 0x2 = 0x3, and it requires that this differ from the result under 0x00. lavapipe flushes the denormal result of the SPIR-VOpFAdditself, so both modes give 0 and theRequirefails.main.HostDependentin LdsAddF32.cpp, which skips rows whose kept inputs or result are denormal. It then requires a minimum count of rows that do not depend on the host (line 177).addonly when the device keeps denormals: either probe the device the way the other tests do, or skip that assertion when the kept result is a denormal. Alternatively, choose operands whose flushed and kept results differ without a denormal result, for example a denormal input added to a normal value, so the difference shows up in a normal result.Non-blocking
None.
Regarding MarcZX10's blocking finding about the overlap with #14085: the author says #14085 dropped the DS src2 bullet. I cannot see #14085 from here, so I have not confirmed it.
Not verified
ds_*_f32.To get this to a good state
add"modes differ" assertion inCheckFloatsindependent of whether the host keeps denormals, asLdsAddF32.cppdoes.agc_driver_lds_src2on lavapipe as well as on hardware.