[Mlir-commits] [mlir] Add missing dep on MLIRToLLVMIRTranslationRegistration to mlir-opt. (PR #75111)
Stella Laurenzo
llvmlistbot at llvm.org
Mon Dec 11 14:43:54 PST 2023
https://github.com/stellaraccident created https://github.com/llvm/llvm-project/pull/75111
I was not able to fully triage why this just started failing on one of our bots as it seems that the use was added 4 months ago. I would assume that it was accidentally coming in transitively in some way as the dep was definitely missing.
For context, this started failing in [our byo_llvm](https://github.com/openxla/iree/blob/main/build_tools/llvm/byo_llvm.sh) build on a stock build of MLIR on top of an existing LLVM. We were getting:
```
ld.lld: error: undefined symbol: mlir::registerSPIRVDialectTranslation(mlir::DialectRegistry&) >>> referenced by mlir-opt.cpp
>>> tools/mlir-opt/CMakeFiles/mlir-opt.dir/mlir-opt.cpp.o:(main)
```
>From 4138150ed92782b5a37735e5001dc052eca11950 Mon Sep 17 00:00:00 2001
From: Stella Laurenzo <stellaraccident at gmail.com>
Date: Mon, 11 Dec 2023 14:21:07 -0800
Subject: [PATCH] Add missing dep on MLIRToLLVMIRTranslationRegistration to
mlir-opt.
I was not able to fully triage why this just started failing on one of our bots as it seems that the use was added 4 months ago. I would assume that it was accidentally coming in transitively in some way as the dep was definitely missing.
For context, this started failing in [our byo_llvm](https://github.com/openxla/iree/blob/main/build_tools/llvm/byo_llvm.sh) build on a stock build of MLIR on top of an existing LLVM. We were getting:
```
ld.lld: error: undefined symbol: mlir::registerSPIRVDialectTranslation(mlir::DialectRegistry&) >>> referenced by mlir-opt.cpp
>>> tools/mlir-opt/CMakeFiles/mlir-opt.dir/mlir-opt.cpp.o:(main)
```
---
mlir/tools/mlir-opt/CMakeLists.txt | 4 ++++
mlir/tools/mlir-opt/mlir-opt.cpp | 4 ++++
2 files changed, 8 insertions(+)
diff --git a/mlir/tools/mlir-opt/CMakeLists.txt b/mlir/tools/mlir-opt/CMakeLists.txt
index 88a0562cb6e720..4d3d9173a93662 100644
--- a/mlir/tools/mlir-opt/CMakeLists.txt
+++ b/mlir/tools/mlir-opt/CMakeLists.txt
@@ -66,6 +66,10 @@ set(LIBS
MLIRTransformUtils
MLIRSupport
MLIRIR
+
+ # TODO: Remove when registerAllGPUToLLVMIRTranslations is no longer
+ # registered directly in mlir-opt.cpp.
+ MLIRToLLVMIRTranslationRegistration
)
# Exclude from libMLIR.so because this has static options intended for
diff --git a/mlir/tools/mlir-opt/mlir-opt.cpp b/mlir/tools/mlir-opt/mlir-opt.cpp
index 3e3223b4850560..bd990bbfea84d8 100644
--- a/mlir/tools/mlir-opt/mlir-opt.cpp
+++ b/mlir/tools/mlir-opt/mlir-opt.cpp
@@ -274,6 +274,10 @@ int main(int argc, char **argv) {
DialectRegistry registry;
registerAllDialects(registry);
registerAllExtensions(registry);
+
+ // TODO: Remove this and the corresponding MLIRToLLVMIRTranslationRegistration
+ // cmake dependency when a safe dialect interface registration mechanism is
+ // implemented, see D157703 (and corresponding note on the declaration).
registerAllGPUToLLVMIRTranslations(registry);
#ifdef MLIR_INCLUDE_TESTS
More information about the Mlir-commits
mailing list