mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-02-01 19:50:25 +01:00
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> (cherry picked from commit8fa46b31a8)
This commit is contained in:
parent
87d89f480b
commit
3b86c96d22
2 changed files with 29 additions and 22 deletions
|
|
@ -224,7 +224,7 @@
|
|||
"description": "spirv: Handle constant cooperative matrices in OpCompositeExtract",
|
||||
"nominated": true,
|
||||
"nomination_type": 1,
|
||||
"resolution": 0,
|
||||
"resolution": 1,
|
||||
"main_sha": null,
|
||||
"because_sha": "b98f87612bc14fe88184dc099d9d4f8e6b3b23cb",
|
||||
"notes": null
|
||||
|
|
|
|||
|
|
@ -2278,31 +2278,38 @@ 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++) {
|
||||
vtn_fail_if(w[i] > type->length,
|
||||
"%uth index of %s is %u but the type has only "
|
||||
"%u elements", i - deref_start,
|
||||
spirv_op_to_string(opcode), w[i], type->length);
|
||||
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,
|
||||
spirv_op_to_string(opcode), w[i], type->length);
|
||||
|
||||
switch (type->base_type) {
|
||||
case vtn_base_type_vector:
|
||||
elem = w[i];
|
||||
type = type->array_element;
|
||||
break;
|
||||
switch (type->base_type) {
|
||||
case vtn_base_type_vector:
|
||||
elem = w[i];
|
||||
type = type->array_element;
|
||||
break;
|
||||
|
||||
case vtn_base_type_matrix:
|
||||
case vtn_base_type_array:
|
||||
c = &(*c)->elements[w[i]];
|
||||
type = type->array_element;
|
||||
break;
|
||||
case vtn_base_type_matrix:
|
||||
case vtn_base_type_array:
|
||||
c = &(*c)->elements[w[i]];
|
||||
type = type->array_element;
|
||||
break;
|
||||
|
||||
case vtn_base_type_struct:
|
||||
c = &(*c)->elements[w[i]];
|
||||
type = type->members[w[i]];
|
||||
break;
|
||||
case vtn_base_type_struct:
|
||||
c = &(*c)->elements[w[i]];
|
||||
type = type->members[w[i]];
|
||||
break;
|
||||
|
||||
default:
|
||||
vtn_fail("%s must only index into composite types",
|
||||
spirv_op_to_string(opcode));
|
||||
default:
|
||||
vtn_fail("%s must only index into composite types",
|
||||
spirv_op_to_string(opcode));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue