mirror of https://github.com/llvm/torch-mlir
[Release] Fix binary name for downstream compatibility (#3752)
As of Sep 14, the torch-mlir binary [wheels](https://github.com/llvm/torch-mlir-release/releases/tag/dev-wheels) got renamed to `torch-mlir-core` from `torch-mlir`: ![image](https://github.com/user-attachments/assets/152e4977-71ef-4f57-8757-6dc75f72b670) This was an unintended side-effect of the recent change of `TORCH_MLIR_ENABLE_ONLY_MLIR_PYTHON_BINDINGS=True` (https://github.com/llvm/torch-mlir/pull/3711) which skips setting `NAME = "torch-mlir"` in [setup.py](https://github.com/llvm/torch-mlir/blob/main/setup.py#L226-L232). To avoid having multiple downstreams fix their pip deps, this change allows using the same `torch-mlir` name for binaries, and reserves a separate `torch-mlir-ext` name for the (less popular) binaries with extensions enabled.pull/3760/head
parent
a2bfe47faa
commit
f8e4a9a3c2
|
@ -50,7 +50,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-core}"
|
TM_PACKAGES="${TM_PACKAGES:-torch-mlir torch-mlir-ext}"
|
||||||
# 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
|
||||||
|
@ -83,12 +83,12 @@ function run_on_host() {
|
||||||
fi
|
fi
|
||||||
mkdir -p "${TM_OUTPUT_DIR}"
|
mkdir -p "${TM_OUTPUT_DIR}"
|
||||||
case "$package" in
|
case "$package" in
|
||||||
torch-mlir)
|
torch-mlir-ext)
|
||||||
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
|
||||||
;;
|
;;
|
||||||
torch-mlir-core)
|
torch-mlir)
|
||||||
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
|
||||||
|
@ -158,22 +158,22 @@ function run_in_docker() {
|
||||||
export PATH=$python_dir/bin:$orig_path
|
export PATH=$python_dir/bin:$orig_path
|
||||||
echo ":::: Python version $(python3 --version)"
|
echo ":::: Python version $(python3 --version)"
|
||||||
case "$package" in
|
case "$package" in
|
||||||
torch-mlir)
|
torch-mlir-ext)
|
||||||
clean_wheels torch_mlir "$python_version"
|
clean_wheels torch_mlir_ext "$python_version"
|
||||||
build_torch_mlir "$TM_TORCH_VERSION"
|
build_torch_mlir_ext "$TM_TORCH_VERSION"
|
||||||
|
|
||||||
# Disable audit wheel until we can fix ODR torch issues. See
|
# Disable audit wheel until we can fix ODR torch issues. See
|
||||||
# https://github.com/llvm/torch-mlir/issues/1709
|
# https://github.com/llvm/torch-mlir/issues/1709
|
||||||
#
|
#
|
||||||
#run_audit_wheel torch_mlir "$python_version"
|
#run_audit_wheel torch_mlir_ext "$python_version"
|
||||||
|
|
||||||
clean_build torch_mlir "$python_version"
|
clean_build torch_mlir_ext "$python_version"
|
||||||
;;
|
;;
|
||||||
torch-mlir-core)
|
torch-mlir)
|
||||||
clean_wheels torch_mlir_core "$python_version"
|
clean_wheels torch_mlir "$python_version"
|
||||||
build_torch_mlir_core
|
build_torch_mlir
|
||||||
run_audit_wheel torch_mlir_core "$python_version"
|
run_audit_wheel torch_mlir "$python_version"
|
||||||
clean_build torch_mlir_core "$python_version"
|
clean_build torch_mlir "$python_version"
|
||||||
;;
|
;;
|
||||||
out-of-tree)
|
out-of-tree)
|
||||||
setup_venv "$python_version" "$TM_TORCH_VERSION"
|
setup_venv "$python_version" "$TM_TORCH_VERSION"
|
||||||
|
@ -431,7 +431,7 @@ function clean_build() {
|
||||||
rm -rf /main_checkout/torch-mlir/build /main_checkout/torch-mlir/llvm-build /main_checkout/torch-mlir/docker_venv /main_checkout/torch-mlir/libtorch
|
rm -rf /main_checkout/torch-mlir/build /main_checkout/torch-mlir/llvm-build /main_checkout/torch-mlir/docker_venv /main_checkout/torch-mlir/libtorch
|
||||||
}
|
}
|
||||||
|
|
||||||
function build_torch_mlir() {
|
function build_torch_mlir_ext() {
|
||||||
# Disable LTC build for releases
|
# Disable LTC build for releases
|
||||||
export TORCH_MLIR_ENABLE_LTC=0
|
export TORCH_MLIR_ENABLE_LTC=0
|
||||||
local torch_version="$1"
|
local torch_version="$1"
|
||||||
|
@ -470,7 +470,9 @@ function run_audit_wheel() {
|
||||||
rm "$generic_wheel"
|
rm "$generic_wheel"
|
||||||
}
|
}
|
||||||
|
|
||||||
function build_torch_mlir_core() {
|
function build_torch_mlir() {
|
||||||
|
# Disable LTC build for releases
|
||||||
|
export TORCH_MLIR_ENABLE_LTC=0
|
||||||
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} \
|
||||||
|
|
|
@ -56,16 +56,16 @@ function run() {
|
||||||
export PATH=$python_dir/bin:$orig_path
|
export PATH=$python_dir/bin:$orig_path
|
||||||
echo ":::: Python version $(python3 --version)"
|
echo ":::: Python version $(python3 --version)"
|
||||||
case "$package" in
|
case "$package" in
|
||||||
|
torch-mlir-ext)
|
||||||
|
clean_wheels torch_mlir_ext "$python_version"
|
||||||
|
build_torch_mlir_ext torch_mlir_ext "$python_version"
|
||||||
|
run_audit_wheel torch_mlir_ext "$python_version"
|
||||||
|
;;
|
||||||
torch-mlir)
|
torch-mlir)
|
||||||
clean_wheels torch_mlir "$python_version"
|
clean_wheels torch_mlir "$python_version"
|
||||||
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-core)
|
|
||||||
clean_wheels torch_mlir_core "$python_version"
|
|
||||||
build_torch_mlir_core torch_mlir_core "$python_version"
|
|
||||||
run_audit_wheel torch_mlir_core "$python_version"
|
|
||||||
;;
|
|
||||||
*)
|
*)
|
||||||
echo "Unrecognized package '$package'"
|
echo "Unrecognized package '$package'"
|
||||||
exit 1
|
exit 1
|
||||||
|
@ -75,7 +75,7 @@ function run() {
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
function build_torch_mlir() {
|
function build_torch_mlir_ext() {
|
||||||
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
|
||||||
|
@ -93,7 +93,7 @@ function build_torch_mlir() {
|
||||||
rm -rf "$output_dir"/build_venv
|
rm -rf "$output_dir"/build_venv
|
||||||
}
|
}
|
||||||
|
|
||||||
function build_torch_mlir_core() {
|
function build_torch_mlir() {
|
||||||
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
|
||||||
|
|
4
setup.py
4
setup.py
|
@ -223,13 +223,13 @@ INSTALL_REQUIRES = [
|
||||||
EXT_MODULES = [
|
EXT_MODULES = [
|
||||||
CMakeExtension("torch_mlir._mlir_libs._torchMlir"),
|
CMakeExtension("torch_mlir._mlir_libs._torchMlir"),
|
||||||
]
|
]
|
||||||
NAME = "torch-mlir-core"
|
NAME = "torch-mlir"
|
||||||
|
|
||||||
# If building PyTorch extensions, customize.
|
# If building PyTorch extensions, customize.
|
||||||
if not TORCH_MLIR_ENABLE_ONLY_MLIR_PYTHON_BINDINGS:
|
if not TORCH_MLIR_ENABLE_ONLY_MLIR_PYTHON_BINDINGS:
|
||||||
import torch
|
import torch
|
||||||
|
|
||||||
NAME = "torch-mlir"
|
NAME = "torch-mlir-ext"
|
||||||
INSTALL_REQUIRES.extend(
|
INSTALL_REQUIRES.extend(
|
||||||
[
|
[
|
||||||
f"torch=={torch.__version__}".split("+", 1)[0],
|
f"torch=={torch.__version__}".split("+", 1)[0],
|
||||||
|
|
Loading…
Reference in New Issue