[Mesa-dev] [PATCH v3 01/19] nir: add load/store_global intrinsics
Karol Herbst
kherbst at redhat.com
Fri Mar 23 19:33:38 UTC 2018
OpenCL kernels have raw pointers to global memory, so we need
instructions to load/store in order to dereference these pointers.
In some ways similar to other load/store intrinsics, but rather
than taking an offset as a src argument, they take a raw pointer
value (which can be 32b or 64b depending on the memory model).
Signed-off-by: Rob Clark <robdclark at gmail.com>
Signed-off-by: Karol Herbst <kherbst at redhat.com>
---
src/compiler/nir/nir_intrinsics.h | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/src/compiler/nir/nir_intrinsics.h b/src/compiler/nir/nir_intrinsics.h
index 7b737559d5a..6597eaea87b 100644
--- a/src/compiler/nir/nir_intrinsics.h
+++ b/src/compiler/nir/nir_intrinsics.h
@@ -511,6 +511,8 @@ LOAD(shared, 1, 1, BASE, xx, xx, NIR_INTRINSIC_CAN_ELIMINATE)
/* src[] = { offset }. const_index[] = { base, range } */
LOAD(push_constant, 1, 2, BASE, RANGE, xx,
NIR_INTRINSIC_CAN_ELIMINATE | NIR_INTRINSIC_CAN_REORDER)
+/* src[] = { address }. No const_index */
+LOAD(global, 1, 0, xx, xx, xx, NIR_INTRINSIC_CAN_ELIMINATE)
/*
* Stores work the same way as loads, except now the first source is the value
@@ -532,8 +534,10 @@ STORE(per_vertex_output, 3, 3, BASE, WRMASK, COMPONENT, 0)
STORE(ssbo, 3, 1, WRMASK, xx, xx, 0)
/* src[] = { value, offset }. const_index[] = { base, write_mask } */
STORE(shared, 2, 2, BASE, WRMASK, xx, 0)
+/* src[] = { value, address }. const_index[] = { write_mask } */
+STORE(global, 2, 1, WRMASK, xx, xx, 0)
-LAST_INTRINSIC(store_shared)
+LAST_INTRINSIC(store_global)
#undef DEFINE_SYSTEM_VALUE
#undef INTRINSIC
--
2.14.3
More information about the mesa-dev
mailing list