mirror of https://github.com/llvm/torch-mlir
parent
1d3a7419c5
commit
c718f87c5d
|
@ -16,12 +16,12 @@ jobs:
|
||||||
runs-on: a100
|
runs-on: a100
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
package: [ torch-mlir, torch-mlir-no-jit ]
|
package: [ torch-mlir, torch-mlir-core ]
|
||||||
py_version: [ cp38-cp38, cp310-cp310, cp311-cp311 ]
|
py_version: [ cp38-cp38, cp310-cp310, cp311-cp311 ]
|
||||||
exclude:
|
exclude:
|
||||||
- package: torch-mlir-no-jit
|
- package: torch-mlir-core
|
||||||
py_version: cp38-cp38
|
py_version: cp38-cp38
|
||||||
- package: torch-mlir-no-jit
|
- package: torch-mlir-core
|
||||||
py_version: cp310-cp310
|
py_version: cp310-cp310
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
|
@ -89,7 +89,7 @@ jobs:
|
||||||
runs-on: macos-latest
|
runs-on: macos-latest
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
package: [ torch-mlir, torch-mlir-no-jit ]
|
package: [ torch-mlir, torch-mlir-core ]
|
||||||
steps:
|
steps:
|
||||||
- name: Get torch-mlir
|
- name: Get torch-mlir
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v3
|
||||||
|
@ -147,6 +147,9 @@ jobs:
|
||||||
build_windows:
|
build_windows:
|
||||||
name: Windows Build
|
name: Windows Build
|
||||||
runs-on: windows-latest
|
runs-on: windows-latest
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
package: [ torch-mlir, torch-mlir-core ]
|
||||||
steps:
|
steps:
|
||||||
- name: Get torch-mlir
|
- name: Get torch-mlir
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v3
|
||||||
|
@ -162,6 +165,14 @@ jobs:
|
||||||
- name: Build Python wheels and smoke test.
|
- name: Build Python wheels and smoke test.
|
||||||
shell: pwsh
|
shell: pwsh
|
||||||
run: |
|
run: |
|
||||||
|
if ( "${{ matrix.package }}" -eq "torch-mlir-core" )
|
||||||
|
{
|
||||||
|
$env:TORCH_MLIR_ENABLE_JIT_IR_IMPORTER='0'
|
||||||
|
$env:TORCH_MLIR_ENABLE_ONLY_MLIR_PYTHON_BINDINGS='1'
|
||||||
|
} else {
|
||||||
|
$env:TORCH_MLIR_ENABLE_JIT_IR_IMPORTER='1'
|
||||||
|
$env:TORCH_MLIR_ENABLE_ONLY_MLIR_PYTHON_BINDINGS='0'
|
||||||
|
}
|
||||||
$env:TORCH_MLIR_PYTHON_PACKAGE_VERSION = '${{ github.event.inputs.python_package_version }}'
|
$env:TORCH_MLIR_PYTHON_PACKAGE_VERSION = '${{ github.event.inputs.python_package_version }}'
|
||||||
./build_tools/python_deploy/build_windows.ps1
|
./build_tools/python_deploy/build_windows.ps1
|
||||||
|
|
||||||
|
|
|
@ -48,7 +48,7 @@ TM_PYTHON_VERSIONS="${TM_PYTHON_VERSIONS:-cp38-cp38 cp310-cp310 cp311-cp311}"
|
||||||
# Location to store Release wheels
|
# Location to store Release wheels
|
||||||
TM_OUTPUT_DIR="${TM_OUTPUT_DIR:-${this_dir}/wheelhouse}"
|
TM_OUTPUT_DIR="${TM_OUTPUT_DIR:-${this_dir}/wheelhouse}"
|
||||||
# What "packages to build"
|
# What "packages to build"
|
||||||
TM_PACKAGES="${TM_PACKAGES:-torch-mlir torch-mlir-no-jit}"
|
TM_PACKAGES="${TM_PACKAGES:-torch-mlir torch-mlir-core}"
|
||||||
# Use pre-built Pytorch
|
# Use pre-built Pytorch
|
||||||
TM_USE_PYTORCH_BINARY="${TM_USE_PYTORCH_BINARY:-ON}"
|
TM_USE_PYTORCH_BINARY="${TM_USE_PYTORCH_BINARY:-ON}"
|
||||||
# Skip running tests if you want quick iteration
|
# Skip running tests if you want quick iteration
|
||||||
|
@ -84,7 +84,7 @@ function run_on_host() {
|
||||||
export USERID=0
|
export USERID=0
|
||||||
export GROUPID=0
|
export GROUPID=0
|
||||||
;;
|
;;
|
||||||
torch-mlir-no-jit)
|
torch-mlir-core)
|
||||||
TM_CURRENT_DOCKER_IMAGE=${TM_RELEASE_DOCKER_IMAGE}
|
TM_CURRENT_DOCKER_IMAGE=${TM_RELEASE_DOCKER_IMAGE}
|
||||||
export USERID=0
|
export USERID=0
|
||||||
export GROUPID=0
|
export GROUPID=0
|
||||||
|
@ -164,11 +164,11 @@ function run_in_docker() {
|
||||||
|
|
||||||
clean_build torch_mlir "$python_version"
|
clean_build torch_mlir "$python_version"
|
||||||
;;
|
;;
|
||||||
torch-mlir-no-jit)
|
torch-mlir-core)
|
||||||
clean_wheels torch_mlir_no_jit "$python_version"
|
clean_wheels torch_mlir_core "$python_version"
|
||||||
build_torch_mlir_no_jit
|
build_torch_mlir_core
|
||||||
run_audit_wheel torch_mlir_no_jit "$python_version"
|
run_audit_wheel torch_mlir_core "$python_version"
|
||||||
clean_build torch_mlir_no_jit "$python_version"
|
clean_build torch_mlir_core "$python_version"
|
||||||
;;
|
;;
|
||||||
out-of-tree)
|
out-of-tree)
|
||||||
setup_venv "$python_version"
|
setup_venv "$python_version"
|
||||||
|
@ -384,7 +384,7 @@ function run_audit_wheel() {
|
||||||
rm "$generic_wheel"
|
rm "$generic_wheel"
|
||||||
}
|
}
|
||||||
|
|
||||||
function build_torch_mlir_no_jit() {
|
function build_torch_mlir_core() {
|
||||||
python -m pip install --no-cache-dir -r /main_checkout/torch-mlir/build-requirements.txt
|
python -m pip install --no-cache-dir -r /main_checkout/torch-mlir/build-requirements.txt
|
||||||
CMAKE_GENERATOR=Ninja \
|
CMAKE_GENERATOR=Ninja \
|
||||||
TORCH_MLIR_PYTHON_PACKAGE_VERSION=${TORCH_MLIR_PYTHON_PACKAGE_VERSION} \
|
TORCH_MLIR_PYTHON_PACKAGE_VERSION=${TORCH_MLIR_PYTHON_PACKAGE_VERSION} \
|
||||||
|
@ -393,15 +393,6 @@ function build_torch_mlir_no_jit() {
|
||||||
python -m pip wheel -v -w /wheelhouse /main_checkout/torch-mlir
|
python -m pip wheel -v -w /wheelhouse /main_checkout/torch-mlir
|
||||||
}
|
}
|
||||||
|
|
||||||
function run_audit_wheel_no_jit() {
|
|
||||||
local wheel_basename="$1"
|
|
||||||
local python_version="$2"
|
|
||||||
generic_wheel="/wheelhouse/${wheel_basename}-${TORCH_MLIR_PYTHON_PACKAGE_VERSION}-${python_version}-linux_x86_64.whl"
|
|
||||||
echo ":::: Auditwheel $generic_wheel"
|
|
||||||
auditwheel repair -w /wheelhouse "$generic_wheel"
|
|
||||||
rm "$generic_wheel"
|
|
||||||
}
|
|
||||||
|
|
||||||
function clean_wheels() {
|
function clean_wheels() {
|
||||||
local wheel_basename="$1"
|
local wheel_basename="$1"
|
||||||
local python_version="$2"
|
local python_version="$2"
|
||||||
|
|
|
@ -61,10 +61,10 @@ function run() {
|
||||||
build_torch_mlir torch_mlir "$python_version"
|
build_torch_mlir torch_mlir "$python_version"
|
||||||
run_audit_wheel torch_mlir "$python_version"
|
run_audit_wheel torch_mlir "$python_version"
|
||||||
;;
|
;;
|
||||||
torch-mlir-no-jit)
|
torch-mlir-core)
|
||||||
clean_wheels torch_mlir_no_jit "$python_version"
|
clean_wheels torch_mlir_core "$python_version"
|
||||||
build_torch_mlir_no_jit torch_mlir_no_jit "$python_version"
|
build_torch_mlir_core torch_mlir_core "$python_version"
|
||||||
run_audit_wheel_no_jit torch_mlir_no_jit "$python_version"
|
run_audit_wheel torch_mlir_core "$python_version"
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
echo "Unrecognized package '$package'"
|
echo "Unrecognized package '$package'"
|
||||||
|
@ -93,7 +93,7 @@ function build_torch_mlir() {
|
||||||
rm -rf "$output_dir"/build_venv
|
rm -rf "$output_dir"/build_venv
|
||||||
}
|
}
|
||||||
|
|
||||||
function build_torch_mlir_no_jit() {
|
function build_torch_mlir_core() {
|
||||||
local wheel_basename="$1"
|
local wheel_basename="$1"
|
||||||
local python_version="$2"
|
local python_version="$2"
|
||||||
rm -rf "$output_dir"/build_venv
|
rm -rf "$output_dir"/build_venv
|
||||||
|
@ -141,24 +141,4 @@ function run_audit_wheel() {
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
function run_audit_wheel_no_jit() {
|
|
||||||
set +x
|
|
||||||
local wheel_basename="$1"
|
|
||||||
local python_version="$2"
|
|
||||||
generic_wheel=$(ls "$output_dir"/"${wheel_basename}"-* | grep "${python_version//./}")
|
|
||||||
echo "Looking for $generic_wheel"
|
|
||||||
if [ -f "$generic_wheel" ]; then
|
|
||||||
echo "$generic_wheel found. Delocating it.."
|
|
||||||
rm -rf "$output_dir"/test_venv
|
|
||||||
python"${python_version}" -m venv "$output_dir"/test_venv
|
|
||||||
source "$output_dir"/test_venv/bin/activate
|
|
||||||
python"${python_version}" -m pip install -U pip delocate
|
|
||||||
python"${python_version}" -m pip install -r "$repo_root"/build-requirements.txt
|
|
||||||
python"${python_version}" -m pip install "$generic_wheel"
|
|
||||||
DYLD_LIBRARY_PATH="$output_dir"/test_venv/lib/python"${python_version}"/site-packages/torch/lib delocate-wheel -v "$generic_wheel"
|
|
||||||
deactivate
|
|
||||||
rm -rf "$output_dir"/test_venv
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
run
|
run
|
||||||
|
|
2
setup.py
2
setup.py
|
@ -146,7 +146,7 @@ with open("README.md", "r", encoding="utf-8") as fh:
|
||||||
|
|
||||||
|
|
||||||
setup(
|
setup(
|
||||||
name="torch-mlir" if not TORCH_MLIR_ENABLE_ONLY_MLIR_PYTHON_BINDINGS else "torch-mlir-no-jit",
|
name="torch-mlir" if not TORCH_MLIR_ENABLE_ONLY_MLIR_PYTHON_BINDINGS else "torch-mlir-core",
|
||||||
version=f"{PACKAGE_VERSION}",
|
version=f"{PACKAGE_VERSION}",
|
||||||
author="Sean Silva",
|
author="Sean Silva",
|
||||||
author_email="silvasean@google.com",
|
author_email="silvasean@google.com",
|
||||||
|
|
Loading…
Reference in New Issue