Skip to content

Commit 3c91e34

Browse files
erwei-xilinxclaude
andcommitted
Move backend deps to extras_require, not install_requires
AIR supports multiple backends (AIE, GPU, VCK5000); making mlir_aie a hard `Requires-Dist` would force it on users targeting other backends. Use the standard pip extras pattern instead — the AIE backend deps live under the `[aie]` extra and pip's METADATA records them via `Provides-Extra: aie` + `Requires-Dist: mlir_aie==X; extra == "aie"`. Same effect for AIE users (`pip install 'mlir_air[aie]' -f ... -f ...` resolves the pinned mlir_aie automatically) but `pip install mlir_air` on its own remains backend-agnostic. - setup.py: replace get_install_requires() with get_extras_require(); put mlir_aie + llvm-aie under extras["aie"]. - buildAIRWheels.yml + buildingRyzenLin.md: install command becomes `pip install 'mlir_air[aie]' ...`. Mention the extra explicitly so users know how to skip it for non-AIE backends. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 24c8b6d commit 3c91e34

3 files changed

Lines changed: 30 additions & 22 deletions

File tree

.github/workflows/buildAIRWheels.yml

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -282,15 +282,17 @@ jobs:
282282
283283
### Installation
284284
285-
The `mlir_air` wheel declares `mlir_aie` (pinned) and `llvm-aie` as runtime dependencies, so a single `pip install` with the right `--find-links` pages resolves the whole stack:
285+
AIR supports multiple backends (AIE, GPU, VCK5000); backend dependencies are exposed as pip extras. For the AIE backend, the `[aie]` extra pulls the matching pinned `mlir_aie` and `llvm-aie` from the additional `--find-links` pages:
286286
287287
```bash
288-
pip install mlir_air \
288+
pip install 'mlir_air[aie]' \
289289
-f https://github.com/Xilinx/mlir-air/releases/expanded_assets/${{ matrix.ENABLE_RTTI == 'ON' && 'latest-air-wheels' || 'latest-air-wheels-no-rtti' }} \
290290
-f https://github.com/Xilinx/mlir-aie/releases/expanded_assets/${{ matrix.ENABLE_RTTI == 'ON' && 'latest-wheels-3' || 'latest-wheels-no-rtti' }} \
291291
-f https://github.com/Xilinx/llvm-aie/releases/expanded_assets/nightly
292292
```
293293
294+
Drop the `[aie]` extra to install AIR core only (e.g. when bringing your own backend).
295+
294296
### RTTI / no-RTTI Variants
295297
296298
Both RTTI-enabled and RTTI-disabled wheels are released for downstream integration convenience:
@@ -471,15 +473,17 @@ jobs:
471473
472474
### Installation
473475
474-
The `mlir_air` wheel declares `mlir_aie` (pinned) and `llvm-aie` as runtime dependencies, so a single `pip install` with the right `--find-links` pages resolves the whole stack:
476+
AIR supports multiple backends (AIE, GPU, VCK5000); backend dependencies are exposed as pip extras. For the AIE backend, the `[aie]` extra pulls the matching pinned `mlir_aie` and `llvm-aie` from the additional `--find-links` pages:
475477
476478
```bash
477-
pip install mlir_air \
479+
pip install 'mlir_air[aie]' \
478480
-f https://github.com/Xilinx/mlir-air/releases/expanded_assets/${{ matrix.ENABLE_RTTI == 'ON' && 'latest-air-wheels' || 'latest-air-wheels-no-rtti' }} \
479481
-f https://github.com/Xilinx/mlir-aie/releases/expanded_assets/${{ matrix.ENABLE_RTTI == 'ON' && 'latest-wheels-3' || 'latest-wheels-no-rtti' }} \
480482
-f https://github.com/Xilinx/llvm-aie/releases/expanded_assets/nightly
481483
```
482484
485+
Drop the `[aie]` extra to install AIR core only (e.g. when bringing your own backend).
486+
483487
### RTTI / no-RTTI Variants
484488
485489
Both RTTI-enabled and RTTI-disabled wheels are released for downstream integration convenience:

docs/buildingRyzenLin.md

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ The fastest way to get MLIR-AIR is to install the prebuilt wheel — no source b
1414
1515
### Steps
1616

17-
MLIR-AIR depends on **MLIR-AIE** and **Peano (`llvm-aie`)** at compile/run time. The `mlir_air` wheel declares both as runtime dependencies (`mlir_aie` is pinned to the exact version AIR was built and tested against), so a single `pip install` with the right `--find-links` pages installs the whole stack — no clone, no helper script.
17+
AIR supports multiple backends — AIE (NPU / Versal AI Engines), [GPU](buildingGPU.md), and [VCK5000](buildingVCK5000.md). Backend dependencies are exposed as pip **extras** so you only install what you need. For the AIE backend on Ryzen™ AI, use the `[aie]` extra; pip reads the pinned `mlir_aie==<version>` and `llvm-aie` from the wheel's metadata and resolves them from the additional `--find-links` pages.
1818

1919
1. **Create a virtual environment:**
2020
```bash
@@ -23,15 +23,17 @@ MLIR-AIR depends on **MLIR-AIE** and **Peano (`llvm-aie`)** at compile/run time.
2323
pip install --upgrade pip
2424
```
2525

26-
2. **Install MLIR-AIR and its pinned dependencies:**
26+
2. **Install MLIR-AIR with the AIE backend:**
2727
```bash
28-
pip install mlir_air \
28+
pip install 'mlir_air[aie]' \
2929
-f https://github.com/Xilinx/mlir-air/releases/expanded_assets/latest-air-wheels \
3030
-f https://github.com/Xilinx/mlir-aie/releases/expanded_assets/latest-wheels-3 \
3131
-f https://github.com/Xilinx/llvm-aie/releases/expanded_assets/nightly
3232
```
3333

34-
Pip reads the `mlir_aie==<pinned>` and `llvm-aie` requirements from `mlir_air`'s wheel metadata and resolves them from the additional `--find-links` pages. The exact pinned `mlir_aie` version this AIR wheel was tested against is shown on the [release page](https://github.com/Xilinx/mlir-air/releases/tag/latest-air-wheels).
34+
The `[aie]` extra pulls `mlir_aie` (pinned to the exact version this AIR wheel was tested against) and `llvm-aie` (the Peano backend compiler — nightly). The pinned `mlir_aie` version is shown on the [release page](https://github.com/Xilinx/mlir-air/releases/tag/latest-air-wheels).
35+
36+
To install AIR core only (e.g. when bringing your own backend), drop the `[aie]` extra and the last two `-f` flags.
3537

3638
3. **Set up environment variables** (paths derived from `pip show`):
3739
```bash
@@ -67,7 +69,7 @@ We release **both RTTI and no-RTTI variants** so downstream projects can match t
6769
For the no-RTTI variant, point both find-links at the no-RTTI pages so pip resolves the matching `mlir_aie`:
6870

6971
```bash
70-
pip install mlir_air \
72+
pip install 'mlir_air[aie]' \
7173
-f https://github.com/Xilinx/mlir-air/releases/expanded_assets/latest-air-wheels-no-rtti \
7274
-f https://github.com/Xilinx/mlir-aie/releases/expanded_assets/latest-wheels-no-rtti \
7375
-f https://github.com/Xilinx/llvm-aie/releases/expanded_assets/nightly

utils/mlir_air_wheels/setup.py

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -304,21 +304,22 @@ def parse_requirements(filename):
304304
]
305305

306306

307-
def get_install_requires():
308-
reqs = parse_requirements(Path(__file__).parent / "requirements.txt")
309-
# Pin mlir_aie to the version this AIR wheel was built and tested
310-
# against, so users only need a single `pip install mlir_air -f ... -f
311-
# ...` and pip resolves the matching mlir_aie wheel automatically.
312-
# Falls back to no pin when MLIR_AIE_VERSION isn't set (e.g. local dev
313-
# builds outside CI).
307+
def get_extras_require():
308+
# AIR supports multiple backends (AIE, GPU, VCK5000), so backend
309+
# dependencies live in `extras_require` rather than `install_requires`.
310+
# `pip install mlir_air[aie]` pulls the matching mlir_aie + Peano;
311+
# users targeting other backends skip the extra.
312+
extras = {}
314313
mlir_aie_version = os.getenv("MLIR_AIE_VERSION", "")
315314
if mlir_aie_version:
316315
no_rtti_dot = "" if check_env("ENABLE_RTTI", 1) else ".no.rtti"
317-
reqs.append(f"mlir_aie=={mlir_aie_version}{no_rtti_dot}")
318-
# Peano (Xilinx llvm-aie) is the AIE backend compiler. No version pin
319-
# — AIR tracks the nightly build.
320-
reqs.append("llvm-aie")
321-
return reqs
316+
# mlir_aie is pinned to the version this AIR wheel was built and
317+
# tested against. llvm-aie (Peano) tracks nightly — no pin.
318+
extras["aie"] = [
319+
f"mlir_aie=={mlir_aie_version}{no_rtti_dot}",
320+
"llvm-aie",
321+
]
322+
return extras
322323

323324

324325
setup(
@@ -334,5 +335,6 @@ def get_install_requires():
334335
zip_safe=False,
335336
packages=find_packages(exclude=["wheelhouse", "mlir-air"]),
336337
python_requires=">=3.10",
337-
install_requires=get_install_requires(),
338+
install_requires=parse_requirements(Path(__file__).parent / "requirements.txt"),
339+
extras_require=get_extras_require(),
338340
)

0 commit comments

Comments
 (0)