fix(recompiler): defer the TYPE check of a guarded read-only static V# #6412
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/6412"
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 fdfawef324 on 2026-10-15T14:15:59Z.
What
A guarded read-only static V# of nonzero TYPE currently rejects a whole compute dispatch during capture even when no lane runs its load. This change captures that descriptor with a status and faults only an active lane that executes the invalid load, using the existing InvalidDescriptor completion contract.
Eligibility remains limited to compute shaders without LDS/shared accesses or barriers, plain DWORD loads under changed EXEC, no continue-block load, and the BDA fault ABI. Stores, atomics, scalar/formatted/typed reads and entry-EXEC loads retain capture rejection. Valid descriptors keep existing completion and recipe paths; invalid captured descriptors force fault polling and prevent resource reuse/moved-buffer recipes. MarcZX10's fragment/Kena follow-up #7689 addresses #5879 separately and lists this PR as a dependency; it is not included here.
This rebase retains main's SharedValues/table memo, buffer extents, depth-remap plan and serializer fields. It moves the cache to format 41 (pinned main 40), serializes bufferExtent before bufferDescriptorStatus, and preserves all ten shader-key flag vectors including samplerCoordinatesIgnored before the added descriptor-status block. Active invalid-TYPE hardware behavior remains unmeasured and documented as debt.
Nearby #6177 has a source-supported future-composition risk: its robust-direct fast path can evaluate a faulting descriptor outside the active-lane guard. This is not a reproduced defect in #6177 alone. Combining the branches must retain that guard or exclude deferred descriptors from the fast path and rerun skipped/taken fixtures in robust mode. Proposed order is this PR first; coordination is pending, so this update is a draft. No combined build or landing-order agreement is claimed. Other shared cache/reuse changes must retain the descriptor status in identity and the deferred-fault nonreuse guards.
Tested
Exact candidate
c050c17557af9c9dd4275b97c8adcb9586a66c5con pinned main676d423968a1a8fcc79c6247020ce22090a8e0d4, Windows Server 2025 10.0.26100, MinGW-w64 GCC Release-O3.Nine CPU/mock CTest registrations passed in 14.83 seconds:
agc_shader_memory,agc_shader_bindless,agc_shader_deferred_static_planning_reads,agc_shader_disk_cache,agc_shader_control_flow(ordinary, iteration-selection-off and forced-fallback),agc_driver_key_miss, andagc_driver_graphicsincluding BdaResources mocks. No case skipped. All twelve requested targets complete in Release-O3; the final incremental continuation passed in 93.29 seconds after a preserved 900-second capped partial chunk. The integrated disk-cache test also passed separately before the full build, confirming source version9a919d1fcfb2ebe4, format 41 and all 17 plan round trips. CPU checks and the continuation used the independently reviewed and runtime-probed four-core CPU partition with the same 4 GiB job cap; this is not a title speed measurement.The actual-header Windows layout probe reports ShaderInfo 24 fields, BufferResource 13, ImageResource 39, DescriptorBinding 680 bytes, ShaderInvocation 208 bytes and RecompileResult 480 bytes. It is separate from the integrated codec and runtime checks, and is not a Linux execution result. Conventions and diff checks pass against the pinned base.
Independent adversarial source review passed at this exact head after checking all24 source pins and the complete rebase range diff. The prior published head
9585842dbpassed nine CPU/mock and eight managed-slot Vulkan registrations; those are historical after this rebase. Original selective CPU red controls are also historical and were not rerun on this head. Synthetic project fixtures are retained; no game shader payload is attached.Demon's Souls (PPSA01342 #1283) motivated the static-descriptor investigation. The previous public body at
6b9410b92bbd9d74bf3f32ebbbd2b91a0be08f18records a historical offline comparison on mainb3f9f89e62979d7328ff0dec2d14b006f8c2c0ab: main refused capture, while an earlier PR stack materialized successfully in three runs. That report does not record the full integration-stack head, and used a replay-tool option from #5959 that is not part of this PR. It is historical preparation/materialization evidence, not current-head or GPU verification. No request or shader payload is attached.Current-head managed-slot Vulkan checks passed all eight registrations / seven unique executables in 20.65 seconds without skips: guarded_null_pointer, bda_device, bda_span_reads, buffer_descriptor_runtime, gated_dispatch_capture (ordinary and short-timeout), loop_ending_exits and subvector_loop. ANYPS5_REQUIRE_VULKAN=1 was set; exact runtime hashes were verified before and after. The guarded fixture exercised skipped/taken unsupported static-TYPE reads and the expected InvalidDescriptor reason8 completion faults. A clean merge into later main
72a3d9f2a49dwas checked separately; that merged tree was not executed. No current title milestone or performance improvement is claimed.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)c050c1755Vulkan8 verification; historical results qualified above)🤖 Generated with Claude Code
Co-Authored-By: Codex [email protected]
Imported from boykopovar/AnyPS5. Originally posted by fdfawef324 on 2026-10-16T19:53:46Z.
We rebased this PR onto
mainc84249186. The old head was 6e89aba9e; the new head is 6b9410b92, the three original commits plus one new one on top.ShaderDiskCache.cppand onedocs/dev/ARCHITECTURE.mdline. Nothing else changed in the three commits; the cache format stays at 37 (mainis still at 36).fix(agc): label the buffer descriptor status word in shader key diffs: this PR adds a word per binding to the content key (the buffer descriptor status count and entries), andLabelShaderKeydid not know about it, so a key diff (APS5_TRACE_RESOURCE_KEY_MISSES) read every later binding from the wrong offset. The parser now labels the word andtests/KeyMiss.cppbuilds its keys like the real layout.agc_driver_key_missfailed without the parser change (equal keys were not comparable) and passes with it. Diagnostics only; nothing in the shader or the cache changed.Tests, CPU:
agc_shader_memory,agc_shader_deferred_static_planning_reads,agc_shader_disk_cache,agc_shader_control_flow(3 variants) andagc_driver_key_misspass, andtools/check_conventions.py --base upstream/mainpasses. With the capture deferral, the planning-only skip or the disk-cache fields reverted, the matching tests fail again.GPU, on the RTX 3060 (driver 591.86, Windows Server 2025), run on the build of 677b9af40 (before the label commit, which touches no GPU path):
agc_driver_guarded_null_pointer,agc_driver_graphics,agc_driver_bda_device,agc_driver_bda_span_reads(4 of 4) andagc_driver_buffer_descriptor_runtime,agc_driver_gated_dispatch_capture,agc_driver_gated_dispatch_capture_short_timeout,agc_driver_loop_ending_exits,agc_driver_subvector_loop(5 of 5) pass.AI-assisted: yes
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-17T02:34:13Z.
Coordination question from #5879: the Kena capture is a fragment-stage case with stale, unwritten user-data registers; #6412 is explicitly compute-only and its current eligibility excludes pixel programs. I found no other open PR that defers this path. If #6412 lands, would you prefer a separate follow-up to extend the planner/materializer/fault handling to fragment shaders, or are you already considering that scope? I will avoid opening overlapping work until the boundary is clear. The fragment case would need its own regression for an inactive guarded read and an active read that faults, and must preserve the current failure behavior for stores/atomics and unsupported formats.
Imported from boykopovar/AnyPS5. Originally posted by fdfawef324 on 2026-10-18T23:00:57Z.
Please keep the fragment-stage/Kena case from #5879 as a separate follow-up. #6412 remains compute-only: changed-EXEC plain buffer loads, no LDS/barrier, and the existing BDA fault and dispatch-reuse restrictions. I am keeping that eligibility boundary while rebasing this PR.
You can proceed with the fragment work independently. It needs its own active/inactive-lane and completion-fault coverage; the compute tests here do not establish fragment behavior.
AI-assisted: yes
Imported from boykopovar/AnyPS5. Originally posted by fdfawef324 on 2026-10-18T23:31:49Z.
Rebased the compute-only change onto
fc623324a; exact head9585842db6b7d62a387fe7d696652fef69050513. The serializer retains current main fields, uses cache format 39, and the shader-key diagnostic preserves all ten existing flag vectors before descriptor status. Eligibility, EXEC guarding, fault completion, planning-only reads and nonreuse/recipe exclusions remain unchanged.Fresh results: all twelve Release targets built, nine CPU/mock CTests passed in 19.35 seconds, and eight real Vulkan registrations passed in 24.39 seconds with Vulkan required and no skips. The latter includes skipped/taken invalid static-TYPE loads and expected fault completion. Root hash-checked the exact executables and runtime dependencies before and after. Conventions pass and the merge into main
84c1a4d9ais clean. Tests ran on the pinned candidate, not the merge tree. Older red controls and offline preparation evidence remain historical; there is no new title or performance measurement.@MarcZX10, fragment-stage/Kena #5879 remains a separate follow-up as discussed. The PR is a draft while the #6177 shared-area landing order is coordinated; that future fast-path composition must preserve active-lane evaluation of the faulting descriptor. No combined runtime result is claimed.
AI-assisted: yes.
Co-Authored-By: Codex [email protected]
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-18T23:44:51Z.
I opened #7689 as the separate fragment-stage follow-up for #5879, as you suggested. It adds fragment active/inactive EXEC coverage. I listed #6412 as a dependency because the descriptor-fault API and completion path share implementation points; after #6412 merges, I will rebase the fragment change and preserve the cache format version.
Imported from boykopovar/AnyPS5. Originally posted by fdfawef324 on 2026-10-19T05:23:08Z.
Rebased the five-commit stack onto pinned main
676d423968a1a8fcc79c6247020ce22090a8e0d4asc050c17557af9c9dd4275b97c8adcb9586a66c5c. The conflict resolution retains current buffer extents, SharedValues/table memo and depth-remap fields, adds the deferred status after bufferExtent, keeps all ten shader-key flag vectors, and advances the disk cache to format 41. Compute eligibility, InvalidDescriptor completion, nonreuse/recipe exclusions and planning-only behavior remain unchanged.Nine CPU/mock CTest registrations passed in 14.83 seconds:
agc_shader_memory,agc_shader_bindless,agc_shader_deferred_static_planning_reads,agc_shader_disk_cache,agc_shader_control_flow(ordinary, iteration-selection-off and forced-fallback),agc_driver_key_miss, andagc_driver_graphicsincluding BdaResources mocks. No case skipped. All twelve requested targets complete in Release-O3; the final incremental continuation passed in 93.29 seconds after a preserved 900-second capped partial chunk. The integrated disk-cache test also passed separately before the full build, confirming source version9a919d1fcfb2ebe4, format 41 and all 17 plan round trips. CPU checks and the continuation used the independently reviewed and runtime-probed four-core CPU partition with the same 4 GiB job cap; this is not a title speed measurement.Current-head managed-slot Vulkan checks passed all eight registrations / seven unique executables in 20.65 seconds without skips: guarded_null_pointer, bda_device, bda_span_reads, buffer_descriptor_runtime, gated_dispatch_capture (ordinary and short-timeout), loop_ending_exits and subvector_loop. ANYPS5_REQUIRE_VULKAN=1 was set; exact runtime hashes were verified before and after. The guarded fixture exercised skipped/taken unsupported static-TYPE reads and the expected InvalidDescriptor reason8 completion faults. A clean merge into later main
72a3d9f2a49dwas checked separately; that merged tree was not executed. No current title milestone or performance improvement is claimed.@MarcZX10, thanks for keeping the fragment follow-up in #7689 separate and recording the dependency. This update remains a draft while the future composition with #6177 is coordinated: its robust-direct path must preserve the active-lane guard or exclude deferred descriptors, with skipped/taken robust-mode fixtures when the branches combine. No combined build or landing-order agreement is claimed.
Co-Authored-By: Codex [email protected]
Imported from boykopovar/AnyPS5. Originally posted by DavidAmsellem on 2026-10-19T17:22:11Z.
First AMD-on-Linux (RADV) run of this PR (and the first non-NVIDIA one, as far as I can see). Merged onto
maindbac9fa15(clean merge), built in full and compared with the samemain, on the same machine.AMD Radeon RX 7900 XT (RADV NAVI31, gfx1100), Mesa 25.2.8, Linux Mint 22.3 (Ubuntu 24.04 base), kernel 7.0.0-38, GCC 13.3, Release.
Full suite (
ANYPS5_REQUIRE_VULKAN=1 ctest -j8): 1639/1641 with this PR, against 1638/1640 onmain. The failures are the same two on both, so this PR adds none:agc_driver_image_table_vouched_lookups(#7766, fixed by #7916) andagc_driver_guest_memory_lifetime(#7784).The new
agc_shader_deferred_static_planning_readspasses, and so do the touchedagc_driver_guarded_null_pointer,agc_driver_key_miss,agc_shader_memory,agc_shader_disk_cacheandagc_shader_disk_cache_large_file. No test is skipped or removed compared withmain.GPUs tested: AMD Radeon RX 7900 XT (RADV NAVI31, gfx1100), Mesa 25.2.8, Linux Mint 22.3 / kernel 7.0.0-38
AI-assisted: yes
Imported from boykopovar/AnyPS5. Originally posted by DavidAmsellem on 2026-10-19T18:17:00Z.
First AMD-on-Linux (RADV) run of this PR. Merged onto
maindbac9fa15(clean merge), built in full and compared with the samemain, on the same machine.AMD Radeon RX 7900 XT (RADV NAVI31, gfx1100), Mesa 25.2.8, Linux Mint 22.3 (Ubuntu 24.04 base), kernel 7.0.0-38, GCC 13.3, Release.
Full suite (
ANYPS5_REQUIRE_VULKAN=1 ctest -j8) atc2af8644f: 1639/1641 with this PR, against 1638/1640 onmain. The two failures are the same on both, so this PR adds none:agc_driver_image_table_vouched_lookups(#7766, fixed by #7916) andagc_driver_guest_memory_lifetime(#7784).The PR's new ctest entry,
agc_shader_deferred_static_planning_reads, runs and passes here. No other ctest entry is added, skipped or removed compared withmain.This checks correctness only; I did not measure performance.
GPUs tested: AMD Radeon RX 7900 XT (RADV NAVI31, gfx1100), Mesa 25.2.8, Linux Mint 22.3 / kernel 7.0.0-38
AI-assisted: yes
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-14T11:20:53Z.
Review: COMMENTED
Reviewed — comments
The cache documentation names format 37 while the implementation uses format 41; I did not complete the full changed-line review, so a formal decision is not justified.
What I ran
Reviewed head
c050c17557af9c9dd4275b97c8adcb9586a66c5cusingrepo_read.py. No tests or build commands were run; test results in the description are author-reported.Results
Negative control
No negative control was run.
Findings
Blocking
None identified in the portions inspected.
Non-blocking
docs/dev/ARCHITECTURE.md:114says this change is stored in cache format 37 and formats 31–36 are rejected, but the changed cache header setsFormatVersionto 41. Update the documentation to match the implementation. Cache header at the reviewed commitSources
Reviewed source excerpts at head
c050c17557af9c9dd4275b97c8adcb9586a66c5c:ResourceMaterializer.cpp,DescriptorBindingBuilder.cpp,SpirvRuntimeBuffer.cpp,ShaderAddressResources.cpp,ShaderResources.cpp, andShaderDiskCache.hpp. Prepared review documents read:description.md,commits.md,manifest.json,diff.patch, andREADME.md.Not verified
The full changed-line set was not read. In particular, I did not inspect all additions in
CMakeLists.txt,ShaderResources.hpp,BdaResources.cpp,KeyMiss.cpp,ShaderDiskCache.cpptests,ResourcePlan.hpp,Resources.hpp,ShaderInfo.hpp,ResourceMaterializer.hpp,Recompiler.cpp,Recompiler.hpp,ShaderDiskCache.cpp,ShaderDiskCache.hpp,StaticBufferDescriptorAbi.hpp, or the debt documentation.ShaderMemory.cppwas read only in the added test areas. The prepared bundle lists that file as excluded fromfiles/because it is too large, but it was available through the reader. Nofiles.jsonwas available through the reader.To get this to a good state
Nothing is required. Optional: correct the cache format numbers in
docs/dev/ARCHITECTURE.md:114.View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.