This is an archive of the discontinued LLVM Phabricator instance.

Move MLIR CAPI to mlir/core (NFC)
Needs ReviewPublic

Authored by mehdi_amini on Mar 14 2022, 1:01 AM.

Diff Detail

Event Timeline

mehdi_amini created this revision.Mar 14 2022, 1:01 AM
Herald added a project: Restricted Project. · View Herald TranscriptMar 14 2022, 1:01 AM
mehdi_amini requested review of this revision.Mar 14 2022, 1:01 AM
mehdi_amini added inline comments.Mar 14 2022, 1:12 AM
mlir/lib/CMakeLists.txt
27

@stellaraccident : I'm trying to work around the issue that using a global property exposes us to the order of traversal in CMake.

If the core/ directory is traversed before the dialects are visited, the MLIR_DIALECT_LIBS property is still empty.
Instead I'm defining a library which cmake resolves after parsing completes (or something like that).

Ideally we'd use an "INTERFACE" library in cmake, but because it won't work with the install and export_set, I ended up adding an empty source file. Any better suggestion here?

mlir/lib/CMakeLists.txt
27

I'm going to need to stare at this for a few minutes to have a concrete suggestion. I can think of some obvious quick fixes but would like to see if there is a way to avoid the weird coupling.

Have some meetings now but have a good chunk of time later today and will see if I can work this out.

mlir/lib/CMakeLists.txt
27

I think that INTERFACE libraries can be installed (we use them that way elsewhere), but I also recall there being weirdness that may make them not great options. In the absence of that, this kind of empty.cpp is sota. I think you need the contents to be something like:

typedef int dummy;

(In order to avoid empty translation unit warnings in all cases).

See llvm/cmake/dummy.cpp.

I'd like to take a look at the tree and propose a better place for these kinds of things that need access to everything.

mlir/lib/CAPI/IR/IntegerSet.cpp