This is an archive of the discontinued LLVM Phabricator instance.

[MLIR] add dependencies for all tablegen targets on 'mlir-headers'
ClosedPublic

Authored by stephenneuendorffer on May 1 2020, 9:30 AM.

Details

Summary

In cmake, dependencies on generated files require some sophistication in the build system. At build time, files are parsed to determine which headers they depend on and these dependencies are injected into the build system. This works well with ninja, but has some constraints with the makefile generator. According to the cmake documentation, this only works reliably within the same directory.

This patch expands the usage of mlir-headers to include all generated headers and adds an mlir-generic-headers target which triggers generation of dialect-independent headers. These targets are used to express dependencies on generated headers. This is mostly handled in AddMLIR.cmake and only a few CMakeLists.txt files need to change.

Diff Detail

Event Timeline

rriddle added inline comments.May 1 2020, 10:22 AM
mlir/include/mlir/Dialect/LoopOps/CMakeLists.txt
7

Wonder if it would be easier to just have our own add_public_mlir_tablegen_target that does this automatically.

mlir/lib/Dialect/Linalg/Transforms/Fusion.cpp
14 ↗(On Diff #261472)

Were some of these changes supposed to be in the other revision?

stephenneuendorffer edited the summary of this revision. (Show Details)
rriddle added inline comments.May 1 2020, 12:01 PM
mlir/lib/Analysis/CMakeLists.txt
4–5

These changes seem like they should be in the other revision?

mlir/lib/Dialect/Linalg/Transforms/Fusion.cpp
14 ↗(On Diff #261472)

Still unresolved?

mlir/test/lib/Transforms/TestDominance.cpp
15 ↗(On Diff #261503)

Same here.

stephenneuendorffer marked an inline comment as done.May 1 2020, 5:10 PM
stephenneuendorffer added inline comments.
mlir/include/mlir/Dialect/LoopOps/CMakeLists.txt
7

Yes there's some further refactoring that can happen on the tablegen rules. Probably adding add_mlir_interface is low-hanging fruit. I think we can do this later, however.

stephenneuendorffer marked an inline comment as done.May 1 2020, 5:39 PM
rriddle accepted this revision.May 1 2020, 6:21 PM
This revision is now accepted and ready to land.May 1 2020, 6:21 PM
This revision was automatically updated to reflect the committed changes.