There are cases where other targets only use the utils, not the transforms.
So it makes sense to move them to their own target.
Details
- Reviewers
rriddle aartbik bondhugula nicolasvasilache
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
mlir/lib/Dialect/Linalg/Transforms/CMakeLists.txt | ||
---|---|---|
51–52 | Currently the transforms themselves use the Utils, which is why this dependency needs to be in this direction. Utils don't use Transforms though, which is why the split is even possible :) | |
utils/bazel/llvm-project-overlay/mlir/BUILD.bazel | ||
2420 | As far as I can tell, they are still in Dialect/SCF directory: https://github.com/llvm/llvm-project/blob/main/mlir/include/mlir/Dialect/SCF/Utils.h We could move them also to a separate Utils subdirectory, then this exclude wouldn't be needed. But that would require also to changing several header includes. Might make sense to do in a followup patch? |
utils/bazel/llvm-project-overlay/mlir/BUILD.bazel | ||
---|---|---|
2420 | Also, maybe I misunderstood the concern: the exclusion would not necessarily be needed because the headers are also part of the new target. But keeping them in this target has the opportunity to cause linker errors. Users of the headers might depend on the Dialect, but not on the Utils target with the implementation. This will work fine until a binary is built where the missing implementation dependency will be noticed. |
mlir/lib/Dialect/SCF/Utils/AffineCanonicalizationUtils.cpp | ||
---|---|---|
13 | Same here, can this be moved to SCF/Utils/AffineCanonicalizationUtils.h? | |
mlir/lib/Dialect/SCF/Utils/Utils.cpp | ||
1 | While you are here, can you fix this? | |
13 | Can the header also be moved to SCF/Utils/Utils.h? | |
mlir/lib/Dialect/SparseTensor/Transforms/CMakeLists.txt | ||
23 | Why is transforms necessary now? |
mlir/lib/Dialect/SparseTensor/Transforms/CMakeLists.txt | ||
---|---|---|
23 | It was already necessary before, mlir/lib/Dialect/SparseTensor/Transforms/Sparsification.cpp includes mlir/Dialect/SCF/Transforms.h | |
utils/bazel/llvm-project-overlay/mlir/BUILD.bazel | ||
2420 | River has also requested to move the headers, so I did that now as part of this patch. This makes it possible to remove the exclusion. I would still like to exclude Transforms.h, otherwise we have the same problem here that someone who uses SCFTransforms might forget to depend on that target. We already have a precedence for that case in the CMakeLists.txt file for SparseTensorTransforms which was missing this dependency (although this exclusion here won't fix cmake ;-) ). |
Landed as https://github.com/llvm/llvm-project/commit/f40475c7fd71d8b525d04536191c70ae0c87cc22
I used the wrong commit message, sorry about that.
This will need a tweak.