Skip to content

pvr/g9p: A9 compute storage images: 1D, layers, integer formats, atomics - #42

Merged
henrikklee merged 7 commits into
OrchardLinux:mainfrom
jeroentrappers:g9p-a9-storage-images
Dec 2, 2026
Merged

henrikklee merged 7 commits into
OrchardLinux:mainfrom
jeroentrappers:g9p-a9-storage-images

Conversation

@jeroentrappers

Copy link
Copy Markdown
Contributor

Compute storage images on the A9, step by step:

  • 1D textures and storage images as 2D ones of height 1 (their views are 2D views; the compiler takes y = 0 and moves a 1D array's layer to z).
  • Two storage images, and loads of 32-bit-channel formats (four raw dwords) and of 16-bit float formats (the narrow class's two dwords of f16, unpacked).
  • Loads from array layers and cube faces, with the third coordinate as stores already take it.
  • 8- and 16-bit integer formats (RGBA8/RG8/R8, RGBA16/RG16/R16, UINT and SINT): stores and loads through the f16 formats' packed form, four 16-bit lanes in two dwords (8-bit channels packed as bytes read back wrong; as 16-bit lanes they are right), loads zero- or sign-extended.
  • Image atomics (no A9 image atomic is known): on a 32-bit 2D, 2D-array or cube storage image, a device atomic on the texel's address: the image's base, plus layer * layer stride, plus its rectangular Morton index * 4 (the CPU transfers' twiddle order). The dispatch fills two new compute slots from the bound storage descriptor, the base address (G9P_IMAGE_BASE) and the address of an upload of {Morton bits, layer stride} (G9P_IMAGE_INFO).

Tested on an iPhone 6s (S8003): GLES3.1 image_load_store of the sample +27 (every 2D / 2D-array / cube atomic case passes; integer store/load and format-reinterpret cases), no GPU reset case by case, no regression in the Vulkan storage-image cases.

1D views were refused at descriptor time and 1D samples and image
accesses by the A9 backend, which takes 2D, 2D-array and cube only.
A 1D image is a 2D one of height 1, so describe 1D views as 2D views
and 1D array views as 2D array views, and lower the shaders to match:
nir_lower_tex's lower_1d for samples and fetches, and y = 0 (a 1D
array's layer moved to z) for image loads and stores.

Generated-by: LLM
Signed-off-by: Jeroen Trappers <jeroen.trappers@gmail.com>
The A9 compute path took one storage image and loaded R32_UINT only, so
every image load/store test in the CTS was refused: "more than one
storage image binding" (they read one image and write another) or
"image load format ... (R32_UINT only)".

- A load reads the texel's 32-bit words as they are, so R32_SINT,
  R32_FLOAT and the R32G32B32A32 formats load as R32_UINT does.
- Storage image i's descriptor words are DMAed to common 40 + 8 * i
  (pvr_arch_g5p_compute.c already uploads them so); two fit below the
  device fence at 56. The second shares 48-55 with a second sampled
  texture, which is refused in either order.

Tested on an iPhone 6s (S8003): dEQP-VK.image.load_store.* through
deqp-runner gives 24 passes (the R32 and RGBA32 formats on 2D, 2D
array, cube and cube array, single layer), where all were refused;
dEQP-VK.api.smoke.* stays 8/8.

Generated-by: LLM
Signed-off-by: Jeroen Trappers <jeroen.trappers@gmail.com>
Generated-by: LLM
Signed-off-by: Jeroen Trappers <jeroen.trappers@gmail.com>
An A9 compute image store already takes a third coordinate for an array
layer or a cube face (g5p_image_access(), three coordinates); a load
was refused for anything but a 2D image, so Zink's compute pipeline
failed. Loads take the third coordinate the same way.

On an iPhone 6s (S8003), GLES3.1 image_load_store 2d / 2d_array / cube
cases of the sample: 5 -> 14 of 46 pass, no GPU reset. What remains is
image atomics and stores of 8/16-bit integer formats.

Generated-by: LLM
Signed-off-by: Jeroen Trappers <jeroen.trappers@gmail.com>
A9 compute stores of RGBA8/RG8/R8 and RGBA16/RG16/R16 UINT and SINT
were refused ("no A9 pack path yet"). They take the packed store of
the f16 formats: four 16-bit lanes in two dwords, which the store
converts to the format's channels (8-bit channels packed as bytes read
back wrong, as 16-bit lanes they are right).

On an iPhone 6s (S8003): 5 more GLES3.1 image_load_store store cases
of the sample pass (rgba8i, rgba8ui, rgba16ui on 2D arrays, cubes and
3D slices), no regression in the 62 image_load_store cases.

Generated-by: LLM
Signed-off-by: Jeroen Trappers <jeroen.trappers@gmail.com>
Loads of RGBA8/RG8/R8 and RGBA16/RG16/R16 UINT and SINT storage images
were refused. They take the f16 formats' packed load: four 16-bit lanes
in two dwords, here zero- or sign-extended integers (missing channels
0, 0, 0, 1).

On an iPhone 6s (S8003): 4 more GLES3.1 image_load_store cases of the
sample pass (integer format_reinterpret and load_store), no regression
in the 62 image_load_store cases.

Generated-by: LLM
Signed-off-by: Jeroen Trappers <jeroen.trappers@gmail.com>
No A9 image atomic is known, so image atomics were refused. On a 32-bit
2D, 2D-array or cube storage image, an atomic is a device atomic (the
storage buffer atomics' form) on the texel's address: the image's base
plus layer * layer stride plus its rectangular Morton index * 4 (the
CPU transfers' twiddle order, g5p_twiddle2d()). The dispatch fills two
slots from the bound storage descriptor: the base address (G9P_IMAGE_BASE)
and the address of an upload of {Morton bits, layer stride}
(G9P_IMAGE_INFO), the stride from the layer's 4-byte texel chain as the
image layout computes it.

On an iPhone 6s (S8003): every 2D, 2D-array and cube image atomic case
of the GLES3.1 sample passes (9 more), no GPU reset, no regression in
the image_load_store and Vulkan storage-image cases.

Generated-by: LLM
Signed-off-by: Jeroen Trappers <jeroen.trappers@gmail.com>
@henrikklee
henrikklee merged commit b59644a into OrchardLinux:main Dec 2, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants