Repository navigation
fix(recompiler): fold chained immediate addends of image-table record offsets - #7325
Merged
oneandonlydean merged 1 commit intoOct 18, 2026
Merged
Conversation
… offsets SplitImmediateAddend peeled a single immediate operand off a T# dword's scalar offset. A title that loads a 32-byte record with two s_load_dwordx4, the second at soffset (first soffset + 16) where the first is (key << 5) + C, left IAdd32(key << 5, C) as the base of dwords 4-7, which never matched dword 0's base, and the image failed with "GetImageResource dword 0 is not a valid runtime value". Peel immediate IAdd32 operands until none is left and sum them modulo 2^32, as the scalar adds do. The chained offsets then reach the existing folded-addend path. verifyChainedTableOffset is the pointer table offset carry shader with the second offset chained off the first. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
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.
|
11 tasks done
11 tasks done
11 tasks done
oneandonlydean
pushed a commit
that referenced
this pull request
Oct 18, 2026
Main's #7325 adds verifyChainedTableOffset to the image table tests where this branch adds its selected-record tests. Keep both, with main's call after this branch's.
adriadam10
pushed a commit
that referenced
this pull request
Oct 19, 2026
#6243's new head merges main f1af6c5, whose #7325 adds verifyChainedTableOffset next to the selected-record tests this branch carries from #6243. That test reads the record words from the snapshot's shared word list; this branch keeps the words with each table's snapshot, so the merge reads them from the table it checks.
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
SplitImmediateAddend(ResourceTracker.cpp) peels one immediate operand off a T# dword's scalar offset, so a table recordwhose two
s_load_dwordx4use chained offsets is not recognized as a table. Demon's Souls (PPSA01342) loads each32-byte T# like this:
X = (key << 5) + CY = X + 16(the add is applied toX, not tokey << 5)For dwords 4-7 the old code peeled only the
+16and keptIAdd32(Shl, C)as the base, which never matched the base ofdword 0 (
Shl), soTryMakeTableColumngave up and the shader failed withGetImageResource dword 0 is not a valid runtime value.SplitImmediateAddendnow keeps peeling immediateIAdd32operands and sums them modulo 2^32, as the scalar adds do. Thesingle-add case is unchanged. Chained adds then reach the existing folded-addend path (
foldedAddend/foldedCarry),the same one used by pointer tables whose two loads add different immediates to one base.
New test
verifyChainedTableOffset(inagc_shader_memory_tests --bindless, ctestagc_shader_bindless) is theverifyPointerTableOffsetCarryshader with the second offset chained off the first (s_add_i32 s20, s19, 16instead ofs_add_i32 s20, s18, imm); it checks that the image is planned as a table with the expected column and that keys 3 and 5resolve the records written at those offsets.
Same idea as Mouhand-Kaddo's fork commit 29c7106 (never submitted as a pull request); written separately.
Tested
agc_shader_memory_tests --bindless: passes with the change. WithSplitImmediateAddendreverted tomain, the new testfails with the title's error:
GetImageResource dword 0 is not a valid runtime value; chain: LoadAddressU32@pc=0x0000003c(...).main(bd58561)with
GetImageResource dword 0 is not a valid runtime value(17 during boot, the rest after NEW GAME), includingshader 0x2489bea00 stage 1from Demon's Souls (PPSA01342): deterministic RenderJob deadlock on counter 0x0000000200553EE0 after main loop starts #7203's log.agc_shader_replay --prepare:main0/52 (all 52resource analysis failed: GetImageResource dword 0),this branch 52/52 prepared. The requests contain title code and are not attached.
goes through character creation and the intro into gameplay (Outpost Passage).
not established (see the discussion there). This PR fixes the shader preparation; the reporter could check whether the
deadlock remains.
python tools/check_conventions.py --base origin/main: all conventions checks passed.ctest(BUILD_TESTING=ON,--parallel 6) on the RX 6600 XT: 1386 passed, 17 skipped, 5 failed. None of the fivecomes from this change:
agc_driver_lds_mixed_width_atomics(lane 0 read 0xdeadbeefdeadbeef, expected 0x00001ffffffff000) andagc_driver_layered_volume_vertex_no_gpl(slice 1 texel (0, 0) channel 0 is 64, expected 255) fail the same way, threeruns out of three, with
ResourceTracker.cppfrommain; they fail on this GPU/driver without the change.guest_kernel_systimes out after renaming a subdirectory; it links only libkernel, libkernel_sys and libc.log_macros/log_macros_timestampsfail only in this local build: ccache'sbase_dirmakes__FILE__..\..\...\tests\LogMacros.cpp, so the line starts withtests\LogMacros.cppinstead oftests/LogMacros.cpp.Built from the absolute path, the same test passes.
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