Skip to content

Conversation

@nhat-nguyen
Copy link
Collaborator

@nhat-nguyen nhat-nguyen commented Mar 19, 2024

We found an issue when linking TritonAnalysis without first fully building triton.

In file included from ~/triton/lib/Analysis/Membar.cpp:6:
In file included from ~/triton/include/triton/Conversion/TritonGPUToLLVM/Utility.h:8:
~/triton/include/triton/Dialect/NVGPU/IR/Dialect.h:32:10: fatal error: 'triton/Dialect/NVGPU/IR/Dialect.h.inc' file not found
#include "triton/Dialect/NVGPU/IR/Dialect.h.inc"
         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 warning and 1 error generated.
ninja: build stopped: subcommand failed.

So Membar.cpp includes Utility.h from TritonGPUToLLVM which in turns needs NVGPU and its tablegen files. TritonAnalysis's cmake doesn't list neither TritonGPUToLLVM nor NVGPU as dependencies, hence the linker error. Technically we should have TritonAnalysis depend on TritonGPUToLLVM, but TritonGPUToLLVM already depends on TritonAnalysis.

Fortunately, Membar.cpp doesn't use this Utility.h file, so we could simply delete this include to break both the linker error and the potential circular dependency. Also note that the error doesn't show up in the full build because the tablegen files from NVGPU are already generated by the time we link the all libs.

@nhat-nguyen nhat-nguyen requested a review from Jokeren as a code owner March 19, 2024 22:34
@nhat-nguyen nhat-nguyen changed the title [BUILD] Fix linking error in Membar.cpp [BUILD] Fix linker error in Membar.cpp Mar 19, 2024
@nhat-nguyen nhat-nguyen merged commit bd2f99e into main Mar 19, 2024
@nhat-nguyen nhat-nguyen deleted the nhat/fix-dep branch March 19, 2024 23:33
karupayun pushed a commit to openxla/triton that referenced this pull request Apr 3, 2024
We found an issue when linking `TritonAnalysis` without first fully
building triton.

```
In file included from ~/triton/lib/Analysis/Membar.cpp:6:
In file included from ~/triton/include/triton/Conversion/TritonGPUToLLVM/Utility.h:8:
~/triton/include/triton/Dialect/NVGPU/IR/Dialect.h:32:10: fatal error: 'triton/Dialect/NVGPU/IR/Dialect.h.inc' file not found
#include "triton/Dialect/NVGPU/IR/Dialect.h.inc"
         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 warning and 1 error generated.
ninja: build stopped: subcommand failed.
```

So `Membar.cpp` includes `Utility.h` from `TritonGPUToLLVM` which in
turns needs `NVGPU` and its tablegen files. `TritonAnalysis`'s cmake
doesn't list neither `TritonGPUToLLVM` nor `NVGPU` as dependencies,
hence the linker error. Technically we should have `TritonAnalysis`
depend on `TritonGPUToLLVM`, but `TritonGPUToLLVM` already depends on
`TritonAnalysis`.

Fortunately, `Membar.cpp` doesn't use this `Utility.h` file, so we could
simply delete this include to break both the linker error and the
potential circular dependency. Also note that the error doesn't show up
in the full build because the tablegen files from `NVGPU` are already
generated by the time we link the all libs.
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.

3 participants