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

Function ValidateMatrixTimesScalar

source/val/validate_arithmetics.cpp:270–295  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

268}
269
270spv_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
297spv_result_t ValidateVectorTimesMatrix(ValidationState_t& _,
298 const Instruction* inst) {

Callers 1

ArithmeticsPassFunction · 0.85

Calls 8

spvOpcodeStringFunction · 0.85
IsFloatMatrixTypeMethod · 0.80
diagMethod · 0.80
GetOperandTypeIdMethod · 0.80
opcodeMethod · 0.45
type_idMethod · 0.45
GetComponentTypeMethod · 0.45

Tested by

no test coverage detected