[llvm] Add option to enable MLIR Python bindings (#32415)

This commit is contained in:
Abhishek Kulkarni 2023-09-07 13:09:08 -07:00 committed by GitHub
parent 095ee8757e
commit 8218500ddf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 69 additions and 3 deletions

View File

@ -0,0 +1,25 @@
From 80300a7f4533fdfc75ec60b0d1dc1c5d5a6b9e3c Mon Sep 17 00:00:00 2001
From: Ankur Verma <ankurv@microsoft.com>
Date: Fri, 14 Jul 2023 09:45:22 -0700
Subject: [PATCH] remove_numpy
---
mlir/cmake/modules/MLIRDetectPythonEnv.cmake | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/mlir/cmake/modules/MLIRDetectPythonEnv.cmake b/mlir/cmake/modules/MLIRDetectPythonEnv.cmake
index 9c8966591514..35c94f0d1acc 100644
--- a/mlir/cmake/modules/MLIRDetectPythonEnv.cmake
+++ b/mlir/cmake/modules/MLIRDetectPythonEnv.cmake
@@ -26,7 +26,7 @@ macro(mlir_configure_python_dev_packages)
set(_python_development_component Development.Module)
find_package(Python3 ${LLVM_MINIMUM_PYTHON_VERSION}
- COMPONENTS Interpreter ${_python_development_component} NumPy REQUIRED)
+ COMPONENTS Interpreter ${_python_development_component} REQUIRED)
unset(_python_development_component)
message(STATUS "Found python include dirs: ${Python3_INCLUDE_DIRS}")
message(STATUS "Found python libraries: ${Python3_LIBRARIES}")
--
2.41.0.windows.2

View File

@ -0,0 +1,13 @@
diff --git a/mlir/python/CMakeLists.txt b/mlir/python/CMakeLists.txt
index 7eb6e05e4..b9e1a096a 100644
--- a/mlir/python/CMakeLists.txt
+++ b/mlir/python/CMakeLists.txt
@@ -483,6 +483,8 @@ add_mlir_python_common_capi_library(MLIRPythonCAPI
${_ADDL_TEST_SOURCES}
)
+file(MAKE_DIRECTORY "${MLIR_BINARY_DIR}/python_packages/mlir_core/mlir/_mlir_libs")
+
################################################################################
# The fully assembled package of modules.
# This must come last.

View File

@ -15,7 +15,9 @@ vcpkg_from_github(
0007-Fix-install-bolt.patch 0007-Fix-install-bolt.patch
0008-llvm_assert.patch 0008-llvm_assert.patch
0009-disable-libomp-aliases.patch 0009-disable-libomp-aliases.patch
0010-missing-include.patch 0010-remove-numpy.patch
0011-missing-include.patch
0012-create-destination-mlir-directory.patch
) )
vcpkg_check_features( vcpkg_check_features(
@ -147,6 +149,12 @@ if("lldb" IN_LIST FEATURES)
endif() endif()
if("mlir" IN_LIST FEATURES) if("mlir" IN_LIST FEATURES)
list(APPEND LLVM_ENABLE_PROJECTS "mlir") list(APPEND LLVM_ENABLE_PROJECTS "mlir")
if("enable-mlir-python-bindings" IN_LIST FEATURES)
list(APPEND FEATURE_OPTIONS
-DMLIR_ENABLE_BINDINGS_PYTHON=ON
"-Dpybind11_DIR=${CURRENT_INSTALLED_DIR}/share/pybind11"
)
endif()
endif() endif()
if("openmp" IN_LIST FEATURES) if("openmp" IN_LIST FEATURES)
list(APPEND LLVM_ENABLE_PROJECTS "openmp") list(APPEND LLVM_ENABLE_PROJECTS "openmp")

View File

@ -1,7 +1,7 @@
{ {
"name": "llvm", "name": "llvm",
"version": "15.0.7", "version": "15.0.7",
"port-version": 5, "port-version": 6,
"description": "The LLVM Compiler Infrastructure.", "description": "The LLVM Compiler Infrastructure.",
"homepage": "https://llvm.org", "homepage": "https://llvm.org",
"license": "Apache-2.0", "license": "Apache-2.0",
@ -193,6 +193,21 @@
"libxml2" "libxml2"
] ]
}, },
"enable-mlir-python-bindings": {
"description": "Build MLIR Python bindings.",
"supports": "!(windows & static)",
"dependencies": [
{
"name": "llvm",
"default-features": false,
"features": [
"mlir"
]
},
"pybind11",
"python3"
]
},
"enable-rtti": { "enable-rtti": {
"description": "Build LLVM with run-time type information." "description": "Build LLVM with run-time type information."
}, },

View File

@ -5038,7 +5038,7 @@
}, },
"llvm": { "llvm": {
"baseline": "15.0.7", "baseline": "15.0.7",
"port-version": 5 "port-version": 6
}, },
"lmdb": { "lmdb": {
"baseline": "0.9.29", "baseline": "0.9.29",

View File

@ -1,5 +1,10 @@
{ {
"versions": [ "versions": [
{
"git-tree": "484d2a5abb5ffc10d18e18603adb20bd01854012",
"version": "15.0.7",
"port-version": 6
},
{ {
"git-tree": "ce05511c7bf08ffecc627b73ae566e1a1e7e6b20", "git-tree": "ce05511c7bf08ffecc627b73ae566e1a1e7e6b20",
"version": "15.0.7", "version": "15.0.7",