Repository navigation
feat(shader): read table-call callee addresses at run time for boot-stable linking - #24906
tablefrogpillow wants to merge 3 commits into
Conversation
MarcZX10
left a comment
There was a problem hiding this comment.
Reviewed — no blocking findings
The review is incomplete, so a formal approval is not justified; no blocking defect was verified in the portions read.
What I ran
- Inspected the prepared bundle for head
c4249c5d25b006dcdbd15070cbe4dd69b827c1aeand read relevant source ranges throughrepo_read.py. - No tests or build commands were run.
Results
| Check | Result | Note |
|---|---|---|
| Change and targeted source review | not run | Partial review only |
| Tests and build | not run | No commands run |
Findings
Blocking
None verified in the portions read.
Non-blocking
- The description notes that serializer version 64 is also used by #15343. Coordinate the version assignment before merging both changes; this review did not verify that PR's state.
Not verified
- Did not read every changed file or the complete contents of the changed files. Files read in targeted ranges:
core/shader/recompiler/ControlFlow/src/GraphBuilder.cpp,core/shader/recompiler/ControlFlow/include/ControlFlow/GraphBuilder.hpp,core/shader/recompiler/Translation/src/CompareInstructions.cpp,core/shader/recompiler/ControlFlow/src/RequestSerializer.cpp,core/shader/recompiler/Recompiler.cpp, andcore/libs/prx/libSceAgcDriver/Execution/src/Driver/Shaders/ShaderRegistry.cpp. - The other changed files listed in
manifest.jsonwere not read:core/libs/prx/libSceAgcDriver/Execution/include/Driver/Shaders/ShaderRegistry.hpp,core/libs/tests/ScalarCall.cpp,core/shader/recompiler/CacheKey.hpp,core/shader/recompiler/ControlFlow/include/ControlFlow/RequestSerializer.hpp,core/shader/recompiler/Recompiler.hpp,core/shader/recompiler/Translation/include/Translation/InstructionTranslator.hpp,core/shader/recompiler/Translation/include/Translation/TranslationContext.hpp,core/shader/recompiler/Translation/src/InstructionTranslator.cpp, andcore/shader/recompiler/tests/RequestSerializerTests.cpp. - Test claims in the PR description and in-game behavior were not independently verified.
To get this to a good state
Nothing is required. Optional: finish reviewing the unread changed files and confirm serializer version coordination with #15343 before merge.
Version 64 is now a valid serialization version (table-call literals), so the ShaderMemory unsupported-version check must probe 65 instead of 64. agc_shader_memory and agc_shader_memory_coherent_atomic_loads pass. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
MarcZX10
left a comment
There was a problem hiding this comment.
Reviewed — no blocking findings
Nothing blocks this change based on the source reviewed; the excluded test file and unrun checks leave the review incomplete, so this is a comment rather than an approval.
What I ran
- Reviewed head
82160181325fee239c61472330c0e1dd2d39d640usingrepo_read.py. - No build or test commands were run. No merged-preview check was run.
Results
| Check | Result | Note |
|---|---|---|
| Source review | passed | Core linking and translation paths inspected |
| Tests | not run | Author-reported tests were not independently run |
| Full changed-file coverage | not run | ShaderMemory.cpp was excluded from the review bundle |
Findings
Blocking
None identified in the code read.
Non-blocking
None.
Not verified
core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cppwas excluded because it was too large for the review folder; its changed line was not read.- No build, tests, physical console behavior, or in-game two-boot cache behavior were independently verified.
- Read changed lines and targeted context in
ShaderRegistry.hpp,ShaderRegistry.cpp,ScalarCall.cpp,CacheKey.hpp,GraphBuilder.hpp,RequestSerializer.hpp,GraphBuilder.cpp,RequestSerializer.cpp,Recompiler.cpp,Recompiler.hpp,InstructionTranslator.hpp,TranslationContext.hpp,CompareInstructions.cpp,InstructionTranslator.cpp, andRequestSerializerTests.cpp. Also read the review description, commits, manifest, diff, and README.ShaderMemory.cppwas the only changed file excluded by the bundle.
To get this to a good state
Nothing is required. Optional follow-up: independently run the stated checks and inspect the excluded ShaderMemory.cpp change before making a formal approval decision.
|
This PR and #23818 both claim request serialization version 64, with different layouts:
Each merges cleanly into For the record, an NVIDIA run of |
|
NVIDIA run of the Tested selection: no regression. Setup: RTX 3070 8 GB, NVIDIA 610.57.04, Ryzen 5 5600X, Debian 13 (kernel 6.12.115), GCC 13.3.0 Release, validation layer 1.4.335. Base is the merge-base 7ed059f, head is 8216018.
Every run selects the RTX 3070; every Vulkan test's log shows the layer inserted, none reports it missing, and no log has a AI-assisted: yes |
|
Windows data with AMD's own driver, which the runs so far did not include (RADV on Linux; NVIDIA on Linux and on Windows), plus an NVIDIA GPU, each with and without the Khronos validation layer. The 15 tests below pass on both GPUs in every run, on Setup
Tests: the 12 from your Tested section plus
Not run: a title. AI-assisted: yes (runs scripted with an AI assistant, on the machine above). |
Superseabas
left a comment
There was a problem hiding this comment.
Windows check of head 8216018132 with GCC 16 on an NVIDIA and an AMD GPU, merged onto main e493612311 (clean merge).
Setup: Windows 11 Home 10.0.26200, WinLibs GCC 16.2.0 (x86_64-ucrt-posix-seh, r3), Release full build, run from PowerShell; GPU tests with ANYPS5_REQUIRE_VULKAN=1, ANYPS5_NO_SHADER_CACHE=1 and VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation. GPUs, each picked with ANYPS5_GPU: NVIDIA GeForce RTX 5070 Ti (621.01) and the Ryzen 7 7700X's integrated AMD Radeon (1002:164e, Adrenalin 26.10.2). This was built together with #19100, which touches other files.
request_serializerandscalar_call: 2 of 2 onmainand with this PR, in 3 of 3 runs.- The description's GPU set plus
agc_shader_memoryandagc_shader_memory_coherent_atomic_loads, whose fixture this PR bumps (agc_driver_compute_table_calls,_nested_table_call,_fs_table_calls,agc_driver_split_table_call_run,agc_split_table_call,_full,_none,agc_driver_scalar_swappc,_fetch,agc_shader_replay_requests): every one passes on both GPUs, onmainand with this PR, in 3 of 3 runs. NoVUID-lines. - Red check: with
LinkCallsbaking the callee address again (const bool fromTable = false;),scalar_callfails, so its two-boot determinism check does catch an address-dependent link.
I read the ShaderMemory.cpp change the earlier review couldn't open: it's the one-line move of the unsupported-version example past 64 (8216018132).
The version-64 overlap with #23818 that Haembina raised still stands. Both are open, and each merges cleanly on its own, so whichever lands second needs 65.
AI-assisted: yes (Claude Code)
malekaifa
left a comment
There was a problem hiding this comment.
Reviewed exact head 82160181325fee239c61472330c0e1dd2d39d640 and all 16 changed-file patches.
The linked-table path now records the table entry provenance beside zero placeholders instead of baking absolute callee addresses into the linked code. Translation replaces only those annotated SOPC literal operands with runtime reads from the original descriptor/pointer/table entry; legacy/non-table callees keep their address literals. The provenance is owned, serialized, restored, and included in the recompile cache key, while split-table parts clear it. The scalar-call regression verifies that moving callees between boots leaves linked code and provenance identical, and a red control that bakes addresses again breaks that determinism check.
The exact head has terminal green hosted checks and independent Windows/Linux GPU coverage on NVIDIA and AMD with no validation errors. Superseabas also exercised the current head with a red fromTable=false control and approved it.
One integration constraint is intentionally still conditional: #23818 is also open and independently uses request format 64. Whichever PR lands second must rebase and assign its new layout version 65 (with fixtures updated); neither branch should pre-emptively bump while both are open.
No blocking finding on this exact head.
AI-assisted: yes
|
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.
|
|
@tablefrogpillow this head (8216018) fails agc_driver_split_table_call_driver,agc_driver_split_table_call_driver_cpu_rounds,agc_driver_split_table_call_driver_gpu_rounds when run alone on main 214d3c7: "[gpu] host imports at shutdown: 1 live (0.1 MiB); made 1 (0.1 MiB), refused 0 (0.0 MiB, 0 remembered), failed 0; by requester (made/refused/failed): map 0/0/0, build 1/0/0, access 0/0/0, join 0/0/0, s". I have held it; the hold lifts when a new head passes it. |
Superseabas
left a comment
There was a problem hiding this comment.
The hold reproduces on Windows on both vendors. My approval of 8216018132 on 11-22 predates these tests, so it doesn't cover current main.
Setup: Windows 11 Home 10.0.26200, WinLibs GCC 16.2.0 (x86_64-ucrt-posix-seh, r3), Release full build, run from PowerShell with ANYPS5_REQUIRE_VULKAN=1, ANYPS5_NO_SHADER_CACHE=1 and VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation. GPUs: NVIDIA GeForce RTX 5070 Ti (621.01) and the Ryzen 7 7700X's integrated AMD Radeon (1002:164e, Adrenalin 26.10.2). main c3aae2e8fb, and this head merged onto it (clean merge, built together with #24781 and #21948, which touch other files).
agc_driver_split_table_call_driver,_cpu_roundsand_gpu_rounds, each run alone 3 times: 3 of 3 onmain, and 0 of 3 with this PR, on both GPUs.- The rest of the earlier set (
request_serializer,scalar_call, the table-call and split-table-call tests,agc_shader_memory*) passes: 11 of 14 with this PR in 2 of 2 runs, only those three failing.
The assertion: the "host imports at shutdown" line is only the end-of-run statistics. The failure before it is
split table call driver: invocation 0 holds 0x9e3779b9, expected 0x9e3779be
and _gpu_rounds then misses its a batch of N rounds ran ... line.
Where the tests come from: efe46a01df added them, merged with #25848 (GPU-selected split table call rounds) on 11-24. So they're new on main since this PR's last runs, not something this PR changed.
A guess, not traced: the invocation is missing exactly the callee's part of the result. This PR links a table callee through a run-time literal (tableLiterals, filled per request in ShaderRegistry.cpp). A continued split part run through the driver's rounds may not get those literals, so its s_cmp against the callee address never matches.
AI-assisted: yes (Claude Code)
|
Follow-up to my comment above: the cause is confirmed, by code and by a probe build. The chain:
The probe:
The probe isn't a proposed fix, since it gives up the boot-stable link for split callees. It only shows the missing literals are the whole failure. A fix would carry each part's AI-assisted: yes (Claude Code) |
…tavi Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Rechecked against current Please rebase onto current main and preserve the existing version-64
#23818 currently merges cleanly against main by itself, but it must remain blocked until this dependency and the version sequence are resolved. Please do not merge either branch with the conflicting version-64 layout. |
malekaifa
left a comment
There was a problem hiding this comment.
Request changes on head 82160181325fee239c61472330c0e1dd2d39d640.
Current main already serializes splitState at version 64. This branch also assigns version 64 to linkedTableLiterals and does not carry main's splitState field/encoding, so it conflicts in RequestSerializer.hpp and RequestSerializer.cpp and cannot be merged without losing serialization compatibility.
For the agreed dependency order #24906 -> #23818, please rebase onto current main, preserve splitState at version 64, and move linkedTableLiterals to version 65. Then #23818 must be rebased on top and move verticesPerPrimitive to version 66. Update the compatibility fixtures and run the serializer round-trip/backward-compatibility tests on the stacked result before requesting re-review.
|
I investigated the reported split-table-call failure and prepared a tested successor: #28376. It carries LinkCalls table literals through both split and continuation programs into translation, keys cached parts by callee entry offset, and rebases the serializer change cleanly onto current main (v64 split-state payload, v65 linked-table literals). Validation: 15/15 focused tests passed on the NVIDIA RTX 5080 path and 7/7 table-call driver tests passed with the AMD-selected path. Please review #28376 as the replacement for this still-dirty branch. |
|
Follow-up recheck after main advanced: current main is |
|
Closing in favour of #28376, which supersedes this branch with the run-time linked-table-literals approach (v65) and is further along in review. No sense keeping two competing implementations of run-time table-call callee linking open — #28376 is the one to carry forward. Thanks @malekaifa. |
What
Boot-stable table-call linking, so the driver shader cache can hit across boots.
Authored by @Dark3581 (two commits, root-cause analysis in #24525); I rebased onto current
main, reconciled the serializer, and verified it on AMD hardware.Today
LinkCallsbakes the absolute callee address into the linked code as thes_cmp_lg_u32literal (GraphBuilder.cpp). The callee shaders move between boots, so the linked code, the SPIR-V and the pipeline differ every boot and the driver cache can never hit; large Unreal compute modules (1.2–2.6 M words) then rebuild cold on every launch.This change:
LinkCallswrites a0placeholder for each callee-address literal and records its provenance inGuestContext::linkedTableLiterals(table-entry offset + descriptor source: user-data descriptor, user-data/constant pointer, nested descriptor).CompareInstructions.cpp), and callees are ordered by table entry rather than by address.The linked module, SPIR-V and pipeline are then identical across boots, so the cross-process driver cache hits (measured elsewhere: 105 s cold → 217 ms warm once the module is identical).
Scope / honesty: this is the determinism half only. It is necessary but not sufficient to close #24525: even with a boot-stable module, the first encounter still compiles the 1.2–2.6 M-word module cold (105–1632 s), past Unreal's 120 s render-thread watchdog. Keeping the title under the watchdog on a cold cache (startup journal-replay warm path) is a separate follow-up. Not yet verified in game.
Serializer version: adds format version 64, written only when
linkedTableLiteralsis non-empty. This overlaps with #15343, which also uses version 64 — whichever lands second should take version 65. Flagged so they do not collide.Tested
Linux, AMD Vega 56 (RADV VEGA10, GCN5), Mesa 26.2.6. 12 related tests pass; the compute table-call GPU tests ran with
ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1 VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation, the loader confirmed inserting the validation layer, and none logged aVUID-error:request_serializer,scalar_call(determinism:LinkCallsof two different callee-address sets produces byte-identical code,tableLiteralsandfallbacks)agc_driver_compute_table_calls,agc_driver_compute_nested_table_call,agc_driver_compute_fs_table_calls(GPU, 0 validation errors)agc_shader_replay_requests,agc_driver_split_table_call_run,agc_split_table_call,agc_split_table_call_full,agc_split_table_call_none,agc_driver_scalar_swappc,agc_driver_scalar_swappc_fetchNot verified in game (see scope note). The two-boot module hash on a real RADV module is covered at unit level by
scalar_call; an end-to-end in-game two-boot hash still wants the title.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