aboutsummaryrefslogtreecommitdiffstats
path: root/src/compiler/nir
diff options
context:
space:
mode:
authorIan Romanick <[email protected]>2018-04-09 18:36:22 -0700
committerIan Romanick <[email protected]>2018-08-22 20:31:32 -0700
commit69ce7baa9e0dd598aad80f559719fdf14928038e (patch)
tree72d530a9944d217bfe31592d2fce38eef47871cd /src/compiler/nir
parenta390158d106554fb0ad970e03cc8a43b33d4af18 (diff)
nir: Add floating point atomic add instrinsics
Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Caio Marcelo de Oliveira Filho <[email protected]>
Diffstat (limited to 'src/compiler/nir')
-rw-r--r--src/compiler/nir/nir_intrinsics.py4
-rw-r--r--src/compiler/nir/nir_lower_atomics_to_ssbo.c1
-rw-r--r--src/compiler/nir/nir_lower_io.c3
3 files changed, 8 insertions, 0 deletions
diff --git a/src/compiler/nir/nir_intrinsics.py b/src/compiler/nir/nir_intrinsics.py
index d688a57181b..836cb34d74a 100644
--- a/src/compiler/nir/nir_intrinsics.py
+++ b/src/compiler/nir/nir_intrinsics.py
@@ -307,6 +307,7 @@ intrinsic("image_deref_atomic_or", src_comp=[1, 4, 1, 1], dest_comp=1)
intrinsic("image_deref_atomic_xor", src_comp=[1, 4, 1, 1], dest_comp=1)
intrinsic("image_deref_atomic_exchange", src_comp=[1, 4, 1, 1], dest_comp=1)
intrinsic("image_deref_atomic_comp_swap", src_comp=[1, 4, 1, 1, 1], dest_comp=1)
+intrinsic("image_deref_atomic_fadd", src_comp=[1, 4, 1, 1], dest_comp=1)
intrinsic("image_deref_size", src_comp=[1], dest_comp=0, flags=[CAN_ELIMINATE, CAN_REORDER])
intrinsic("image_deref_samples", src_comp=[1], dest_comp=1, flags=[CAN_ELIMINATE, CAN_REORDER])
@@ -357,6 +358,7 @@ intrinsic("deref_atomic_or", src_comp=[1, 1], dest_comp=1)
intrinsic("deref_atomic_xor", src_comp=[1, 1], dest_comp=1)
intrinsic("deref_atomic_exchange", src_comp=[1, 1], dest_comp=1)
intrinsic("deref_atomic_comp_swap", src_comp=[1, 1, 1], dest_comp=1)
+intrinsic("deref_atomic_fadd", src_comp=[1, 1], dest_comp=1)
# SSBO atomic intrinsics
#
@@ -383,6 +385,7 @@ intrinsic("ssbo_atomic_or", src_comp=[1, 1, 1], dest_comp=1)
intrinsic("ssbo_atomic_xor", src_comp=[1, 1, 1], dest_comp=1)
intrinsic("ssbo_atomic_exchange", src_comp=[1, 1, 1], dest_comp=1)
intrinsic("ssbo_atomic_comp_swap", src_comp=[1, 1, 1, 1], dest_comp=1)
+intrinsic("ssbo_atomic_fadd", src_comp=[1, 1, 1], dest_comp=1)
# CS shared variable atomic intrinsics
#
@@ -408,6 +411,7 @@ intrinsic("shared_atomic_or", src_comp=[1, 1], dest_comp=1, indices=[BASE])
intrinsic("shared_atomic_xor", src_comp=[1, 1], dest_comp=1, indices=[BASE])
intrinsic("shared_atomic_exchange", src_comp=[1, 1], dest_comp=1, indices=[BASE])
intrinsic("shared_atomic_comp_swap", src_comp=[1, 1, 1], dest_comp=1, indices=[BASE])
+intrinsic("shared_atomic_fadd", src_comp=[1, 1], dest_comp=1, indices=[BASE])
def system_value(name, dest_comp, indices=[]):
intrinsic("load_" + name, [], dest_comp, indices,
diff --git a/src/compiler/nir/nir_lower_atomics_to_ssbo.c b/src/compiler/nir/nir_lower_atomics_to_ssbo.c
index 6ebd3632288..72686624329 100644
--- a/src/compiler/nir/nir_lower_atomics_to_ssbo.c
+++ b/src/compiler/nir/nir_lower_atomics_to_ssbo.c
@@ -57,6 +57,7 @@ lower_instr(nir_intrinsic_instr *instr, unsigned ssbo_offset, nir_builder *b)
case nir_intrinsic_ssbo_atomic_xor:
case nir_intrinsic_ssbo_atomic_exchange:
case nir_intrinsic_ssbo_atomic_comp_swap:
+ case nir_intrinsic_ssbo_atomic_fadd:
case nir_intrinsic_store_ssbo:
case nir_intrinsic_load_ssbo:
case nir_intrinsic_get_buffer_size:
diff --git a/src/compiler/nir/nir_lower_io.c b/src/compiler/nir/nir_lower_io.c
index 9500a3091c4..3d4451e3602 100644
--- a/src/compiler/nir/nir_lower_io.c
+++ b/src/compiler/nir/nir_lower_io.c
@@ -280,6 +280,7 @@ lower_atomic(nir_intrinsic_instr *intrin, struct lower_io_state *state,
OP(atomic_and)
OP(atomic_or)
OP(atomic_xor)
+ OP(atomic_fadd)
#undef OP
default:
unreachable("Invalid atomic");
@@ -380,6 +381,7 @@ nir_lower_io_block(nir_block *block,
case nir_intrinsic_deref_atomic_xor:
case nir_intrinsic_deref_atomic_exchange:
case nir_intrinsic_deref_atomic_comp_swap:
+ case nir_intrinsic_deref_atomic_fadd:
/* We can lower the io for this nir instrinsic */
break;
case nir_intrinsic_interp_deref_at_centroid:
@@ -441,6 +443,7 @@ nir_lower_io_block(nir_block *block,
case nir_intrinsic_deref_atomic_xor:
case nir_intrinsic_deref_atomic_exchange:
case nir_intrinsic_deref_atomic_comp_swap:
+ case nir_intrinsic_deref_atomic_fadd:
assert(vertex_index == NULL);
replacement = lower_atomic(intrin, state, var, offset);
break;