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

Function ValidateVectorTimesScalar

source/val/validate_arithmetics.cpp:243–268  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

241}
242
243spv_result_t ValidateVectorTimesScalar(ValidationState_t& _,
244 const Instruction* inst) {
245 const spv::Op opcode = inst->opcode();
246 const uint32_t result_type = inst->type_id();
247 if (!_.IsFloatVectorType(result_type) &&
248 !_.IsFloatCooperativeVectorNVType(result_type))
249 return _.diag(SPV_ERROR_INVALID_DATA, inst)
250 << "Expected float vector type as Result Type: "
251 << spvOpcodeString(opcode);
252
253 const uint32_t vector_type_id = _.GetOperandTypeId(inst, 2);
254 if (result_type != vector_type_id)
255 return _.diag(SPV_ERROR_INVALID_DATA, inst)
256 << "Expected vector operand type to be equal to Result Type: "
257 << spvOpcodeString(opcode);
258
259 const uint32_t component_type = _.GetComponentType(vector_type_id);
260
261 const uint32_t scalar_type_id = _.GetOperandTypeId(inst, 3);
262 if (component_type != scalar_type_id)
263 return _.diag(SPV_ERROR_INVALID_DATA, inst)
264 << "Expected scalar operand type to be equal to the component "
265 << "type of the vector operand: " << spvOpcodeString(opcode);
266
267 return SPV_SUCCESS;
268}
269
270spv_result_t ValidateMatrixTimesScalar(ValidationState_t& _,
271 const Instruction* inst) {

Callers 1

ArithmeticsPassFunction · 0.85

Calls 8

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

Tested by

no test coverage detected