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

Function ValidateKernelDecl

source/val/validate_extensions.cpp:533–554  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

531}
532
533spv_result_t ValidateKernelDecl(ValidationState_t& _, const Instruction* inst) {
534 const auto decl_id = inst->GetOperandAs<uint32_t>(4);
535 const auto decl = _.FindDef(decl_id);
536 if (!decl || !spvIsExtendedInstruction(decl->opcode())) {
537 return _.diag(SPV_ERROR_INVALID_ID, inst)
538 << "Kernel must be a Kernel extended instruction";
539 }
540
541 if (decl->GetOperandAs<uint32_t>(2) != inst->GetOperandAs<uint32_t>(2)) {
542 return _.diag(SPV_ERROR_INVALID_ID, inst)
543 << "Kernel must be from the same extended instruction import";
544 }
545
546 const auto ext_inst =
547 decl->GetOperandAs<NonSemanticClspvReflectionInstructions>(3);
548 if (ext_inst != NonSemanticClspvReflectionKernel) {
549 return _.diag(SPV_ERROR_INVALID_ID, inst)
550 << "Kernel must be a Kernel extended instruction";
551 }
552
553 return SPV_SUCCESS;
554}
555
556spv_result_t ValidateArgInfo(ValidationState_t& _, const Instruction* inst,
557 uint32_t info_index) {

Calls 4

spvIsExtendedInstructionFunction · 0.85
FindDefMethod · 0.80
diagMethod · 0.80
opcodeMethod · 0.45

Tested by

no test coverage detected