Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 27 additions & 6 deletions build-scripts/build_portable.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@
# Linux build, _rocm_sdk_core\bin must NOT be removed.
#
# Usage: build_portable.ps1 <gfx_target>
# <gfx_target> is either an exact device (gfx1151) or a family name that
# expands to every device variant of that family (gfx103X, gfx110X,
# gfx120X) - see the device-extras mapping below.
#
# Environment overrides (all optional):
# THENOISE_ROOT output bundle root (default: $env:RUNNER_TEMP\thenoise-build\thenoise)
Expand All @@ -40,9 +43,6 @@ param(

$ErrorActionPreference = "Stop"

# torch wheel device spec: gfx115X -> gfx1150 (mirror build_portable.sh).
$GfxArch = $GfxTarget -creplace 'X', '0'

$Root = $env:THENOISE_ROOT
if (-not $Root) {
$base = if ($env:RUNNER_TEMP) { $env:RUNNER_TEMP } else { $env:TEMP }
Expand All @@ -64,6 +64,27 @@ $Py = Join-Path $Root "python.exe"
function say { param([string]$m) Write-Host "[build] $m" -ForegroundColor Blue }
function warn { param([string]$m) Write-Host "[build:warning] $m" -ForegroundColor Yellow }

# ------------------------------------------- gfx target -> wheel device extras --
# The torch/torchvision wheels on the AMD index expose one extra PER DEVICE
# (device-gfx1030 ... device-gfx1036, device-gfx1100 ... device-gfx1103,
# device-gfx1200/1201/1250, ...); there is no device-gfx103X / gfx110X /
# gfx120X extra. So the "family" targets used by CI must expand to every
# variant in the family.
switch -CaseSensitive ($GfxTarget) {
"gfx103X" { $GfxDevices = "device-gfx1030,device-gfx1031,device-gfx1032,device-gfx1033,device-gfx1034,device-gfx1035,device-gfx1036"; break }
"gfx110X" { $GfxDevices = "device-gfx1100,device-gfx1101,device-gfx1102,device-gfx1103"; break }
"gfx120X" { $GfxDevices = "device-gfx1200,device-gfx1201,device-gfx1250"; break }
default {
if ($GfxTarget -clike "*X") {
$fallback = $GfxTarget -creplace 'X', '0'
warn "no device list for family target '$GfxTarget'; falling back to X->0 ($fallback). Add a case above if this family has more than one SKU."
$GfxDevices = "device-$fallback"
} else {
$GfxDevices = "device-$GfxTarget"
}
}
}

# pip helper with a raised recursion limit. Some large dependency graphs (e.g.
# vLLM's) make pip's resolvelib RecursionError; thenoise's is simpler, but this
# is cheap insurance and harmless.
Expand Down Expand Up @@ -101,14 +122,14 @@ if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }

# ---------------------------------------------------------- 2. torch + deps --
say "Installing torch $TorchVer for $GfxTarget"
say "Installing torch $TorchVer for $GfxTarget ($GfxDevices)"
$env:PATH = "$Root;${Root}\Scripts;$env:PATH"
pip-deep install --index-url $TorchIndex `
--extra-index-url https://pypi.org/simple/ `
"torch[device-${GfxArch}]==${TorchVer}"
"torch[${GfxDevices}]==${TorchVer}"
pip-deep install --index-url $TorchIndex `
--extra-index-url https://pypi.org/simple/ `
"torchvision[device-${GfxArch}]==${TorchVisionVer}"
"torchvision[${GfxDevices}]==${TorchVisionVer}"
pip-deep install "triton-windows<3.9"

say "Installing thenoise + dependencies (from $RepoRoot)"
Expand Down
29 changes: 25 additions & 4 deletions build-scripts/build_portable.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@
#
# Usage: build_portable.sh <gfx_target>
#
# <gfx_target> is either an exact device (gfx1151) or a family name that
# expands to every device variant of that family (gfx103X, gfx110X, gfx120X)
# — see the device-extras mapping below.
#
# Environment overrides (all optional):
# THENOISE_ROOT output bundle root (default: $RUNNER_TEMP/thenoise-build/thenoise)
# PBS_TAG python-build-standalone release tag
Expand All @@ -24,7 +28,6 @@
set -euo pipefail

GFX_TARGET="${1:?usage: build_portable.sh <gfx_target>}"
GFX_ARCH="${GFX_TARGET//X/0}"
ROOT="${THENOISE_ROOT:-${RUNNER_TEMP:-/tmp}/thenoise-build/thenoise}"
REPO_ROOT="$(cd "$(dirname "$0")/.." && pwd)"

Expand All @@ -42,6 +45,24 @@ PY="$ROOT/bin/python${PYVER}"
say() { printf '\033[1;34m[build] %s\033[0m\n' "$*"; }
warn() { printf '\033[1;33m[build:warning] %s\033[0m\n' "$*"; }

# ------------------------------------------- gfx target -> wheel device extras --
# The torch/torchvision wheels on the AMD index expose one extra PER DEVICE
# (device-gfx1030 ... device-gfx1036, device-gfx1100 ... device-gfx1103,
# device-gfx1200/1201/1250, ...); there is no device-gfx103X / gfx110X /
# gfx120X extra. So the "family" targets used by CI must expand to every
# variant in the family.

case "$GFX_TARGET" in
gfx103X) GFX_DEVICES="device-gfx1030,device-gfx1031,device-gfx1032,device-gfx1033,device-gfx1034,device-gfx1035,device-gfx1036" ;;
gfx110X) GFX_DEVICES="device-gfx1100,device-gfx1101,device-gfx1102,device-gfx1103" ;;
gfx120X) GFX_DEVICES="device-gfx1200,device-gfx1201,device-gfx1250" ;;
*X)
warn "no device list for family target '$GFX_TARGET'; falling back to X->0 (${GFX_TARGET//X/0}). Add a case above if this family has more than one SKU."
GFX_DEVICES="device-${GFX_TARGET//X/0}" ;;
*)
GFX_DEVICES="device-${GFX_TARGET}" ;;
esac

# pip helper with a raised recursion limit. Some large dependency graphs (e.g.
# vLLM's) make pip's resolvelib RecursionError; thenoise's is simpler, but this
# is cheap insurance and harmless.
Expand Down Expand Up @@ -96,14 +117,14 @@ rm -rf "$PY_TMP"
"$PY" -m pip install --upgrade pip setuptools wheel

# ---------------------------------------------------------- 2. torch + deps --
say "Installing torch ${TORCH_VER} for ${GFX_TARGET}"
say "Installing torch ${TORCH_VER} for ${GFX_TARGET} (${GFX_DEVICES})"
export PATH="$ROOT/bin:$PATH"
pip_deep install --index-url "$TORCH_INDEX" \
--extra-index-url https://pypi.org/simple/ \
"torch[device-${GFX_ARCH}]==${TORCH_VER}"
"torch[${GFX_DEVICES}]==${TORCH_VER}"
pip_deep install --index-url "$TORCH_INDEX" \
--extra-index-url https://pypi.org/simple/ \
"torchvision[device-${GFX_ARCH}]==${TORCHVISION_VER}"
"torchvision[${GFX_DEVICES}]==${TORCHVISION_VER}"

say "Installing thenoise + dependencies (from $REPO_ROOT)"
# torch is intentionally absent from pyproject.toml. But a constraints file is cheap insurance
Expand Down
Loading