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

Function ValidateCooperativeMatrixLength

source/val/validate_memory.cpp:2401–2429  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2399}
2400
2401spv_result_t ValidateCooperativeMatrixLength(ValidationState_t& state,
2402 const Instruction* inst,
2403 bool is_khr,
2404 uint32_t operand_index = 2) {
2405 const spv::Op opcode = inst->opcode();
2406 // Result type must be a 32-bit unsigned int.
2407 const uint32_t result_type_id = inst->type_id();
2408 if (!state.IsIntScalarTypeWithSignedness(result_type_id, 0) ||
2409 state.GetBitWidth(inst->type_id()) != 32) {
2410 return state.diag(SPV_ERROR_INVALID_ID, inst)
2411 << "The Result Type of Op" << spvOpcodeString(opcode) << " <id> "
2412 << state.getIdName(inst->id())
2413 << " must be OpTypeInt with width 32 and signedness 0.";
2414 }
2415
2416 auto type_id = inst->GetOperandAs<uint32_t>(operand_index);
2417 auto type = state.FindDef(type_id);
2418 if (is_khr && type->opcode() != spv::Op::OpTypeCooperativeMatrixKHR) {
2419 return state.diag(SPV_ERROR_INVALID_ID, inst)
2420 << "The type in Op" << spvOpcodeString(opcode) << " <id> "
2421 << state.getIdName(type_id)
2422 << " must be OpTypeCooperativeMatrixKHR.";
2423 } else if (!is_khr && type->opcode() != spv::Op::OpTypeCooperativeMatrixNV) {
2424 return state.diag(SPV_ERROR_INVALID_ID, inst)
2425 << "The type in Op" << spvOpcodeString(opcode) << " <id> "
2426 << state.getIdName(type_id) << " must be OpTypeCooperativeMatrixNV.";
2427 }
2428 return SPV_SUCCESS;
2429}
2430
2431spv_result_t ValidateCooperativeMatrixLoadStoreNV(ValidationState_t& _,
2432 const Instruction* inst) {

Callers 1

MemoryPassFunction · 0.85

Calls 9

spvOpcodeStringFunction · 0.85
GetBitWidthMethod · 0.80
diagMethod · 0.80
getIdNameMethod · 0.80
FindDefMethod · 0.80
opcodeMethod · 0.45
type_idMethod · 0.45
idMethod · 0.45

Tested by

no test coverage detected