summaryrefslogtreecommitdiffstats
path: root/src/compiler/spirv/vtn_subgroup.c
diff options
context:
space:
mode:
authorJason Ekstrand <[email protected]>2017-08-29 10:21:31 -0700
committerJason Ekstrand <[email protected]>2018-03-07 12:13:47 -0800
commitb3a5b0f3fcac3ff722ea2727302aa6f53463d50a (patch)
tree45b9fc917d52021b269d97aa8fd91b4cf2153ccf /src/compiler/spirv/vtn_subgroup.c
parent493a165544e3430a9951dc960dd756d4e81bc0c9 (diff)
spirv: Add subgroup quad support
Reviewed-by: Lionel Landwerlin <[email protected]> Reviewed-by: Iago Toral Quiroga <[email protected]>
Diffstat (limited to 'src/compiler/spirv/vtn_subgroup.c')
-rw-r--r--src/compiler/spirv/vtn_subgroup.c26
1 files changed, 24 insertions, 2 deletions
diff --git a/src/compiler/spirv/vtn_subgroup.c b/src/compiler/spirv/vtn_subgroup.c
index b999439264b..1204c5945c8 100644
--- a/src/compiler/spirv/vtn_subgroup.c
+++ b/src/compiler/spirv/vtn_subgroup.c
@@ -252,6 +252,30 @@ vtn_handle_subgroup(struct vtn_builder *b, SpvOp opcode,
break;
}
+ 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);
+ break;
+
+ case SpvOpGroupNonUniformQuadSwap: {
+ unsigned direction = vtn_constant_value(b, w[5])->values[0].u32[0];
+ nir_intrinsic_op op;
+ switch (direction) {
+ case 0:
+ op = nir_intrinsic_quad_swap_horizontal;
+ break;
+ case 1:
+ op = nir_intrinsic_quad_swap_vertical;
+ break;
+ case 2:
+ op = nir_intrinsic_quad_swap_diagonal;
+ break;
+ }
+ vtn_build_subgroup_instr(b, op, val->ssa, vtn_ssa_value(b, w[4]), NULL);
+ break;
+ }
+
case SpvOpGroupNonUniformIAdd:
case SpvOpGroupNonUniformFAdd:
case SpvOpGroupNonUniformIMul:
@@ -268,8 +292,6 @@ vtn_handle_subgroup(struct vtn_builder *b, SpvOp opcode,
case SpvOpGroupNonUniformLogicalAnd:
case SpvOpGroupNonUniformLogicalOr:
case SpvOpGroupNonUniformLogicalXor:
- case SpvOpGroupNonUniformQuadBroadcast:
- case SpvOpGroupNonUniformQuadSwap:
default:
unreachable("Invalid SPIR-V opcode");
}