Skip to content

compute: lower 2D a16 image_store with 32-bit data in direct compute - #3372

Merged
JohnConnorNPC merged 1 commit into
R0Y00:mainfrom
Leyukaka:compute-a16-image-store
Nov 29, 2026
Merged

JohnConnorNPC merged 1 commit into
R0Y00:mainfrom
Leyukaka:compute-a16-image-store

Conversation

@Leyukaka

Copy link
Copy Markdown
Collaborator

Refs #3224.

Change

The direct compute path refused a16 image stores unless the data was d16 (store && !half in image_io). A16 selects 16-bit addresses independently of the data width (RDNA 2 ISA, MIMG A16). A 2D store with 32-bit data now uses the same packed coordinates as an a16 load: x is the low half and y the high half of the first address VGPR. Graphics stages keep the refusal for 32-bit data.

Test

tests/native_image_store_a16_check.py (new):

  • native_image_store_a16_controls: one textureStore.f32 whose coordinates are and ..., 65535 and lshr ..., 16 of the same value. An a16 image_load_mip and an a16 3D image_store still refuse with packed image addressing.
  • native_image_store_a16_hardware / _warp: a 32-lane source-built program with EXEC 0x55555555, read back from an RGBA32_FLOAT texture (1,344 words).

ctest --test-dir out/build/release -R native_image_store_a16, Windows 11 build 26300, RTX 5080 driver 32.0.16.2101 (debug layer unavailable):

main f5a6f6ba this branch
_controls fails (packed image addressing) passes
_hardware fails 1,344 words matched
_warp skip 77 (wave32 fixture) skip 77

Swapping x and y in the unpacking fails both _controls and _hardware.

Broad selection (ctest -R "native_|startup_compute|compile_dxil|salu"): 560/566. The same 6 tests fail on main f5a6f6ba.

Measurement

On the 873 compute requests of the run in my #3224 census, 3 shaders (1,017 dispatches) move from packed image addressing to compiled, and none is lost. One publishes a runtime manifest; two stop at SRV kind typed_buffer_srv.

Not covered: write masks other than 15; a16 stores with LOD, on 1D, 3D or array images, or in graphics stages (the graphics refusal is not tested).

The direct path refused a16 image stores unless the data was d16. A16
selects 16-bit addresses independently of the data width, so a 2D store
with 32-bit data uses the same packed coordinates as an a16 load: x in
the low half of the address VGPR and y in the high half. Graphics keeps
its refusal.

@KelboLive KelboLive left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM — clean A16 image_store lowering for the direct compute path.

Changes the A16 guard from graphics_input && store && !half to graphics_input && store && !half (relaxed to allow compute-only A16 stores), with a clear ISA comment. The test fixture verifies coordinate packing, both refusal diagnostics, and hardware readback of RGBA32 texture words.

Ready to land.

@KelboLive KelboLive left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM — clean fix with thorough tests.

Adds graphics_input guard to the A16 image addressing refusal so graphics input A16 stores are properly rejected. Test fixture covers packed coordinate extraction, valid RGBA32 store, and both refusal diagnostics.

Ready to land.

@KelboLive KelboLive left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM — clean fix with thorough tests.

Adds graphics_input guard to the A16 image addressing refusal so graphics input A16 stores are properly rejected. Test fixture covers packed coordinate extraction, valid RGBA32 store, and both refusal diagnostics.

Ready to land.

@JohnConnorNPC
JohnConnorNPC merged commit d4fa16d into R0Y00:main Nov 29, 2026
5 checks passed

R0Y00 commented Dec 2, 2026

Copy link
Copy Markdown
Owner

Thanks, Leyukaka. This is in main now. The RTX 5080 readback matched all 1,344 words, and the swapped-coordinate control caught the X/Y regression. WARP reported a wave32 capability skip. The two shaders that still stop at SRV kind typed_buffer_srv are a separate follow-up under #3224.

R0Y00 commented Dec 3, 2026

Copy link
Copy Markdown
Owner

One follow-up on the two shaders that compiled after this change but stopped at SRV kind typed_buffer_srv: #3386 added published typed-buffer SRV bindings for 32-bit components, and #3460 added the corresponding in-process binding used by the default launch path. Those changes were verified with source-built fixtures. The remaining check under #3224 is to rerun the same two requests on current main and record whether each reaches a translated dispatch or hits another refusal.

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.

4 participants