Resource tracking: support descriptor-table indices sourced from LoadBufferU32? #507

Open
opened 2026-11-26 09:24:14 +00:00 by github-bot · 3 comments
Owner

@⁠MehmetCambaz on GitHub · 2026-09-07 21:56 UTC · original

Description

While testing GTA V PS5 (PPSA04264) on current upstream, Story Mode deterministically fails in shader resource tracking with:

shader resource tracking:
hash=0x5e3e42fe237d3e16
stage=compute
pc=0x0000093c
GetBufferResource dword 0 is not a valid runtime value

The descriptor table itself resolves correctly. The failing part is the table index.

The relevant IR dependency chain is:

ReadConstBuffer
  -> ShiftLeftLogical32
     -> ReadFirstLane
        -> SelectU32
           -> LoadBufferU32

The index is therefore derived from a buffer load in the vector domain and then made wave-uniform through ReadFirstLane.

Current ValidateRuntimeValue rejects the graph because LoadBufferU32 is not one of the runtime-value forms it knows how to reconstruct.

Reproduction

Tested on:

  • GTA V PS5
  • Title ID: PPSA04264
  • content version: 01.010.002
  • upstream: 6aa6e390ee2930d7eeba7351c38bd342b783d933

The failure reproduced 3/3 times with the same:

  • shader hash
  • compute stage
  • PC
  • descriptor dword

The game reaches the fully rendered main menu first, then selecting Story Mode eventually hits this failure.

Relation to existing work

I also inspected the bounded-buffer/resource tracking work in #497.

Its BoundedReadProof appears to recognize the surrounding ReadConstBuffer / descriptor-table shape, but static inspection suggests the index eventually reaches FiniteMaximum, which has no LoadBufferU32 case.

I could not test the relevant #497 commits cleanly on current upstream because #497 is based on an older resource-tracking implementation and current upstream has since refactored the validator.

So I do not want to assume that extending FiniteMaximum or allowing LoadBufferU32 is necessarily the correct fix.

Question

Is a descriptor-table index sourced from LoadBufferU32 and then uniformized through ReadFirstLane intended to be supported by Kyty's current resource-tracking design?

If so, would the preferred direction be to extend the bounded-table/resource-materialization machinery for this case, or is there another architecture planned for runtime-loaded descriptor indices?

I can work on this if it fits the intended direction, but I wanted to confirm the design first rather than adding a speculative resource-tracking path.

**@⁠MehmetCambaz** on GitHub · 2026-09-07 21:56 UTC · [original](https://github.com/KytyPS5/KytyPS5/issues/507) ## Description While testing GTA V PS5 (`PPSA04264`) on current upstream, Story Mode deterministically fails in shader resource tracking with: ```text shader resource tracking: hash=0x5e3e42fe237d3e16 stage=compute pc=0x0000093c GetBufferResource dword 0 is not a valid runtime value ``` The descriptor table itself resolves correctly. The failing part is the table index. The relevant IR dependency chain is: ```text ReadConstBuffer -> ShiftLeftLogical32 -> ReadFirstLane -> SelectU32 -> LoadBufferU32 ``` The index is therefore derived from a buffer load in the vector domain and then made wave-uniform through `ReadFirstLane`. Current `ValidateRuntimeValue` rejects the graph because `LoadBufferU32` is not one of the runtime-value forms it knows how to reconstruct. ## Reproduction Tested on: - GTA V PS5 - Title ID: `PPSA04264` - content version: `01.010.002` - upstream: `6aa6e390ee2930d7eeba7351c38bd342b783d933` The failure reproduced 3/3 times with the same: - shader hash - compute stage - PC - descriptor dword The game reaches the fully rendered main menu first, then selecting Story Mode eventually hits this failure. ## Relation to existing work I also inspected the bounded-buffer/resource tracking work in #497. Its `BoundedReadProof` appears to recognize the surrounding `ReadConstBuffer` / descriptor-table shape, but static inspection suggests the index eventually reaches `FiniteMaximum`, which has no `LoadBufferU32` case. I could not test the relevant #497 commits cleanly on current upstream because #497 is based on an older resource-tracking implementation and current upstream has since refactored the validator. So I do **not** want to assume that extending `FiniteMaximum` or allowing `LoadBufferU32` is necessarily the correct fix. ## Question Is a descriptor-table index sourced from `LoadBufferU32` and then uniformized through `ReadFirstLane` intended to be supported by Kyty's current resource-tracking design? If so, would the preferred direction be to extend the bounded-table/resource-materialization machinery for this case, or is there another architecture planned for runtime-loaded descriptor indices? I can work on this if it fits the intended direction, but I wanted to confirm the design first rather than adding a speculative resource-tracking path.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 09:24:14 +00:00
Author
Owner

@⁠fxpw on GitHub · 2026-09-08 00:30 UTC · original

We investigated this during the Ghost of Yōtei bring-up. The missing case is not that LoadBufferU32 should become a generic compile-time resource root.

LoadBufferU32 can participate in descriptor-table selection, but only when resource tracking can prove all of the following:

  • the scalar-buffer address and read range are valid and readable;
  • the access is bounded by a finite selector/count/stride relationship;
  • the selector is wave-uniform where descriptor selection requires uniformity;
  • the snapshot does not overlap declared writable or otherwise mutable GPU memory;
  • the candidate and total-read budgets are respected;
  • descriptor values are materialized transactionally, without replacing the live GPU selector with one host-evaluated value.

For a valid bounded case, the implementation should enumerate the proven descriptor candidates, preserve the selector in the generated SPIR-V, and dispatch through a bounds-safe candidate lookup. In other words, LoadBufferU32 should be treated as a supported dependency inside an already-proven bounded descriptor graph, not as an unrestricted runtime-value source.

Arbitrary or unproven LoadBufferU32 usage should remain rejected, with the diagnostic identifying whether the failure is due to bounds, uniformity, memory availability/aliasing, budget limits, or an unsupported dependency structure.

This is part of the ongoing Yōtei bring-up, not a final implementation state. I'm currently working through the problems as they surface during bring-up, fixing them one by one rather than trying to solve everything with title-specific exceptions up front. Several shader pipeline and wave64 issues have already been cleared, and shaders b90e2024732c6111 and a7661ff4ea282325 now create and dispatch successfully. Work is continuing toward the first non-zero rendered frame.

Some of the current fixes are necessarily incremental while the actual failure modes are being identified. Once the bring-up path is understood, the relevant pieces should be refactored and generalized rather than left as accumulated special cases.

The current black-frame investigation is being handled separately through shared texture metadata and presentation-path fixes. It should not be solved by adding a title-specific or shader-specific exception to LoadBufferU32.

**@⁠fxpw** on GitHub · 2026-09-08 00:30 UTC · [original](https://github.com/KytyPS5/KytyPS5/issues/507#issuecomment-5577223944) We investigated this during the Ghost of Yōtei bring-up. The missing case is not that `LoadBufferU32` should become a generic compile-time resource root. `LoadBufferU32` can participate in descriptor-table selection, but only when resource tracking can prove all of the following: * the scalar-buffer address and read range are valid and readable; * the access is bounded by a finite selector/count/stride relationship; * the selector is wave-uniform where descriptor selection requires uniformity; * the snapshot does not overlap declared writable or otherwise mutable GPU memory; * the candidate and total-read budgets are respected; * descriptor values are materialized transactionally, without replacing the live GPU selector with one host-evaluated value. For a valid bounded case, the implementation should enumerate the proven descriptor candidates, preserve the selector in the generated SPIR-V, and dispatch through a bounds-safe candidate lookup. In other words, `LoadBufferU32` should be treated as a supported dependency inside an already-proven bounded descriptor graph, not as an unrestricted runtime-value source. Arbitrary or unproven `LoadBufferU32` usage should remain rejected, with the diagnostic identifying whether the failure is due to bounds, uniformity, memory availability/aliasing, budget limits, or an unsupported dependency structure. This is part of the ongoing Yōtei bring-up, not a final implementation state. I'm currently working through the problems as they surface during bring-up, fixing them one by one rather than trying to solve everything with title-specific exceptions up front. Several shader pipeline and wave64 issues have already been cleared, and shaders `b90e2024732c6111` and `a7661ff4ea282325` now create and dispatch successfully. Work is continuing toward the first non-zero rendered frame. Some of the current fixes are necessarily incremental while the actual failure modes are being identified. Once the bring-up path is understood, the relevant pieces should be refactored and generalized rather than left as accumulated special cases. The current black-frame investigation is being handled separately through shared texture metadata and presentation-path fixes. It should not be solved by adding a title-specific or shader-specific exception to `LoadBufferU32`.
Author
Owner

@⁠maximeallanic on GitHub · 2026-09-13 11:35 UTC · original

Another shape of the same limitation, from Ratchet & Clank: Rift Apart (PPSA01474), on top of #601:

shader resource tracking: hash=0xf8bcd41f5f36626d stage=compute pc=0x00000128
GetBufferResource dword 2 is not a valid runtime value

Here the rejected value is not a descriptor-table index: the shader builds the whole V# in VGPRs and makes it wave-uniform right before the store.

Decoded tail (full decode available if useful):

0x00000028: BUFFER_LOAD_DWORD v4, v0, s4, 0
0x00000094: V_CVT_F32_U32 v5, v6
0x000000a0: V_RCP_IFLAG_F32 v5, v5
0x000000ac: V_MUL_F32 v5, 0x4f7ffffe, v5
0x000000b4: V_CVT_U32_F32 v5, v5
0x000000c8: S_MUL_HI_U32 s7, vcc_lo, s4        ; integer fixup of the reciprocal
0x000000f0: V_ADDC_U32 v4, vcc_lo, s7, v4, s4
0x00000118: V_READFIRSTLANE_B32 s0, v2
0x0000011c: V_READFIRSTLANE_B32 s1, v1
0x00000120: V_READFIRSTLANE_B32 s2, v4         ; rejected dword
0x00000124: V_READFIRSTLANE_B32 s3, v3
0x00000128: BUFFER_STORE_DWORD v5, v0, s0, 0 offset:16 idxen

So dword 2 depends on a BUFFER_LOAD_DWORD (the LoadBufferU32 case of this issue) and on the usual emulated unsigned division. Two notes that may be useful:

  • FPRecipIFlag32 is missing from IsRuntimeUniformOp and from the host evaluator, while ConvertF32U32, FPMul32, ConvertU32F32 and FPTrunc32 are already there. Even with the LoadBufferU32 question settled, this chain would still be rejected on the reciprocal alone.
  • The sequence is self-correcting: the integer fixup after the reciprocal makes the final quotient exact, so a 1 ULP difference between a host reciprocal and the hardware one does not change the descriptor. That may matter when deciding what a host-side evaluation is allowed to model.

I am not proposing a patch for this one: it is your ongoing work, and the guidance above is clear that it should not become a per-title exception.

(Analysis done with AI assistance; I reproduced and verified the failure on my own machine.)

**@⁠maximeallanic** on GitHub · 2026-09-13 11:35 UTC · [original](https://github.com/KytyPS5/KytyPS5/issues/507#issuecomment-5653010893) Another shape of the same limitation, from Ratchet & Clank: Rift Apart (PPSA01474), on top of #601: ``` shader resource tracking: hash=0xf8bcd41f5f36626d stage=compute pc=0x00000128 GetBufferResource dword 2 is not a valid runtime value ``` Here the rejected value is not a descriptor-table index: the shader builds the whole V# in VGPRs and makes it wave-uniform right before the store. Decoded tail (full decode available if useful): ``` 0x00000028: BUFFER_LOAD_DWORD v4, v0, s4, 0 0x00000094: V_CVT_F32_U32 v5, v6 0x000000a0: V_RCP_IFLAG_F32 v5, v5 0x000000ac: V_MUL_F32 v5, 0x4f7ffffe, v5 0x000000b4: V_CVT_U32_F32 v5, v5 0x000000c8: S_MUL_HI_U32 s7, vcc_lo, s4 ; integer fixup of the reciprocal 0x000000f0: V_ADDC_U32 v4, vcc_lo, s7, v4, s4 0x00000118: V_READFIRSTLANE_B32 s0, v2 0x0000011c: V_READFIRSTLANE_B32 s1, v1 0x00000120: V_READFIRSTLANE_B32 s2, v4 ; rejected dword 0x00000124: V_READFIRSTLANE_B32 s3, v3 0x00000128: BUFFER_STORE_DWORD v5, v0, s0, 0 offset:16 idxen ``` So dword 2 depends on a `BUFFER_LOAD_DWORD` (the `LoadBufferU32` case of this issue) *and* on the usual emulated unsigned division. Two notes that may be useful: * `FPRecipIFlag32` is missing from `IsRuntimeUniformOp` and from the host evaluator, while `ConvertF32U32`, `FPMul32`, `ConvertU32F32` and `FPTrunc32` are already there. Even with the `LoadBufferU32` question settled, this chain would still be rejected on the reciprocal alone. * The sequence is self-correcting: the integer fixup after the reciprocal makes the final quotient exact, so a 1 ULP difference between a host reciprocal and the hardware one does not change the descriptor. That may matter when deciding what a host-side evaluation is allowed to model. I am not proposing a patch for this one: it is your ongoing work, and the guidance above is clear that it should not become a per-title exception. (Analysis done with AI assistance; I reproduced and verified the failure on my own machine.)
Author
Owner

@⁠MehmetCambaz on GitHub · 2026-09-16 10:01 UTC · original

Retested this on current main (e6156bef) with instrumentation inside the actual RuntimeValidator::Validate traversal. I need to correct my original diagnosis of this GTA V case.

The fatal is still:

hash=0x5e3e42fe237d3e16
stage=compute
pc=0x0000093c
GetBufferResource dword 0

The 5-argument LoadBufferU32 shape I reported originally is indeed present in the dependency graph, but it is not the first rejected value and the validator never reaches it in the current traversal.

ValidateArguments visits the SelectU32 predicate first. The relevant path is:

ReadConstBuffer
-> ShiftLeftLogical32
-> ReadFirstLane
-> SelectU32
-> INotEqual32
-> BitwiseAnd32
-> ShiftRightLogical32
-> CompositeExtractU32x4 <-- first rejection
-> Ballot
-> LaneId
-> LoadBufferU32(...) <-- not reached

CompositeExtractU32x4 is therefore the first actual rejection in this case. Continuing the dependency graph also exposes Ballot and LaneId before reaching the LoadBufferU32.

My earlier conclusion came from following graph connectivity rather than the validator's real operand traversal order, so the graph shape was correct but the causal attribution to LoadBufferU32 was not.

This seems consistent with the bounded-materialization direction described above: simply accepting LoadBufferU32 would not solve this GTA V case anyway, because the value being selected depends on a ballot-derived per-lane predicate before that load is even visited.

I also checked the current related work:

#500's lane-probe machinery is part of the dense indirect image path (LoadAddressU32 / address-resource / 32-byte descriptor shape), so it does not directly cover this 16-byte buffer case.
#558 would move this particular traversal past CompositeExtractU32x4, but Ballot, LaneId, and eventually the buffer dependency would still need a semantically valid treatment.

I haven't attempted a patch here because the current trace points to the broader bounded-resource/materialization problem rather than a safe isolated LoadBufferU32 acceptance rule.

I have the full current-main IR graph and per-node validator trace if useful.

**@⁠MehmetCambaz** on GitHub · 2026-09-16 10:01 UTC · [original](https://github.com/KytyPS5/KytyPS5/issues/507#issuecomment-5695644875) Retested this on current main (e6156bef) with instrumentation inside the actual RuntimeValidator::Validate traversal. I need to correct my original diagnosis of this GTA V case. The fatal is still: hash=0x5e3e42fe237d3e16 stage=compute pc=0x0000093c GetBufferResource dword 0 The 5-argument LoadBufferU32 shape I reported originally is indeed present in the dependency graph, but it is not the first rejected value and the validator never reaches it in the current traversal. ValidateArguments visits the SelectU32 predicate first. The relevant path is: ReadConstBuffer -> ShiftLeftLogical32 -> ReadFirstLane -> SelectU32 -> INotEqual32 -> BitwiseAnd32 -> ShiftRightLogical32 -> CompositeExtractU32x4 <-- first rejection -> Ballot -> LaneId -> LoadBufferU32(...) <-- not reached CompositeExtractU32x4 is therefore the first actual rejection in this case. Continuing the dependency graph also exposes Ballot and LaneId before reaching the LoadBufferU32. My earlier conclusion came from following graph connectivity rather than the validator's real operand traversal order, so the graph shape was correct but the causal attribution to LoadBufferU32 was not. This seems consistent with the bounded-materialization direction described above: simply accepting LoadBufferU32 would not solve this GTA V case anyway, because the value being selected depends on a ballot-derived per-lane predicate before that load is even visited. I also checked the current related work: #500's lane-probe machinery is part of the dense indirect image path (LoadAddressU32 / address-resource / 32-byte descriptor shape), so it does not directly cover this 16-byte buffer case. #558 would move this particular traversal past CompositeExtractU32x4, but Ballot, LaneId, and eventually the buffer dependency would still need a semantically valid treatment. I haven't attempted a patch here because the current trace points to the broader bounded-resource/materialization problem rather than a safe isolated LoadBufferU32 acceptance rule. I have the full current-main IR graph and per-node validator trace if useful.
This discussion has been locked. Commenting is limited to contributors.
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
github/KytyPS5--KytyPS5#507
No description provided.