spirv: Handle constant cooperative matrices in OpCompositeExtract

Fixes: b98f87612b ("spirv: Implement SPV_KHR_cooperative_matrix")
Reviewed-by: Konstantin Seurer <konstantin.seurer@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/29509>
This commit is contained in:
Faith Ekstrand
2024-04-02 18:49:22 -05:00
committed by Marge Bot
parent 7e6cd395c7
commit 8fa46b31a8

View File

@@ -2466,6 +2466,12 @@ vtn_handle_constant(struct vtn_builder *b, SpvOp opcode,
int elem = -1;
const struct vtn_type *type = comp->type;
for (unsigned i = deref_start; i < count; i++) {
if (type->base_type == vtn_base_type_cooperative_matrix) {
/* Cooperative matrices are always scalar constants. We don't
* care about the index w[i] because it's always replicated.
*/
type = type->component_type;
} else {
vtn_fail_if(w[i] > type->length,
"%uth index of %s is %u but the type has only "
"%u elements", i - deref_start,
@@ -2493,6 +2499,7 @@ vtn_handle_constant(struct vtn_builder *b, SpvOp opcode,
spirv_op_to_string(opcode));
}
}
}
if (opcode == SpvOpCompositeExtract) {
if (elem == -1) {