[Mlir-commits] [mlir] [MLIR][ExecutionEngine] don't dump decls (PR #164478)
Maksim Levental
llvmlistbot at llvm.org
Tue Oct 21 12:17:26 PDT 2025
https://github.com/makslevental created https://github.com/llvm/llvm-project/pull/164478
Currently ExecutionEngine tries to dump all functions declared in the module, even thoughs which "external" (i.e., linked at runtime). E.g.
```mlir
module {
func.func @supported_arg_types(%arg0: i32, %arg1: f32) {
vector.print %arg0 : i32
vector.print %arg1 : f32
return
}
}
```
fails with
```
Could not compile printF32:
Symbols not found: [ __mlir_printF32 ]
Program aborted due to an unhandled Error:
Symbols not found: [ __mlir_printF32 ]
```
even though `mlir_printF32` can and is provided by our own `libmlir_c_runner_utils`, which is usually loaded by the engine but of course can also be linked/loaded at runtime by whatever thing links the object file produced from the above.
So just skip functions which have no bodies during dump (i.e., are decls without defns).
>From 73f651fa5473271738bbecec36b6c5c795173eb3 Mon Sep 17 00:00:00 2001
From: Maksim Levental <maksim.levental at gmail.com>
Date: Tue, 21 Oct 2025 12:17:13 -0700
Subject: [PATCH] [MLIR][ExecutionEngine] don't dump decls
Currently ExecutionEngine tries to dump all functions declared in the module, even thoughs which "external" (i.e., linked at runtime). E.g.
```mlir
module {
func.func @supported_arg_types(%arg0: i32, %arg1: f32) {
vector.print %arg0 : i32
vector.print %arg1 : f32
return
}
}
```
fails with
```
Could not compile printF32:
Symbols not found: [ __mlir_printF32 ]
Program aborted due to an unhandled Error:
Symbols not found: [ __mlir_printF32 ]
```
even though `mlir_printF32` can and is provided by our own `libmlir_c_runner_utils`, which is usually loaded by the engine but of course can also be linked/loaded at runtime by whatever thing links the object file produced from the above.
So just skip functions which have no bodies during dump (i.e., are decls without defns).
---
mlir/lib/ExecutionEngine/ExecutionEngine.cpp | 2 ++
1 file changed, 2 insertions(+)
diff --git a/mlir/lib/ExecutionEngine/ExecutionEngine.cpp b/mlir/lib/ExecutionEngine/ExecutionEngine.cpp
index 52162a43aeae3..2255633c746b3 100644
--- a/mlir/lib/ExecutionEngine/ExecutionEngine.cpp
+++ b/mlir/lib/ExecutionEngine/ExecutionEngine.cpp
@@ -239,6 +239,8 @@ ExecutionEngine::create(Operation *m, const ExecutionEngineOptions &options,
// Remember all entry-points if object dumping is enabled.
if (options.enableObjectDump) {
for (auto funcOp : m->getRegion(0).getOps<LLVM::LLVMFuncOp>()) {
+ if (funcOp.getBlocks().empty())
+ continue;
StringRef funcName = funcOp.getSymName();
engine->functionNames.push_back(funcName.str());
}
More information about the Mlir-commits
mailing list