From 56d61d9a644a9f3f6be55a424fc911fef051d8b5 Mon Sep 17 00:00:00 2001 From: Alyssa Rosenzweig Date: Thu, 8 Jun 2023 09:24:13 -0400 Subject: [PATCH] nir: Add fence_{pbe,mem}_to_tex(_pixel)_agx intrinsics Read-after-write hazards require special handling on AGX, since image loads are implemented with texturing. Add intrinsics to handle these hazards. Signed-off-by: Alyssa Rosenzweig Part-of: --- src/compiler/nir/nir_intrinsics.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/compiler/nir/nir_intrinsics.py b/src/compiler/nir/nir_intrinsics.py index 1f77528..aa31c81 100644 --- a/src/compiler/nir/nir_intrinsics.py +++ b/src/compiler/nir/nir_intrinsics.py @@ -1749,6 +1749,19 @@ system_value("api_sample_mask_agx", 1, bit_sizes=[16]) # Loads the sample position array as fixed point packed into a 32-bit word system_value("sample_positions_agx", 1, bit_sizes=[32]) +# Image loads go through the texture cache, which is not coherent with the PBE +# or memory access, so fencing is necessary for writes to become visible. + +# Make writes via main memory (image atomics) visible for texturing. +barrier("fence_pbe_to_tex_agx") + +# Make writes from global memory instructions (atomics) visible for texturing. +barrier("fence_mem_to_tex_agx") + +# Variant of fence_pbe_to_tex_agx specialized to stores in pixel shaders that +# act like render target writes, in conjunction with fragment interlock. +barrier("fence_pbe_to_tex_pixel_agx") + # Intel-specific query for loading from the brw_image_param struct passed # into the shader as a uniform. The variable is a deref to the image # variable. The const index specifies which of the six parameters to load. -- 2.7.4