[all-commits] [llvm/llvm-project] cb7b03: [mlir][python] Simplify python extension loading.

Stella Laurenzo via All-commits all-commits at lists.llvm.org
Thu Sep 2 17:48:09 PDT 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: cb7b03819ae667a87e49fa2546498dcf6248d99c
      https://github.com/llvm/llvm-project/commit/cb7b03819ae667a87e49fa2546498dcf6248d99c
  Author: Stella Laurenzo <stellaraccident at gmail.com>
  Date:   2021-09-03 (Fri, 03 Sep 2021)

  Changed paths:
    M mlir/cmake/modules/AddMLIRPython.cmake
    M mlir/lib/Bindings/Python/IRModule.cpp
    M mlir/python/CMakeLists.txt
    R mlir/python/mlir/_cext_loader.py
    R mlir/python/mlir/_dlloader.py
    M mlir/python/mlir/_mlir_libs/__init__.py
    M mlir/python/mlir/all_passes_registration/__init__.py
    M mlir/python/mlir/conversions/__init__.py
    M mlir/python/mlir/dialects/_linalg_ops_ext.py
    M mlir/python/mlir/dialects/_ods_common.py
    M mlir/python/mlir/dialects/async_dialect/passes/__init__.py
    M mlir/python/mlir/dialects/gpu/passes/__init__.py
    M mlir/python/mlir/dialects/linalg/opdsl/lang/emitter.py
    M mlir/python/mlir/dialects/linalg/passes/__init__.py
    M mlir/python/mlir/dialects/sparse_tensor.py
    M mlir/python/mlir/execution_engine.py
    M mlir/python/mlir/ir.py
    M mlir/python/mlir/passmanager.py
    M mlir/python/mlir/transforms/__init__.py

  Log Message:
  -----------
  [mlir][python] Simplify python extension loading.

* Now that packaging has stabilized, removes old mechanisms for loading extensions, preferring direct importing.
* Removes _cext_loader.py, _dlloader.py as unnecessary.
* Fixes the path where the CAPI dll is written on Windows. This enables that path of least resistance loading behavior to work with no further drama (see: https://bugs.python.org/issue36085).
* With this patch, `ninja check-mlir` on Windows with Python bindings works for me, modulo some failures that are actually due to a couple of pre-existing Windows bugs. I think this is the first time the Windows Python bindings have worked upstream.
* Downstream changes needed:
  * If downstreams are using the now removed `load_extension`, `reexport_cext`, etc, then those should be replaced with normal import statements as done in this patch.

Reviewed By: jdd, aartbik

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




More information about the All-commits mailing list