nir: Add store_agx intrinsic
authorAlyssa Rosenzweig <alyssa@rosenzweig.io>
Sat, 3 Dec 2022 22:10:13 +0000 (17:10 -0500)
committerMarge Bot <emma+marge@anholt.net>
Wed, 11 Jan 2023 20:36:51 +0000 (20:36 +0000)
This works like store_global, but lets us optimize address arithmetic. Like
load_agx, it is formatted to match the hardware semantic. We don't make use of
any clever formats in this series, though.

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20558>

src/compiler/nir/nir_intrinsics.py

index 679a1d2..e0e9c3c 100644 (file)
@@ -1616,7 +1616,7 @@ intrinsic("store_zs_agx", [1, 1, 1], indices=[BASE], flags=[])
 intrinsic("block_image_store_agx", [1, 1], bit_sizes=[32, 16],
           indices=[FORMAT, IMAGE_DIM], flags=[CAN_REORDER])
 
-# Formatted loads. The format is the pipe_format in memory (see
+# Formatted load/store. The format is the pipe_format in memory (see
 # agx_internal_formats.h for the supported list). This accesses:
 #
 #     address + extend(index) << (format shift + shift)
@@ -1624,13 +1624,16 @@ intrinsic("block_image_store_agx", [1, 1], bit_sizes=[32, 16],
 # The nir_intrinsic_base() index encodes the shift. The sign_extend index
 # determines whether sign- or zero-extension is used for the index.
 #
-# All loads on AGX uses these hardware instructions, so while these are
-# logically load_global_agx (etc), the _global is omitted as it adds nothing.
+# All loads and stores on AGX uses these hardware instructions, so while these are
+# logically load_global_agx/load_global_constant_agx/store_global_agx, the
+# _global is omitted as it adds nothing.
 #
 # src[] = { address, index }.
 load("agx", [1, 1], [ACCESS, BASE, FORMAT, SIGN_EXTEND], [CAN_ELIMINATE])
 load("constant_agx", [1, 1], [ACCESS, BASE, FORMAT, SIGN_EXTEND],
      [CAN_ELIMINATE, CAN_REORDER])
+# src[] = { value, address, index }.
+store("agx", [1, 1], [ACCESS, BASE, FORMAT, SIGN_EXTEND])
 
 # Logical complement of load_front_face, mapping to an AGX system value
 system_value("back_face_agx", 1, bit_sizes=[1, 32])