<div dir="ltr">I'm not sure how I feel about having these as ALU operations. ALU operations are generally pure functions (with the exception derivative) that can be re-ordered at will. I don't really like breaking that. In fact, I'd almost be inclined to make derivatives intrinsics and just special-case them in constant folding. Thoughts?<br></div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Jun 5, 2017 at 12:22 PM, Connor Abbott <span dir="ltr"><<a href="mailto:cwabbott0@gmail.com" target="_blank">cwabbott0@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Signed-off-by: Connor Abbott <<a href="mailto:cwabbott0@gmail.com">cwabbott0@gmail.com</a>><br>
---<br>
src/compiler/nir/nir_<wbr>intrinsics.h | 14 ++++++++++++++<br>
src/compiler/nir/nir_opcodes.<wbr>py | 18 ++++++++++++++++--<br>
2 files changed, 30 insertions(+), 2 deletions(-)<br>
<br>
diff --git a/src/compiler/nir/nir_<wbr>intrinsics.h b/src/compiler/nir/nir_<wbr>intrinsics.h<br>
index 21e7d90..157df7f 100644<br>
--- a/src/compiler/nir/nir_<wbr>intrinsics.h<br>
+++ b/src/compiler/nir/nir_<wbr>intrinsics.h<br>
@@ -330,6 +330,20 @@ SYSTEM_VALUE(channel_num, 1, 0, xx, xx, xx)<br>
SYSTEM_VALUE(alpha_ref_float, 1, 0, xx, xx, xx)<br>
SYSTEM_VALUE(layer_id, 1, 0, xx, xx, xx)<br>
SYSTEM_VALUE(view_index, 1, 0, xx, xx, xx)<br>
+SYSTEM_VALUE(subgroup_<wbr>invocation, 1, 0, xx, xx, xx)<br>
+<br>
+<br>
+/* ARB_shader_ballot instructions */<br>
+<br>
+SYSTEM_VALUE(subgroup_eq_<wbr>mask, 1, 0, xx, xx, xx)<br>
+SYSTEM_VALUE(subgroup_ge_<wbr>mask, 1, 0, xx, xx, xx)<br>
+SYSTEM_VALUE(subgroup_gt_<wbr>mask, 1, 0, xx, xx, xx)<br>
+SYSTEM_VALUE(subgroup_le_<wbr>mask, 1, 0, xx, xx, xx)<br>
+SYSTEM_VALUE(subgroup_lt_<wbr>mask, 1, 0, xx, xx, xx)<br>
+<br>
+INTRINSIC(ballot, 1, ARR(0), true, 0, 0, 0, xx, xx, xx,<br>
+ NIR_INTRINSIC_CAN_ELIMINATE | NIR_INTRINSIC_CAN_REORDER |<br>
+ NIR_INTRINSIC_CROSS_THREAD)<br>
<br>
/* Blend constant color values. Float values are clamped. */<br>
SYSTEM_VALUE(blend_const_<wbr>color_r_float, 1, 0, xx, xx, xx)<br>
diff --git a/src/compiler/nir/nir_<wbr>opcodes.py b/src/compiler/nir/nir_<wbr>opcodes.py<br>
index be3ab6d..05a80b2 100644<br>
--- a/src/compiler/nir/nir_<wbr>opcodes.py<br>
+++ b/src/compiler/nir/nir_<wbr>opcodes.py<br>
@@ -120,8 +120,10 @@ def opcode(name, output_size, output_type, input_sizes, input_types,<br>
input_types, convergent, cross_thread,<br>
algebraic_properties, const_expr)<br>
<br>
-def unop_convert(name, out_type, in_type, const_expr):<br>
- opcode(name, 0, out_type, [0], [in_type], "", const_expr)<br>
+def unop_convert(name, out_type, in_type, const_expr, cross_thread=False,<br>
+ convergent=False):<br>
+ opcode(name, 0, out_type, [0], [in_type], "", const_expr, convergent,<br>
+ cross_thread)<br>
<br>
def unop(name, ty, const_expr, convergent=False, cross_thread=False):<br>
opcode(name, 0, ty, [0], [ty], "", const_expr, convergent, cross_thread)<br>
@@ -355,6 +357,18 @@ for i in xrange(1, 5):<br>
for j in xrange(1, 5):<br>
unop_horiz("fnoise{0}_{1}".<wbr>format(i, j), i, tfloat, j, tfloat, "0.0f")<br>
<br>
+# ARB_shader_ballot instructions<br>
+<br>
+opcode("read_invocation", 0, tuint, [0, 1], [tuint, tuint32], "", "src0",<br>
+ cross_thread=True)<br>
+unop("read_first_invocation", tuint, "src0", cross_thread=True)<br>
+<br>
+# ARB_shader_group_vote instructions<br>
+<br>
+unop("any_invocations", tbool, "src0", cross_thread=True)<br>
+unop("all_invocations", tbool, "src0", cross_thread=True)<br>
+unop("all_invocations_equal", tbool, "true", cross_thread=True)<br>
+<br>
def binop_convert(name, out_type, in_type, alg_props, const_expr):<br>
opcode(name, 0, out_type, [0, 0], [in_type, in_type], alg_props, const_expr)<br>
<span class="HOEnZb"><font color="#888888"><br>
--<br>
2.9.3<br>
<br>
______________________________<wbr>_________________<br>
mesa-dev mailing list<br>
<a href="mailto:mesa-dev@lists.freedesktop.org">mesa-dev@lists.freedesktop.org</a><br>
<a href="https://lists.freedesktop.org/mailman/listinfo/mesa-dev" rel="noreferrer" target="_blank">https://lists.freedesktop.org/<wbr>mailman/listinfo/mesa-dev</a><br>
</font></span></blockquote></div><br></div>