mirror of https://github.com/llvm/torch-mlir
Bump llvm-project to 3d92722f74993969243d1400bc3257ca3d03902f. (#369)
* Picks up Python configure changes (was pinned to a bad intermediate commit). * Uses the new mlir_configure_python_dev_packages() to ensure CMake python is found consistently. * Fixes the JIT importer to build as a MODULE vs SHARED (needed for linking to Python as a module, per config changes). * Adds some notes to the README to help folks build a smaller set focused just on this project.pull/372/head
parent
22aeb967c5
commit
fe69bb339c
|
@ -3,6 +3,7 @@
|
|||
.env
|
||||
*.code-workspace
|
||||
.ipynb_checkpoints
|
||||
*.venv/
|
||||
|
||||
/build/
|
||||
__pycache__
|
||||
|
|
|
@ -37,7 +37,7 @@ if(CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
|
|||
|
||||
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
|
||||
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
|
||||
|
||||
|
||||
# Define the default arguments to use with 'lit', and an option for the user to
|
||||
# override.
|
||||
set(LIT_ARGS_DEFAULT "-sv")
|
||||
|
@ -64,7 +64,7 @@ if(CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
|
|||
set(BACKEND_PACKAGE_STRING "LLVM ${LLVM_PACKAGE_VERSION}")
|
||||
else()
|
||||
# In-tree build with LLVM_EXTERNAL_PROJECTS=torch-mlir
|
||||
|
||||
|
||||
option(MLIR_ENABLE_BINDINGS_PYTHON "Enables MLIR Python Bindings" OFF)
|
||||
option(TORCH_MLIR_ENABLE_JIT_IR_IMPORTER "Enables JIT IR Importer" ON)
|
||||
|
||||
|
@ -113,15 +113,11 @@ include(AddMLIR)
|
|||
|
||||
################################################################################
|
||||
# Setup python.
|
||||
# TODO: Make one upstream macro to do this.
|
||||
################################################################################
|
||||
|
||||
if(MLIR_ENABLE_BINDINGS_PYTHON)
|
||||
include(MLIRDetectPythonEnv)
|
||||
mlir_detect_pybind11_install()
|
||||
find_package(Python3 ${LLVM_MINIMUM_PYTHON_VERSION}
|
||||
COMPONENTS Interpreter Development NumPy REQUIRED)
|
||||
find_package(pybind11 2.6 CONFIG REQUIRED)
|
||||
mlir_configure_python_dev_packages()
|
||||
endif()
|
||||
|
||||
add_subdirectory(include)
|
||||
|
|
13
README.md
13
README.md
|
@ -50,7 +50,7 @@ python -m pip install --upgrade pip
|
|||
python -m pip install --pre torch torchvision pybind11 -f https://download.pytorch.org/whl/nightly/cpu/torch_nightly.html
|
||||
```
|
||||
|
||||
## Build
|
||||
## Build
|
||||
```shell
|
||||
cmake -GNinja -Bbuild \
|
||||
-DCMAKE_C_COMPILER=clang \
|
||||
|
@ -70,7 +70,14 @@ cmake -GNinja -Bbuild \
|
|||
# -DCMAKE_EXE_LINKER_FLAGS_INIT="-fuse-ld=lld" -DCMAKE_MODULE_LINKER_FLAGS_INIT="-fuse-ld=lld" -DCMAKE_SHARED_LINKER_FLAGS_INIT="-fuse-ld=lld"
|
||||
# Use --ld-path= instead of -fuse-ld=lld for clang > 13
|
||||
|
||||
cmake --build build
|
||||
# Build just torch-mlir (not all of LLVM)
|
||||
cmake --build build --target tools/torch-mlir/all
|
||||
|
||||
# Run unit tests.
|
||||
cmake --build build --target check-torch-mlir
|
||||
|
||||
# Build everything (including LLVM)
|
||||
# cmake --build build
|
||||
```
|
||||
## Demos
|
||||
|
||||
|
@ -139,7 +146,7 @@ The `examples` folder includes the Python package `lazytensor`, which implements
|
|||
|
||||
#### Example usage of `lazytensor`
|
||||
|
||||
The `examples` folder includes scripts `lazytensor_*.py` showing how to use the Lazy Tensor to MLIR pipeline. The examples depend on the Lazy Tensor Core (LTC) of PyTorch. For information on how to obtain LTC, see [here](https://github.com/pytorch/pytorch/blob/lazy_tensor_staging/lazy_tensor_core/QUICKSTART.md).
|
||||
The `examples` folder includes scripts `lazytensor_*.py` showing how to use the Lazy Tensor to MLIR pipeline. The examples depend on the Lazy Tensor Core (LTC) of PyTorch. For information on how to obtain LTC, see [here](https://github.com/pytorch/pytorch/blob/lazy_tensor_staging/lazy_tensor_core/QUICKSTART.md).
|
||||
|
||||
In order to run the examples, make sure you've setup your `PYTHONPATH` by following the [Setup Python Environment](#setup-python-environment) instructions, and also add `/path/to/pytorch/lazy_tensor_core` to your `PYTHONPATH` as shown below:
|
||||
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit a54f4eae0e1d0ef5adccdcf9f6c2b518dc1101aa
|
||||
Subproject commit 3d92722f74993969243d1400bc3257ca3d03902f
|
|
@ -10,7 +10,7 @@ include_directories(BEFORE
|
|||
)
|
||||
link_directories("${TORCH_INSTALL_PREFIX}/lib")
|
||||
|
||||
add_library(TorchMLIRJITIRImporter SHARED
|
||||
add_library(TorchMLIRJITIRImporter MODULE
|
||||
class_annotator.cpp
|
||||
get_registered_ops.cpp
|
||||
function_importer.cpp
|
||||
|
|
Loading…
Reference in New Issue