File tree 5 files changed +32
-2
lines changed
5 files changed +32
-2
lines changed Original file line number Diff line number Diff line change 4
4
* .code-workspace
5
5
.ipynb_checkpoints
6
6
* .venv /
7
+ mlir_venv /
7
8
8
9
/build /
9
10
__pycache__
Original file line number Diff line number Diff line change @@ -46,8 +46,8 @@ python -m venv mlir_venv
46
46
source mlir_venv/bin/activate
47
47
# Some older pip installs may not be able to handle the recent PyTorch deps
48
48
python -m pip install --upgrade pip
49
- # Install latest PyTorch nightlies
50
- python -m pip install --pre torch torchvision pybind11 -f https://download.pytorch.org/whl/nightly/cpu/torch_nightly.html
49
+ # Install latest PyTorch nightlies and build requirements.
50
+ python -m pip install -r requirements.txt
51
51
```
52
52
53
53
## Build
@@ -178,3 +178,14 @@ manually `source`'d in a shell.
178
178
- ` #torch-mlir ` channel on the LLVM [ Discord] ( https://discord.gg/xS7Z362 )
179
179
- Issues [ here] ( https://github.com/llvm/torch-mlir/issues )
180
180
- [ ` torch-mlir ` section] ( https://llvm.discourse.group/c/projects-that-want-to-become-official-llvm-projects/torch-mlir/41 ) of LLVM Discourse
181
+
182
+ ## Build Python Packages
183
+
184
+ We have preliminary support for building Python packages. This can be done
185
+ with the following commands:
186
+
187
+ ```
188
+ python -m pip install --upgrade pip
189
+ python -m pip install -r requirements.txt
190
+ CMAKE_GENERATOR=Ninja python setup.py bdist_wheel
191
+ ```
Original file line number Diff line number Diff line change 1
1
include (AddMLIRPython)
2
2
3
+ # Disables generation of "version soname" (i.e. libFoo.so.<version>), which
4
+ # causes pure duplication as part of Python wheels.
5
+ set (CMAKE_PLATFORM_NO_VERSIONED_SONAME ON )
6
+
3
7
# The directory at which the Python import tree begins.
4
8
# See documentation for `declare_mlir_python_sources`'s ROOT_DIR
5
9
# argument.
Original file line number Diff line number Diff line change
1
+ -f https://download.pytorch.org/whl/nightly/cpu/torch_nightly.html
2
+ --pre
3
+
4
+ numpy
5
+ torch
6
+ torchvision
7
+
8
+ # Build requirements.
9
+ pybind11
10
+ wheel
Original file line number Diff line number Diff line change @@ -64,6 +64,10 @@ def run(self):
64
64
f"-DLLVM_ENABLE_PROJECTS=mlir" ,
65
65
f"-DLLVM_EXTERNAL_PROJECTS=torch-mlir" ,
66
66
f"-DLLVM_EXTERNAL_TORCH_MLIR_SOURCE_DIR={ src_dir } " ,
67
+ # Optimization options for building wheels.
68
+ f"-DCMAKE_VISIBILITY_INLINES_HIDDEN=ON" ,
69
+ f"-DCMAKE_C_VISIBILITY_PRESET=hidden" ,
70
+ f"-DCMAKE_CXX_VISIBILITY_PRESET=hidden" ,
67
71
]
68
72
os .makedirs (cmake_build_dir , exist_ok = True )
69
73
cmake_cache_file = os .path .join (cmake_build_dir , "CMakeCache.txt" )
You can’t perform that action at this time.
0 commit comments