MCPcopy Create free account
hub / github.com/KhronosGroup/SPIRV-Tools / ValidateOuterProduct

Function ValidateOuterProduct

source/val/validate_arithmetics.cpp:463–501  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

461}
462
463spv_result_t ValidateOuterProduct(ValidationState_t& _,
464 const Instruction* inst) {
465 const spv::Op opcode = inst->opcode();
466 const uint32_t result_type = inst->type_id();
467 const uint32_t left_type_id = _.GetOperandTypeId(inst, 2);
468 const uint32_t right_type_id = _.GetOperandTypeId(inst, 3);
469
470 uint32_t res_num_rows = 0;
471 uint32_t res_num_cols = 0;
472 uint32_t res_col_type = 0;
473 uint32_t res_component_type = 0;
474 if (!_.GetMatrixTypeInfo(result_type, &res_num_rows, &res_num_cols,
475 &res_col_type, &res_component_type))
476 return _.diag(SPV_ERROR_INVALID_DATA, inst)
477 << "Expected float matrix type as Result Type: "
478 << spvOpcodeString(opcode);
479
480 if (left_type_id != res_col_type)
481 return _.diag(SPV_ERROR_INVALID_DATA, inst)
482 << "Expected column type of Result Type to be equal to the type "
483 << "of the left operand: " << spvOpcodeString(opcode);
484
485 if (!right_type_id || !_.IsFloatVectorType(right_type_id))
486 return _.diag(SPV_ERROR_INVALID_DATA, inst)
487 << "Expected float vector type as right operand: "
488 << spvOpcodeString(opcode);
489
490 if (res_component_type != _.GetComponentType(right_type_id))
491 return _.diag(SPV_ERROR_INVALID_DATA, inst)
492 << "Expected component types of the operands to be equal: "
493 << spvOpcodeString(opcode);
494
495 if (res_num_cols != _.GetDimension(right_type_id))
496 return _.diag(SPV_ERROR_INVALID_DATA, inst)
497 << "Expected number of columns of the matrix to be equal to the "
498 << "vector size of the right operand: " << spvOpcodeString(opcode);
499
500 return SPV_SUCCESS;
501}
502
503spv_result_t ValidateExtendedCarry(ValidationState_t& _,
504 const Instruction* inst) {

Callers 1

ArithmeticsPassFunction · 0.85

Calls 9

spvOpcodeStringFunction · 0.85
GetOperandTypeIdMethod · 0.80
GetMatrixTypeInfoMethod · 0.80
diagMethod · 0.80
IsFloatVectorTypeMethod · 0.80
GetDimensionMethod · 0.80
opcodeMethod · 0.45
type_idMethod · 0.45
GetComponentTypeMethod · 0.45

Tested by

no test coverage detected