Skip to content

Commit f8e4a9a

Browse files
[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` (#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.
1 parent a2bfe47 commit f8e4a9a

File tree

3 files changed

+26
-24
lines changed

3 files changed

+26
-24
lines changed

build_tools/python_deploy/build_linux_packages.sh

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ TM_PYTHON_VERSIONS="${TM_PYTHON_VERSIONS:-cp38-cp38 cp310-cp310 cp311-cp311}"
5050
# Location to store Release wheels
5151
TM_OUTPUT_DIR="${TM_OUTPUT_DIR:-${this_dir}/wheelhouse}"
5252
# What "packages to build"
53-
TM_PACKAGES="${TM_PACKAGES:-torch-mlir torch-mlir-core}"
53+
TM_PACKAGES="${TM_PACKAGES:-torch-mlir torch-mlir-ext}"
5454
# Use pre-built Pytorch
5555
TM_USE_PYTORCH_BINARY="${TM_USE_PYTORCH_BINARY:-ON}"
5656
# Skip running tests if you want quick iteration
@@ -83,12 +83,12 @@ function run_on_host() {
8383
fi
8484
mkdir -p "${TM_OUTPUT_DIR}"
8585
case "$package" in
86-
torch-mlir)
86+
torch-mlir-ext)
8787
TM_CURRENT_DOCKER_IMAGE=${TM_RELEASE_DOCKER_IMAGE}
8888
export USERID=0
8989
export GROUPID=0
9090
;;
91-
torch-mlir-core)
91+
torch-mlir)
9292
TM_CURRENT_DOCKER_IMAGE=${TM_RELEASE_DOCKER_IMAGE}
9393
export USERID=0
9494
export GROUPID=0
@@ -158,22 +158,22 @@ function run_in_docker() {
158158
export PATH=$python_dir/bin:$orig_path
159159
echo ":::: Python version $(python3 --version)"
160160
case "$package" in
161-
torch-mlir)
162-
clean_wheels torch_mlir "$python_version"
163-
build_torch_mlir "$TM_TORCH_VERSION"
161+
torch-mlir-ext)
162+
clean_wheels torch_mlir_ext "$python_version"
163+
build_torch_mlir_ext "$TM_TORCH_VERSION"
164164

165165
# Disable audit wheel until we can fix ODR torch issues. See
166166
# https://github.com/llvm/torch-mlir/issues/1709
167167
#
168-
#run_audit_wheel torch_mlir "$python_version"
168+
#run_audit_wheel torch_mlir_ext "$python_version"
169169

170-
clean_build torch_mlir "$python_version"
170+
clean_build torch_mlir_ext "$python_version"
171171
;;
172-
torch-mlir-core)
173-
clean_wheels torch_mlir_core "$python_version"
174-
build_torch_mlir_core
175-
run_audit_wheel torch_mlir_core "$python_version"
176-
clean_build torch_mlir_core "$python_version"
172+
torch-mlir)
173+
clean_wheels torch_mlir "$python_version"
174+
build_torch_mlir
175+
run_audit_wheel torch_mlir "$python_version"
176+
clean_build torch_mlir "$python_version"
177177
;;
178178
out-of-tree)
179179
setup_venv "$python_version" "$TM_TORCH_VERSION"
@@ -431,7 +431,7 @@ function clean_build() {
431431
rm -rf /main_checkout/torch-mlir/build /main_checkout/torch-mlir/llvm-build /main_checkout/torch-mlir/docker_venv /main_checkout/torch-mlir/libtorch
432432
}
433433

434-
function build_torch_mlir() {
434+
function build_torch_mlir_ext() {
435435
# Disable LTC build for releases
436436
export TORCH_MLIR_ENABLE_LTC=0
437437
local torch_version="$1"
@@ -470,7 +470,9 @@ function run_audit_wheel() {
470470
rm "$generic_wheel"
471471
}
472472

473-
function build_torch_mlir_core() {
473+
function build_torch_mlir() {
474+
# Disable LTC build for releases
475+
export TORCH_MLIR_ENABLE_LTC=0
474476
python -m pip install --no-cache-dir -r /main_checkout/torch-mlir/build-requirements.txt
475477
CMAKE_GENERATOR=Ninja \
476478
TORCH_MLIR_PYTHON_PACKAGE_VERSION=${TORCH_MLIR_PYTHON_PACKAGE_VERSION} \

build_tools/python_deploy/build_macos_packages.sh

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -56,16 +56,16 @@ function run() {
5656
export PATH=$python_dir/bin:$orig_path
5757
echo ":::: Python version $(python3 --version)"
5858
case "$package" in
59+
torch-mlir-ext)
60+
clean_wheels torch_mlir_ext "$python_version"
61+
build_torch_mlir_ext torch_mlir_ext "$python_version"
62+
run_audit_wheel torch_mlir_ext "$python_version"
63+
;;
5964
torch-mlir)
6065
clean_wheels torch_mlir "$python_version"
6166
build_torch_mlir torch_mlir "$python_version"
6267
run_audit_wheel torch_mlir "$python_version"
6368
;;
64-
torch-mlir-core)
65-
clean_wheels torch_mlir_core "$python_version"
66-
build_torch_mlir_core torch_mlir_core "$python_version"
67-
run_audit_wheel torch_mlir_core "$python_version"
68-
;;
6969
*)
7070
echo "Unrecognized package '$package'"
7171
exit 1
@@ -75,7 +75,7 @@ function run() {
7575
done
7676
}
7777

78-
function build_torch_mlir() {
78+
function build_torch_mlir_ext() {
7979
local wheel_basename="$1"
8080
local python_version="$2"
8181
rm -rf "$output_dir"/build_venv
@@ -93,7 +93,7 @@ function build_torch_mlir() {
9393
rm -rf "$output_dir"/build_venv
9494
}
9595

96-
function build_torch_mlir_core() {
96+
function build_torch_mlir() {
9797
local wheel_basename="$1"
9898
local python_version="$2"
9999
rm -rf "$output_dir"/build_venv

setup.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -223,13 +223,13 @@ def build_extension(self, ext):
223223
EXT_MODULES = [
224224
CMakeExtension("torch_mlir._mlir_libs._torchMlir"),
225225
]
226-
NAME = "torch-mlir-core"
226+
NAME = "torch-mlir"
227227

228228
# If building PyTorch extensions, customize.
229229
if not TORCH_MLIR_ENABLE_ONLY_MLIR_PYTHON_BINDINGS:
230230
import torch
231231

232-
NAME = "torch-mlir"
232+
NAME = "torch-mlir-ext"
233233
INSTALL_REQUIRES.extend(
234234
[
235235
f"torch=={torch.__version__}".split("+", 1)[0],

0 commit comments

Comments
 (0)