Skip to content
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

CMakeLists.txt: Fix bad include paths in torch_mlir_target_includes #3897

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

mgehre-amd
Copy link
Contributor

@mgehre-amd mgehre-amd commented Dec 2, 2024

The removed code was generating include paths like -Itorch-mlir/lib/Dialect/TorchConversion/IR/ci/llvm-project/mlir/include in in-tree builds where the intention was to generate
-Itorch-mlir/lib/Dialect/TorchConversion/IR -I/ci/llvm-project/mlir/include when running a build in a top level directory like /ci.

I think this is due to MLIR_INCLUDE_DIRS containing two directories, and it seems that together with $<BUILD_INTERFACE:, it triggers a bug (?) in cmake where it concatenates the previous and this new path instead of separating them.

We actually don't need to add MLIR_INCLUDE_DIRS here anyways because we already do include_directories(${MLIR_INCLUDE_DIRS}) above. So this PR just removes it.

The issue can best be see in the compile_commands.json on a target like InitAll.cpp.

The removed code was generating include paths like
`-Itorch-mlir/lib/Dialect/TorchConversion/IR/ci/llvm-project/mlir/include`
where the intention was to generate
`-Itorch-mlir/lib/Dialect/TorchConversion/IR -I/ci/llvm-project/mlir/include`
when running a build in a toplevel directory like `/ci`.

I think this is due to `MLIR_INCLUDE_DIRS` containing two directories,
and it seems that together with `$<BUILD_INTERFACE:`, it triggers a bug (?)
in cmake where it concatenates the previous and this new path instead
of separating them.

We actually don't need to add MLIR_INCLUDE_DIRS here anyways because we already
do `include_directories(${MLIR_INCLUDE_DIRS})` above.
So this PR just removes it.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant