[Mlir-commits] [mlir] 08ed557 - [mlir] mlir-opt: Fix linking after 7c4e8c6a273f2 .
Will Dietz
llvmlistbot at llvm.org
Fri Aug 25 18:28:32 PDT 2023
Author: Will Dietz
Date: 2023-08-25T20:28:27-05:00
New Revision: 08ed557714eed7f5cde9d1c5606f58280683884a
URL: https://github.com/llvm/llvm-project/commit/08ed557714eed7f5cde9d1c5606f58280683884a
DIFF: https://github.com/llvm/llvm-project/commit/08ed557714eed7f5cde9d1c5606f58280683884a.diff
LOG: [mlir] mlir-opt: Fix linking after 7c4e8c6a273f2 .
Without this, undefined refernces to the LLVMIR translations:
```
ld: mlir-opt.cpp:(.text.startup.main+0x49): undefined reference to `mlir::registerAMXDialectTranslation(mlir::DialectRegistry&)'
ld: mlir-opt.cpp:(.text.startup.main+0x51): undefined reference to `mlir::registerArmSMEDialectTranslation(mlir::DialectRegistry&)'
ld: mlir-opt.cpp:(.text.startup.main+0x59): undefined reference to `mlir::registerArmSVEDialectTranslation(mlir::DialectRegistry&)'
ld: mlir-opt.cpp:(.text.startup.main+0x81): undefined reference to `mlir::registerOpenACCDialectTranslation(mlir::DialectRegistry&)'
ld: mlir-opt.cpp:(.text.startup.main+0x89): undefined reference to `mlir::registerOpenMPDialectTranslation(mlir::DialectRegistry&)'
ld: mlir-opt.cpp:(.text.startup.main+0x99): undefined reference to `mlir::registerX86VectorDialectTranslation(mlir::DialectRegistry&)'
```
Reviewed By: stellaraccident
Differential Revision: https://reviews.llvm.org/D158606
Added:
Modified:
mlir/include/mlir/Target/LLVMIR/Dialect/All.h
mlir/tools/mlir-opt/mlir-opt.cpp
Removed:
################################################################################
diff --git a/mlir/include/mlir/Target/LLVMIR/Dialect/All.h b/mlir/include/mlir/Target/LLVMIR/Dialect/All.h
index 895a37a63e9ff3..c25822c1c82bf1 100644
--- a/mlir/include/mlir/Target/LLVMIR/Dialect/All.h
+++ b/mlir/include/mlir/Target/LLVMIR/Dialect/All.h
@@ -60,6 +60,18 @@ static inline void registerAllToLLVMIRTranslations(DialectRegistry ®istry) {
ROCDL::registerROCDLTargetInterfaceExternalModels(registry);
}
+/// Registers all the translations to LLVM IR required by GPU passes.
+/// TODO: Remove this function when a safe dialect interface registration
+/// mechanism is implemented, see D157703.
+static inline void
+registerAllGPUToLLVMIRTranslations(DialectRegistry ®istry) {
+ registerBuiltinDialectTranslation(registry);
+ registerGPUDialectTranslation(registry);
+ registerLLVMDialectTranslation(registry);
+ registerNVVMDialectTranslation(registry);
+ registerROCDLDialectTranslation(registry);
+}
+
/// Registers all dialects that can be translated from LLVM IR and the
/// corresponding translation interfaces.
static inline void
diff --git a/mlir/tools/mlir-opt/mlir-opt.cpp b/mlir/tools/mlir-opt/mlir-opt.cpp
index b47634476c621b..a8aeffec1ae72d 100644
--- a/mlir/tools/mlir-opt/mlir-opt.cpp
+++ b/mlir/tools/mlir-opt/mlir-opt.cpp
@@ -276,7 +276,7 @@ int main(int argc, char **argv) {
DialectRegistry registry;
registerAllDialects(registry);
registerAllExtensions(registry);
- registerAllToLLVMIRTranslations(registry);
+ registerAllGPUToLLVMIRTranslations(registry);
#ifdef MLIR_INCLUDE_TESTS
::test::registerTestDialect(registry);
More information about the Mlir-commits
mailing list