[all-commits] [llvm/llvm-project] 260720: Remove libMLIRPublicAPI DSO.

Stella Laurenzo via All-commits all-commits at lists.llvm.org
Tue Jul 20 17:59:19 PDT 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 2607209b3fffc0a01e02df3623cf2a46b2be2bc0
      https://github.com/llvm/llvm-project/commit/2607209b3fffc0a01e02df3623cf2a46b2be2bc0
  Author: Stella Laurenzo <stellaraccident at gmail.com>
  Date:   2021-07-20 (Tue, 20 Jul 2021)

  Changed paths:
    M mlir/cmake/modules/AddMLIR.cmake
    M mlir/cmake/modules/AddMLIRPython.cmake
    M mlir/include/mlir-c/Support.h
    M mlir/lib/Bindings/Python/CMakeLists.txt
    M mlir/lib/Bindings/Python/Conversions/CMakeLists.txt
    M mlir/lib/Bindings/Python/Transforms/CMakeLists.txt
    M mlir/lib/CAPI/CMakeLists.txt
    M mlir/python/mlir/_cext_loader.py
    M mlir/test/CAPI/CMakeLists.txt

  Log Message:
  -----------
  Remove libMLIRPublicAPI DSO.

libMLIRPublicAPI.so came into existence early when the Python and C-API were being co-developed because the Python extensions need a single DSO which exports the C-API to link against. It really should never have been exported as a mondo library in the first place, which has caused no end of problems in different linking modes, etc (i.e. the CAPI tests depended on it).

This patch does a mechanical move that:

* Makes the C-API tests link directly to their respective libraries.
* Creates a libMLIRPythonCAPI as part of the Python bindings which assemble to exact DSO that they need.

This has the effect that the C-API is no longer monolithic and can be subset and used piecemeal in a modular fashion, which is necessary for downstreams to only pay for what they use. There are additional, more fundamental changes planned for how the Python API is assembled which should make it more out of tree friendly, but this minimal first step is necessary to break the fragile dependency between the C-API and Python API.

Downstream actions required:

* If using the C-API and linking against MLIRPublicAPI, you must instead link against its constituent components. As a reference, the Python API dependencies are in lib/Bindings/Python/CMakeLists.txt and approximate the full set of dependencies available.
* If you have a Python API project that was previously linking against MLIRPublicAPI (i.e. to add its own C-API DSO), you will want to `s/MLIRPublicAPI/MLIRPythonCAPI/` and all should be as it was. There are larger changes coming in this area but this part is incremental.

Reviewed By: mehdi_amini

Differential Revision: https://reviews.llvm.org/D106369




More information about the All-commits mailing list