fix(shader): plan an image table for a T# read at a first-lane offset #10228
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/10228"
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 mrfelek on 2026-10-23T14:52:57Z.
What
A compute shader that reads a T# with
s_buffer_load_dwordx8at an offset taken fromv_readfirstlane_b32, without a waterfall loop, stopped with "GetImageResource dword 0 is not a valid runtime value".TryMakeTableColumnonly accepted an offset of the formkey << n,key * n(+ n) or a masked one. In these shaders the lane value is scaled before the read (v_lshlrev_b32by 5, thenv_lshl_add_u32 x, 1, xfor a 96-byte record) and merged across divergent branches:A first-lane offset whose value is a known multiple of a dword stride is now planned as an unkeyed table column with that stride. The multiple is found through shifts, multiplies by immediates, sums of one scaled value (
(x << 1) + x), selects, Phis, and the selects that the read's active mask implies. A record whose words are not a T# faults when it is selected, as for other unkeyed tables.Tested
agc_shader_replay --prepare: 1,782,989 and 2,358,152 SPIR-V words).--bindlesscaseverifyImageTableFirstLaneScale: a 96-byte-stride table read throughv_lshlrev_b32+v_lshl_add_u32+v_readfirstlane_b32is planned with stride 96 and maps its four records. An unscaled first-lane offset is still refused. The case fails on main.ctest -R "agc_shader_|image_table"(40 tests): 33 pass, 7 Vulkan tests skip without a GPU.4997726a5vs this change, validation layer on, no shader cache, Vulkan required:ctest -R "agc_shader_|image_table"39/39 pass on both, nothing skipped, no VUID messages on either.verifyImageTableFirstLaneScalepasses with the change.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)Related: #7459 (same error; this covers the first-lane table form only). #8077, #6488 and the nested-table stack (#7395 ... #9790) were replayed on these two shaders and do not cover this form. #10193 (Celegans12, device image table) reads such a T# through the device image lookup only with
APS5_GPU_PATHandAPS5_KEEP_UNEXPECTED_DEVICE_IMAGES; with its defaults the refusal stays. This change plans it on the default CPU table path.AI-assisted. Tested by me on my own machine.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-23T14:54:59Z.
Review: CHANGES_REQUESTED
The current head is not ready for approval based on the repository's required checks:
conventionscheck fails on this exact head because the PR checklist still saysGPUs tested: TODO (NVIDIA RTX 3080 Ti, driver ..., Ubuntu 26.10). Please replace the placeholder with the actual vendor, model, driver and OS if that run has happened, or reportnot testedaccurately and leave the checklist consistent with the required GPU validation.CONTRIBUTING.mdrequires the focused tests on bothmainand the change withVK_LAYER_KHRONOS_validation,ANYPS5_NO_SHADER_CACHE=1,ANYPS5_REQUIRE_VULKAN=1andctest -V, including a comparison of newVUID-errors and the GPU details. The PR currently reports seven Vulkan tests skipped without a GPU and the required GPU run as TODO. Please add that comparison when available; the reported cloud resource-analysis tests and non-Vulkan test coverage are useful but do not exercise the required Vulkan validation path.I have not run the shader tests locally or independently validated the resource analysis, so this review is based on the hosted check and the stated test report.