Skip to content

[MLIR] Add missing MLIRGPUDialect dep to MLIRSPIRVDialect #84554

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 20, 2024

Conversation

RoboTux
Copy link
Contributor

@RoboTux RoboTux commented Mar 8, 2024

This fixes the following failure when doing a clean build (in particular
no .ninja* lying around) of lib/libMLIRSPIRVDialect.a only:

mlir/lib/Dialect/SPIRV/IR/SPIRVDialect.cpp:17:
mlir/include/mlir/Dialect/GPU/IR/CompilationInterfaces.h:120:10: fatal error: mlir/Dialect/GPU/IR/CompilationAttrInterfaces.h.inc: No such file or directory

This fixes a failure when doing a clean build of
lib/libMLIRSPIRVDialect.a only.
@llvmbot
Copy link
Member

llvmbot commented Mar 8, 2024

@llvm/pr-subscribers-mlir

@llvm/pr-subscribers-mlir-spirv

Author: Thomas Preud'homme (RoboTux)

Changes

This fixes a failure when doing a clean build of
lib/libMLIRSPIRVDialect.a only.


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

1 Files Affected:

  • (modified) mlir/lib/Dialect/SPIRV/IR/CMakeLists.txt (+1)
diff --git a/mlir/lib/Dialect/SPIRV/IR/CMakeLists.txt b/mlir/lib/Dialect/SPIRV/IR/CMakeLists.txt
index 2b5cedafae1e85..b185264211474f 100644
--- a/mlir/lib/Dialect/SPIRV/IR/CMakeLists.txt
+++ b/mlir/lib/Dialect/SPIRV/IR/CMakeLists.txt
@@ -27,6 +27,7 @@ add_mlir_dialect_library(MLIRSPIRVDialect
   ${MLIR_MAIN_INCLUDE_DIR}/mlir/Dialect/SPIRV
 
   DEPENDS
+  MLIRGPUDialect
   MLIRSPIRVAttributeIncGen
   MLIRSPIRVAttrUtilsGen
   MLIRSPIRVAvailabilityIncGen

@RoboTux RoboTux requested a review from var-const March 8, 2024 20:15
Copy link
Member

@kuhar kuhar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The spir-v dialect doesn't depend on the gpu dialect, no?

@kuhar
Copy link
Member

kuhar commented Mar 8, 2024

The spir-v dialect doesn't depend on the gpu dialect, no?

(I'm just surprised that this is the case, but maybe I missed something. If we do have a dependency, could you provide an example?)

@joker-eph
Copy link
Collaborator

What does the failure look like? ninja clean && ninja lib/libMLIRSPIRVDialect.a does not reproduce at HEAD for me right now.

@RoboTux
Copy link
Contributor Author

RoboTux commented Mar 9, 2024

What does the failure look like? ninja clean && ninja lib/libMLIRSPIRVDialect.a does not reproduce at HEAD for me right now.

I can't seem to reproduce with ninja at the moment but I did yesterday when I was submitting the patch series. I suspect it might be exposed by some of the other patches in the series. I'm trying to find out which one exactly.

@zero9178
Copy link
Member

What does the failure look like? ninja clean && ninja lib/libMLIRSPIRVDialect.a does not reproduce at HEAD for me right now.

I can reproduce this using ninja clean && rm .ninja_deps && ninja lib/libMLIRSPIRVDialect.a. One needs to delete .ninja_deps as it contains/records header dependencies found by the C++ compiler on successful compiles. Unless you have a fresh cmake generation directory then ninja likely already recorded the dependency.

The compiler error looks as follows:

CCACHE_CPP2=yes CCACHE_HASHDIR=yes /usr/bin/ccache /usr/bin/clang++ -DGTEST_HAS_RTTI=0 -DMLIR_CUDA_CONVERSIONS_ENABLED=0 -DMLIR_ROCM_CONVERSIONS_ENABLED=0 -D_DEBUG -D_GLIBCXX_ASSERTIONS -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -I/home/markus/CLionProjects/llvm-project/llvm/cmake-build-debug-clang/tools/mlir/lib/Dialect/SPIRV/IR -I/home/markus/CLionProjects/llvm-project/mlir/lib/Dialect/SPIRV/IR -I/home/markus/CLionProjects/llvm-project/llvm/cmake-build-debug-clang/include -I/home/markus/CLionProjects/llvm-project/llvm/include -I/home/markus/CLionProjects/llvm-project/mlir/include -I/home/markus/CLionProjects/llvm-project/llvm/cmake-build-debug-clang/tools/mlir/include -fPIC -fno-semantic-interposition -fvisibility-inlines-hidden -Werror=date-time -Werror=unguarded-availability-new -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wmissing-field-initializers -pedantic -Wno-long-long -Wc++98-compat-extra-semi -Wimplicit-fallthrough -Wcovered-switch-default -Wno-noexcept-type -Wnon-virtual-dtor -Wdelete-non-virtual-dtor -Wsuggest-override -Wstring-conversion -Wmisleading-indentation -Wctad-maybe-unsupported -fdiagnostics-color -Werror=mismatched-tags -Werror=global-constructors -g -std=c++17 -fcolor-diagnostics  -fno-exceptions -funwind-tables -fno-rtti -MD -MT tools/mlir/lib/Dialect/SPIRV/IR/CMakeFiles/obj.MLIRSPIRVDialect.dir/SPIRVDialect.cpp.o -MF tools/mlir/lib/Dialect/SPIRV/IR/CMakeFiles/obj.MLIRSPIRVDialect.dir/SPIRVDialect.cpp.o.d -o tools/mlir/lib/Dialect/SPIRV/IR/CMakeFiles/obj.MLIRSPIRVDialect.dir/SPIRVDialect.cpp.o -c /home/markus/CLionProjects/llvm-project/mlir/lib/Dialect/SPIRV/IR/SPIRVDialect.cpp
In file included from /home/markus/CLionProjects/llvm-project/mlir/lib/Dialect/SPIRV/IR/SPIRVDialect.cpp:17:
/home/markus/CLionProjects/llvm-project/mlir/include/mlir/Dialect/GPU/IR/CompilationInterfaces.h:120:10: fatal error: 'mlir/Dialect/GPU/IR/CompilationAttrInterfaces.h.inc' file not found
  120 | #include "mlir/Dialect/GPU/IR/CompilationAttrInterfaces.h.inc"
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 error generated.

The SPIR-V dialect doesn't technically depend on the GPU Dialect but rather the interface header being generated by TableGen for the purpose of registering the promise here:

declarePromisedInterface<TargetEnvAttr, gpu::TargetAttrInterface>();

@RoboTux
Copy link
Contributor Author

RoboTux commented Mar 10, 2024

What does the failure look like? ninja clean && ninja lib/libMLIRSPIRVDialect.a does not reproduce at HEAD for me right now.

I can reproduce this using ninja clean && rm .ninja_deps && ninja lib/libMLIRSPIRVDialect.a. One needs to delete .ninja_deps as it contains/records header dependencies found by the C++ compiler on successful compiles. Unless you have a fresh cmake generation directory then ninja likely already recorded the dependency.

Ah that's it, I forgot that bash's * doesn't match files starting with a dot. Removing the .ninja_deps I can now reproduce again. I've updated the description again accordingly. Thanks!

@RoboTux
Copy link
Contributor Author

RoboTux commented Mar 19, 2024

Ping?

@RoboTux RoboTux merged commit 0247564 into llvm:main Mar 20, 2024
chencha3 pushed a commit to chencha3/llvm-project that referenced this pull request Mar 23, 2024
This fixes the following failure when doing a clean build (in particular
no .ninja* lying around) of lib/libMLIRSPIRVDialect.a only:
```
mlir/lib/Dialect/SPIRV/IR/SPIRVDialect.cpp:17:
mlir/include/mlir/Dialect/GPU/IR/CompilationInterfaces.h:120:10: fatal error: mlir/Dialect/GPU/IR/CompilationAttrInterfaces.h.inc: No such file or directory
```
@RoboTux RoboTux deleted the spirvdialect_missing_gpudialect branch April 18, 2024 15:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants