<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Fri, Mar 16, 2018 at 2:50 AM, Daniel Schürmann <span dir="ltr"><<a href="mailto:daniel.schuermann@campus.tu-berlin.de" target="_blank">daniel.schuermann@campus.tu-berlin.de</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: Daniel Schürmann <<a href="mailto:daniel.schuermann@campus.tu-berlin.de">daniel.schuermann@campus.tu-<wbr>berlin.de</a>><br>
---<br>
src/compiler/spirv/spirv_to_<wbr>nir.c | 2 ++<br>
src/compiler/spirv/vtn_<wbr>subgroup.c | 8 ++++++--<br>
2 files changed, 8 insertions(+), 2 deletions(-)<br>
<br>
diff --git a/src/compiler/spirv/spirv_to_<wbr>nir.c b/src/compiler/spirv/spirv_to_<wbr>nir.c<br>
index f06dca90ef..4454c1aca3 100644<br>
--- a/src/compiler/spirv/spirv_to_<wbr>nir.c<br>
+++ b/src/compiler/spirv/spirv_to_<wbr>nir.c<br>
@@ -3340,10 +3340,12 @@ vtn_handle_preamble_<wbr>instruction(struct vtn_builder *b, SpvOp opcode,<br>
<br>
case SpvCapabilityGroupNonUniformQu<wbr>ad:<br>
spv_check_supported(subgroup_<wbr>quad, cap);<br>
+ break;<br>
<br>
case SpvCapabilityGroupNonUniformAr<wbr>ithmetic:<br>
case SpvCapabilityGroupNonUniformCl<wbr>ustered:<br>
spv_check_supported(subgroup_<wbr>arithmetic, cap);<br>
+ break;<br>
<br>
case SpvCapabilityVariablePointersS<wbr>torageBuffer:<br>
case SpvCapabilityVariablePointers:<br>
diff --git a/src/compiler/spirv/vtn_<wbr>subgroup.c b/src/compiler/spirv/vtn_<wbr>subgroup.c<br>
index bd3143962b..73420b7e43 100644<br>
--- a/src/compiler/spirv/vtn_<wbr>subgroup.c<br>
+++ b/src/compiler/spirv/vtn_<wbr>subgroup.c<br>
@@ -261,7 +261,9 @@ vtn_handle_subgroup(struct vtn_builder *b, SpvOp opcode,<br>
case SpvOpGroupNonUniformQuadBroadc<wbr>ast:<br>
vtn_build_subgroup_instr(b, nir_intrinsic_quad_broadcast,<br>
val->ssa, vtn_ssa_value(b, w[4]),<br>
- vtn_ssa_value(b, w[5])->def, 0, 0);<br>
+ vtn_ssa_value(b, w[5])->def,<br>
+ vtn_constant_value(b, w[5])->values[0].u32[0],<br></blockquote><div><br></div><div>quad_broadcast has no constant value index. See the comment below about NIR not respecting it for copies etc. If you want the constant value in your back-end, nir_src_as_const_value will get that for you rather handily.<br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
+ 0);<br>
break;<br>
<br>
case SpvOpGroupNonUniformQuadSwap: {<br>
@@ -277,9 +279,11 @@ vtn_handle_subgroup(struct vtn_builder *b, SpvOp opcode,<br>
case 2:<br>
op = nir_intrinsic_quad_swap_<wbr>diagonal;<br>
break;<br>
+ default:<br>
+ vtn_fail("Invalid constant value in OpGroupNonUniformQuadSwap");<br></blockquote><div><br></div><div>The breaks and this vtn_fail are all ok.<br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
}<br>
vtn_build_subgroup_instr(b, op, val->ssa, vtn_ssa_value(b, w[4]),<br>
- NULL, 0, 0);<br>
+ NULL, direction, 0);<br></blockquote><div><br></div><div>The quad operations, as defined in NIR, have no "direction" index. Sure, you can set the field in the data structure, but you're liable to have it go missing if you clone or [de]serialize the IR and not be respected for things such as CSE. If your back-end depneds on this being set, you're most likely going to run into weird bugs. Use the opcode instead.<br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
break;<br>
}<br>
<span class="HOEnZb"><font color="#888888"><br>
--<br>
2.14.1<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></div>