This is an archive of the discontinued LLVM Phabricator instance.

[CMake][MLIR][Linalg] Adding variable to specify tablegen file dependencies.
ClosedPublic

Authored by gysit on Jul 1 2021, 2:57 AM.

Details

Summary

Synchronizing multiple custom targets requires not only target but also
file dependencies. Building Linalg involves running yaml-gen followed by
tablegen. Currently, these custom targets are only synchronized using a
target dependency resulting in issues in specific incremental build
setups (https://llvm.discourse.group/t/missing-build-cmake-tblgen-dependency/3727/10).

This patch introduces a novel LLVM_TARGET_DEPENDS variable to the
TableGen.cmake file to provide a way to specify file dependencies.
Additionally, it adapts the Linalg CMakeLists.txt to introduce the
necessary file dependency between yaml-gen and tablegen.

Diff Detail

Event Timeline

gysit created this revision.Jul 1 2021, 2:57 AM
gysit requested review of this revision.Jul 1 2021, 2:57 AM
stellaraccident accepted this revision.Jul 1 2021, 9:05 AM
stellaraccident added inline comments.
mlir/include/mlir/Dialect/Linalg/IR/CMakeLists.txt
28

Can you add a Todo that when this function is rewritten and the old tc parser is retired, to eliminate the parent scope manipulation and do the tablegen generation here in this scope?

I really don't like this action at a distance manipulation of something like a dependency. But since it is all in the same file, in an intermediate state, and I know you are getting ready to delete the old so this can be reworked, I'll favor submitting in this way to fix the incremental build issue.

61

Add a Todo here to factor this so that resetting the var like this is not required.

This revision is now accepted and ready to land.Jul 1 2021, 9:05 AM
gysit updated this revision to Diff 355918.Jul 1 2021, 9:40 AM

Address comments by adding comments.

LGTM with the TODO