Repository navigation
test(shader): execute flat and global loads against hardware results - #547
Merged
Merged
Conversation
Co-Authored-By: Claude <noreply@anthropic.com>
Collaborator
|
Thanks. I checked all 64 rows against a byte-level model of the two kernels (llvm-mc gfx1013 disassembly) and every value matches. The model uses One note: the test runs with the shader cache off, so on CI's lavapipe it pays the roughly 70 s compile every time. That's fine under the default timeout, so I'm not asking for a change. Test only, no change to the translation. Ready to merge from my side. |
9 tasks done
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Test only, no recompiler change. Adds an execution test for the 8
flat_load_*and 8global_load_*opcodes (ubyte,sbyte,ushort,sshort,dword,dwordx2,dwordx3,dwordx4). No execution test covered them onmain:D16Memorycovers only the D16 forms, and the cache-bit forms are in #495. The test found no bug.It runs two compute shaders on 32 lanes over a guest block. Each lane loads from its own address, and checks 16 result dwords against values measured on hardware. The rows cover:
v32, s[8:9]) and with a 64-bit VGPR address (v[34:35], off)-2048,2047) and small negative ones (-1,-3,-6)2047)ushort, unaligneddwordtodwordx4)Encodings come from
llvm-mc -mcpu=gfx1013 -show-encoding.Behaviour measured on HW
The same two kernels ran on a Radeon 660M (gfx1035, same FLAT encoding as gfx1013). All 64 rows (32 global, 32 flat) match a byte-level model:
base + offset, with the global offset sign-extendedsbyte/sshortsign-extend,ubyte/ushortzero-extendThe expected values in the test are the hardware outputs.
The HW ran under amdgpu's default unaligned access mode. The test therefore pins unaligned reads as byte-exact, which is what
EmitBdaDwordReadsalready does through its byte path.Tested
Arch Linux: RADV (Radeon 660M), lavapipe with local Mesa, and lavapipe with CI's version (Ubuntu Mesa 25.2.8). New test
agc_driver_flat_global_loads_testspasses on all three.Negative checks: the test fails if
sbyte/sshortare zero-extendeddwordx3drops its last dwordMapping an unaligned span through the aligned dword path is not caught, because RADV and lavapipe both handle a misaligned dword
OpLoad.The test runs wave32 only. Each lane's load depends only on its own address, so wave64 adds no case. On CI's lavapipe the two dispatches take ~70 s with a cold shader cache, which is how CI runs: almost all of it is LLVM compiling the BDA lookups. With a warm cache it takes a few seconds, and under a second on RADV. Wave64 would double the time.
Full Release build (GCC) plus
ctest: 183/184. The one failure,agc_driver_pixel_helper_lanes, also fails onmainon local RADV since #305.Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed in TechnicalDebt.mdfiles or images added to the repository (attach them to this PR)