From b9fe385d951fcca95e7f6febad8543ecdaed2a3d Mon Sep 17 00:00:00 2001 From: Eric Lunderberg Date: Thu, 24 Jun 2021 13:18:57 -0700 Subject: [PATCH] [Vulkan] Improved error message for extern calls passed to SPIR-V codegen. Previously, the codegen indicated that there was an extern call. Now, also indicate what that extern call is, to aid in debugging. --- src/target/spirv/codegen_spirv.cc | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/target/spirv/codegen_spirv.cc b/src/target/spirv/codegen_spirv.cc index 8245597fef8b..2628406f6f49 100644 --- a/src/target/spirv/codegen_spirv.cc +++ b/src/target/spirv/codegen_spirv.cc @@ -358,6 +358,12 @@ spirv::Value CodeGenSPIRV::VisitExpr_(const CallNode* op) { } else if (op->op.same_as(builtin::popcount())) { return builder_->MakeValue(spv::OpBitCount, builder_->GetSType(op->dtype), MakeValue(op->args[0])); + } else if (op->op.same_as(builtin::call_extern()) || + op->op.same_as(builtin::call_pure_extern())) { + ICHECK_GE(op->args.size(), 1U); + LOG(FATAL) << "SPIR-V shader cannot make extern calls. Graph contains extern \"" + << Downcast(op->args[0]) << "\""; + return spirv::Value(); } else { LOG(FATAL) << "Unresolved call " << op->op; return spirv::Value();