Page MenuHomePhabricator

Generalize a facility in MLIR CMake for producing aggregate shared and static libraries.

Authored by stellaraccident on Jul 20 2021, 9:53 PM.


  • Uses this to build an aggregate of the MLIR C-API, as required by the Python bindings.
  • Should be extensible to cover the libMLIR use cases with some more work, but check pointing on this simple form to start (it has fewer requirements and low potential to break anyone).
  • I think that if this proves successful for MLIR, we may want to make a case to promote it to LLVM and use it to replace the current component system.
  • Should allow for both static and shared linkage of aggregate libraries, as well as optionality in terms of what goes in them (while also being correct and not causing ODR issues in expected usage).
  • Intended to be a piece to be used both in and out of tree, specifically for projects like npcomp and circt which need to instantiate their own Python and aggregate C-APIs.

Diff Detail

Event Timeline

stellaraccident requested review of this revision.Jul 20 2021, 9:53 PM

IS the intention to deprecate usage of EXCLUDE_FROM_LIBMLIR in favor of DISABLE_AGGREGATE?
Seems like this changes the behavior of it might be better to not change until we have a good replacement mechanism and then do the change once to reduce churn?


Do you mean to check in this debugging code? I don't think it's a bad thing, just asking :)


It's not clear to me how targets depend on this. Do they depend on MLIRPythonCAPI directly? or do they depend on a contained library, like MLIRCAPIGPU?


spacing instead of tabs?

(quickly skimmed, not sure I totally understood it yet)


Can you document the new flag?


I don't follow the logic here: should it be an OR ?

Generally speaking I like this approach... It's much simpler than the alternatives that I've seen. I think we should try to take it to the next step....


Should this be a generator expression as well?

This revision is now accepted and ready to land.Jul 21 2021, 10:39 PM
marbre added a subscriber: marbre.Jul 22 2021, 9:11 AM