[Mlir-commits] [mlir] 67754a9 - [mlir][gpu] NFC - Fail gracefully when type conversion fails instead of crashing
Nicolas Vasilache
llvmlistbot at llvm.org
Fri Jul 28 14:06:03 PDT 2023
Author: Nicolas Vasilache
Date: 2023-07-28T21:03:52Z
New Revision: 67754a9dc4db9d16c94f219e73ef00fd3c682d9b
URL: https://github.com/llvm/llvm-project/commit/67754a9dc4db9d16c94f219e73ef00fd3c682d9b
DIFF: https://github.com/llvm/llvm-project/commit/67754a9dc4db9d16c94f219e73ef00fd3c682d9b.diff
LOG: [mlir][gpu] NFC - Fail gracefully when type conversion fails instead of crashing
Added:
Modified:
mlir/lib/Conversion/GPUCommon/GPUOpsLowering.cpp
Removed:
################################################################################
diff --git a/mlir/lib/Conversion/GPUCommon/GPUOpsLowering.cpp b/mlir/lib/Conversion/GPUCommon/GPUOpsLowering.cpp
index 2fe1c7c7f7af14..6e8ba7a33fd8f4 100644
--- a/mlir/lib/Conversion/GPUCommon/GPUOpsLowering.cpp
+++ b/mlir/lib/Conversion/GPUCommon/GPUOpsLowering.cpp
@@ -51,9 +51,16 @@ GPUFuncOpLowering::matchAndRewrite(gpu::GPUFuncOp gpuFuncOp, OpAdaptor adaptor,
// Remap proper input types.
TypeConverter::SignatureConversion signatureConversion(
gpuFuncOp.front().getNumArguments());
+
Type funcType = getTypeConverter()->convertFunctionSignature(
gpuFuncOp.getFunctionType(), /*isVariadic=*/false,
getTypeConverter()->getOptions().useBarePtrCallConv, signatureConversion);
+ if (!funcType) {
+ return rewriter.notifyMatchFailure(gpuFuncOp, [&](Diagnostic &diag) {
+ diag << "failed to convert function signature type for: "
+ << gpuFuncOp.getFunctionType();
+ });
+ }
// Create the new function operation. Only copy those attributes that are
// not specific to function modeling.
More information about the Mlir-commits
mailing list