| 268 | } |
| 269 | |
| 270 | spv_result_t ValidateMatrixTimesScalar(ValidationState_t& _, |
| 271 | const Instruction* inst) { |
| 272 | const spv::Op opcode = inst->opcode(); |
| 273 | const uint32_t result_type = inst->type_id(); |
| 274 | if (!_.IsFloatMatrixType(result_type) && |
| 275 | !(_.IsCooperativeMatrixType(result_type))) |
| 276 | return _.diag(SPV_ERROR_INVALID_DATA, inst) |
| 277 | << "Expected float matrix type as Result Type: " |
| 278 | << spvOpcodeString(opcode); |
| 279 | |
| 280 | const uint32_t matrix_type_id = _.GetOperandTypeId(inst, 2); |
| 281 | if (result_type != matrix_type_id) |
| 282 | return _.diag(SPV_ERROR_INVALID_DATA, inst) |
| 283 | << "Expected matrix operand type to be equal to Result Type: " |
| 284 | << spvOpcodeString(opcode); |
| 285 | |
| 286 | const uint32_t component_type = _.GetComponentType(matrix_type_id); |
| 287 | |
| 288 | const uint32_t scalar_type_id = _.GetOperandTypeId(inst, 3); |
| 289 | if (component_type != scalar_type_id) |
| 290 | return _.diag(SPV_ERROR_INVALID_DATA, inst) |
| 291 | << "Expected scalar operand type to be equal to the component " |
| 292 | << "type of the matrix operand: " << spvOpcodeString(opcode); |
| 293 | |
| 294 | return SPV_SUCCESS; |
| 295 | } |
| 296 | |
| 297 | spv_result_t ValidateVectorTimesMatrix(ValidationState_t& _, |
| 298 | const Instruction* inst) { |
no test coverage detected