feat(shader): translate the 64-bit and f32/f64 min/max DS src2 forms #5474
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/5474"
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 billythemenace2 on 2026-10-13T20:44:22Z.
What
Before: the GFX10.1-only
ds_*_src2_*64-bit forms (ds_{add,sub,rsub,inc,dec}_src2_u64,ds_{min,max}_src2_{i64,u64},ds_{and,or,xor}_src2_b64,ds_write_src2_b64,ds_{min,max}_src2_f64) were not decoded and threw "DS opcode is not supported".ds_min_src2_f32andds_max_src2_f32threw because the f32 denormal mode was not modelled.After: all of these are translated.
ds_add_src2_f32still throws, with a message that names the actual gap.DS[B]with the same dword offset as the 32-bit forms (B = A + 4 * sext(offset1[6:0]:offset0)) and updateDS[A]with the matching 64-bit LDS atomic, or a 64-bit write. ABthat is not 8-byte aligned reads as 0, and anAthat is not 8-byte aligned writes nothing.DS[B]as the data operand.Hardware semantics, measured on RDNA1 (gfx1010, AMD Radeon RX 5700 XT), which has the src2 opcodes. The kernels used the
tools/hw-oracletemplate, assembled with the Windows driver'samd_comgr_2.dlland launched with its HIP runtime. One wave32 workgroup filled 2 KiB of LDS, ran the instruction on the selected lanes, and dumped the LDS.DS[A] = op(DS[A], DS[B])with the offset above. This confirms the existing translation.Bas 0. AnAof 404 (4 mod 8) writes nothing.ds_{min,max}_src2_{f32,f64}equals plainds_{min,max}_{f32,f64}withDS[B]as data. That holds on all 196 operand pairs (zeros, denormals, ±1, infinities, quiet and signalling NaNs with payloads, max normal) in IEEE 0 and 1 with denormals flushed and kept: 1,568 rows. The plain f32 and f64 results also match the existing "LDS float atomics" debt entry, which was measured on RDNA2, on every row.ds_add_src2_f32: it equalsds_add_f32on all 784 rows. That instruction flushes both operands when the f32 denormal field flushes, which the translation does not model yet, so the src2 form keeps throwing.The measurement write-up is attached.
measurement-results-ds-src2-gfx1010.md
Known gap, recorded in technical debt and not changed here: on hardware, the active lanes run in lane order, and a lane's read of
Bsees the writes of lower lanes. The translation readsBfor every lane first, for the 32-bit forms too.Tested
agc_driver_lds_src2_widecovers the 15 64-bit forms and the f32 min/max forms on 32 lanes (integer edge cases, f64 and f32 specials), plus a misalignedBand a misalignedA. Before adding the expected values to the test, I ran the same kernel on the RX 5700 XT through the oracle and checked them against it: 0 mismatches. The test passes.agc_driver_lds_src2is updated: it now expects onlyds_add_src2_f32to be refused, and it passes.ctest -R "lds_|shader_memory|decoder": everything passes exceptagc_driver_lds_mixed_width_atomics, which also fails on unchangedmain(dacd78525) on this machine.python3 tools/check_conventions.py --base origin/mainpasses.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)Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-13T21:29:02Z.
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.
main)docs/dev/debt/shader.mdL106-107docs/dev/debt/shader.mdL106Imported from boykopovar/AnyPS5. Originally posted by xXPBSXx on 2026-10-14T00:37:58Z.
Windows test of #5474: Windows 10 (19045), MinGW-w64 GCC 15.2, Release,
ninja -j 4, ctest called directly, GPU selected by the execution tests: NVIDIA GeForce RTX 4080 SUPER (Selected GPUlog line; an AMD Radeon RX 6400 is present and was not selected). Tree:mainfeddf7f4c+ merge of PR headb6ecd7527e8150290139f30f42f49728f56efebc(local mergeecde0711f).agc_driver_lds_src2andagc_driver_lds_src2_wide: exit code 0 in 3 of 3 runs each (6 of 6). Logs:rtx5474_*_N.log.Not tested: that the new/changed test fails without the change (no baseline run for this PR), the AMD GPU, other ctest targets, Linux, a title run. (For comparison, the same-named tests with the head of #5498 crashed in the NVIDIA driver in 9 of 9 runs; see the separate report on #5498.)
AI-assisted (Claude Code).
Imported from boykopovar/AnyPS5. Originally posted by tibzejoker on 2026-10-14T01:17:27Z.
Intel run for this PR: Intel UHD Graphics 770 (Raptor Lake iGPU of an i9-13900K), driver 32.0.101.6129, Windows 11, MinGW-w64 GCC 15.2.0 Release, device picked with
ANYPS5_GPU=Intel, at headb6ecd7527.agc_driver_lds_src2_wideandagc_driver_lds_src2pass.ctest -R "agc_driver|agc_masked|agc_shader" -j4: no failures out of 387 (359 pass, 28 skipped). These are the same 28 skips asmainhas on this GPU (f64, 64-bit and float atomics, fp16 interpolation and dot, mesh, shader clock and the like, which it does not support), and no new ones.AI-assisted (Claude Code).
Imported from boykopovar/AnyPS5. Originally posted by xXPBSXx on 2026-10-14T01:50:09Z.
Correction to my Windows test above: I wrote that the GPU was shown by a
Selected GPUlog line, but that line was not in the ctest logs of those runs (ctest without-Vdoes not print the output of passing tests). Re-run withctest -Vonmain5a81f6085b0c18efed2125d857836c73acd129c6+ this PR's headb6ecd7527e8150290139f30f42f49728f56efebc: the log showsSelected GPU name=NVIDIA GeForce RTX 4080 SUPER, andagc_driver_lds_src2exits with code 0 (1 run).agc_driver_lds_src2_widewas not re-run with-V.AI-assisted (Claude Code).
Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-14T02:29:03Z.
Closing: no title is known to reach this. With the queue at 700+ open PRs, please hold off on new PRs that don't name a title needing the change until it's down. If a title stops on this on current main, reopen with the title ID and the log line.
Pull request closed