Skip to content

Add missing dep on MLIRToLLVMIRTranslationRegistration to mlir-opt. - #75111

Merged
stellaraccident merged 1 commit into
llvm:mainfrom
stellaraccident:mlir_opt_spirv_dep
Dec 12, 2023
Merged

stellaraccident merged 1 commit into
llvm:mainfrom
stellaraccident:mlir_opt_spirv_dep

Conversation

@stellaraccident

Copy link
Copy Markdown
Contributor

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 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)

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)
```
@llvmbot llvmbot added mlir:core MLIR Core Infrastructure mlir labels Dec 11, 2023
@llvmbot

llvmbot commented Dec 11, 2023 •

Copy link
Copy Markdown
Member

@llvm/pr-subscribers-mlir

@llvm/pr-subscribers-mlir-core

Author: Stella Laurenzo (stellaraccident)

Changes

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 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)

Full diff: https://github.com/llvm/llvm-project/pull/75111.diff

2 Files Affected:

  • (modified) mlir/tools/mlir-opt/CMakeLists.txt (+4)
  • (modified) mlir/tools/mlir-opt/mlir-opt.cpp (+4)
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

@stellaraccident

Copy link
Copy Markdown
Contributor Author

According to our CI logs, this appears to have broken somewhere between 13da9a5 (good) and 9fa3455 (bad). But as the dep was clearly missing, I considered it a better use of time to fix it than bisect and root cause. Scanning the patches, nothing jumped out, so I assume this was just something transitive that was accidentally working.

Comment thread mlir/tools/mlir-opt/mlir-opt.cpp Resolved
@joker-eph

Copy link
Copy Markdown
Contributor

I think the issue was introduced in 7fc792c ?

@stellaraccident

stellaraccident commented Dec 12, 2023 •

Copy link
Copy Markdown
Contributor Author

I think the issue was introduced in 7fc792c ?

I wonder how I missed this. I think I fell for the issue where my blame line was reporting patch timestamp, not commit time. I read past it since the view I had showed it as originating 4 months ago :/ (granted, I didn't try very hard to isolate it)

@stellaraccident
stellaraccident merged commit 8eff570 into llvm:main Dec 12, 2023
@stellaraccident
stellaraccident deleted the mlir_opt_spirv_dep branch December 13, 2023 06:31
paleauraaaa pushed a commit to paleauraaaa/llvm-project that referenced this pull request Oct 7, 2026
…lvm#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)
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

mlir:core MLIR Core Infrastructure mlir

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants