aboutsummaryrefslogtreecommitdiffstats
path: root/src/compiler
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
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')
-rw-r--r--src/compiler/shader_info.h1
-rw-r--r--src/compiler/spirv/spirv_to_nir.c3
-rw-r--r--src/compiler/spirv/vtn_subgroup.c26
3 files changed, 28 insertions, 2 deletions
diff --git a/src/compiler/shader_info.h b/src/compiler/shader_info.h
index b3b56fb273c..fd740e0d489 100644
--- a/src/compiler/shader_info.h
+++ b/src/compiler/shader_info.h
@@ -47,6 +47,7 @@ struct spirv_supported_capabilities {
bool shader_viewport_index_layer;
bool subgroup_ballot;
bool subgroup_basic;
+ bool subgroup_quad;
bool subgroup_shuffle;
bool subgroup_vote;
};
diff --git a/src/compiler/spirv/spirv_to_nir.c b/src/compiler/spirv/spirv_to_nir.c
index b719ea831ff..a8b545ec866 100644
--- a/src/compiler/spirv/spirv_to_nir.c
+++ b/src/compiler/spirv/spirv_to_nir.c
@@ -3310,6 +3310,9 @@ vtn_handle_preamble_instruction(struct vtn_builder *b, SpvOp opcode,
spv_check_supported(subgroup_shuffle, cap);
break;
+ case SpvCapabilityGroupNonUniformQuad:
+ spv_check_supported(subgroup_quad, cap);
+
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 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");
}