summaryrefslogtreecommitdiffstats
path: root/src/compiler/spirv
diff options
context:
space:
mode:
authorJason Ekstrand <[email protected]>2017-08-29 09:44:44 -0700
committerJason Ekstrand <[email protected]>2018-03-07 12:13:47 -0800
commit8256ee3fa363064ac3bd824d436aced81c61d23f (patch)
treedc34b0a3ed1f7f2cde738ad1ae7914bbc96aeca1 /src/compiler/spirv
parent149b92ccf20be11b9c655fe8fd2915c6b379412d (diff)
spirv: Add subgroup shuffle support
Reviewed-by: Lionel Landwerlin <[email protected]> Reviewed-by: Iago Toral Quiroga <[email protected]>
Diffstat (limited to 'src/compiler/spirv')
-rw-r--r--src/compiler/spirv/spirv_to_nir.c5
-rw-r--r--src/compiler/spirv/vtn_subgroup.c24
2 files changed, 28 insertions, 1 deletions
diff --git a/src/compiler/spirv/spirv_to_nir.c b/src/compiler/spirv/spirv_to_nir.c
index 1358d074993..b719ea831ff 100644
--- a/src/compiler/spirv/spirv_to_nir.c
+++ b/src/compiler/spirv/spirv_to_nir.c
@@ -3305,6 +3305,11 @@ vtn_handle_preamble_instruction(struct vtn_builder *b, SpvOp opcode,
spv_check_supported(subgroup_ballot, cap);
break;
+ case SpvCapabilityGroupNonUniformShuffle:
+ case SpvCapabilityGroupNonUniformShuffleRelative:
+ spv_check_supported(subgroup_shuffle, cap);
+ break;
+
case SpvCapabilityVariablePointersStorageBuffer:
case SpvCapabilityVariablePointers:
spv_check_supported(variable_pointers, cap);
diff --git a/src/compiler/spirv/vtn_subgroup.c b/src/compiler/spirv/vtn_subgroup.c
index 09e4e598b26..b999439264b 100644
--- a/src/compiler/spirv/vtn_subgroup.c
+++ b/src/compiler/spirv/vtn_subgroup.c
@@ -229,7 +229,29 @@ vtn_handle_subgroup(struct vtn_builder *b, SpvOp opcode,
case SpvOpGroupNonUniformShuffle:
case SpvOpGroupNonUniformShuffleXor:
case SpvOpGroupNonUniformShuffleUp:
- case SpvOpGroupNonUniformShuffleDown:
+ case SpvOpGroupNonUniformShuffleDown: {
+ nir_intrinsic_op op;
+ switch (opcode) {
+ case SpvOpGroupNonUniformShuffle:
+ op = nir_intrinsic_shuffle;
+ break;
+ case SpvOpGroupNonUniformShuffleXor:
+ op = nir_intrinsic_shuffle_xor;
+ break;
+ case SpvOpGroupNonUniformShuffleUp:
+ op = nir_intrinsic_shuffle_up;
+ break;
+ case SpvOpGroupNonUniformShuffleDown:
+ op = nir_intrinsic_shuffle_down;
+ break;
+ default:
+ unreachable("Invalid opcode");
+ }
+ vtn_build_subgroup_instr(b, op, val->ssa, vtn_ssa_value(b, w[4]),
+ vtn_ssa_value(b, w[5])->def);
+ break;
+ }
+
case SpvOpGroupNonUniformIAdd:
case SpvOpGroupNonUniformFAdd:
case SpvOpGroupNonUniformIMul: