[Mesa-dev] [PATCH v2 2/7] nir/spirv: propagate constants of GroupNonUniformQuad instructions, eliminate warning and fix breaks

Daniel Schürmann daniel.schuermann at campus.tu-berlin.de
Fri Mar 16 09:50:23 UTC 2018


Signed-off-by: Daniel Schürmann <daniel.schuermann at campus.tu-berlin.de>
---
 src/compiler/spirv/spirv_to_nir.c | 2 ++
 src/compiler/spirv/vtn_subgroup.c | 8 ++++++--
 2 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/src/compiler/spirv/spirv_to_nir.c b/src/compiler/spirv/spirv_to_nir.c
index f06dca90ef..4454c1aca3 100644
--- a/src/compiler/spirv/spirv_to_nir.c
+++ b/src/compiler/spirv/spirv_to_nir.c
@@ -3340,10 +3340,12 @@ vtn_handle_preamble_instruction(struct vtn_builder *b, SpvOp opcode,
 
       case SpvCapabilityGroupNonUniformQuad:
          spv_check_supported(subgroup_quad, cap);
+         break;
 
       case SpvCapabilityGroupNonUniformArithmetic:
       case SpvCapabilityGroupNonUniformClustered:
          spv_check_supported(subgroup_arithmetic, cap);
+         break;
 
       case SpvCapabilityVariablePointersStorageBuffer:
       case SpvCapabilityVariablePointers:
diff --git a/src/compiler/spirv/vtn_subgroup.c b/src/compiler/spirv/vtn_subgroup.c
index bd3143962b..73420b7e43 100644
--- a/src/compiler/spirv/vtn_subgroup.c
+++ b/src/compiler/spirv/vtn_subgroup.c
@@ -261,7 +261,9 @@ vtn_handle_subgroup(struct vtn_builder *b, SpvOp opcode,
    case SpvOpGroupNonUniformQuadBroadcast:
       vtn_build_subgroup_instr(b, nir_intrinsic_quad_broadcast,
                                val->ssa, vtn_ssa_value(b, w[4]),
-                               vtn_ssa_value(b, w[5])->def, 0, 0);
+                               vtn_ssa_value(b, w[5])->def,
+                               vtn_constant_value(b, w[5])->values[0].u32[0],
+                               0);
       break;
 
    case SpvOpGroupNonUniformQuadSwap: {
@@ -277,9 +279,11 @@ vtn_handle_subgroup(struct vtn_builder *b, SpvOp opcode,
       case 2:
          op = nir_intrinsic_quad_swap_diagonal;
          break;
+      default:
+         vtn_fail("Invalid constant value in OpGroupNonUniformQuadSwap");
       }
       vtn_build_subgroup_instr(b, op, val->ssa, vtn_ssa_value(b, w[4]),
-                               NULL, 0, 0);
+                               NULL, direction, 0);
       break;
    }
 
-- 
2.14.1



More information about the mesa-dev mailing list