mirror of
https://github.com/mudler/LocalAI.git
synced 2026-09-17 00:40:52 -04:00
Prefer an explicitly configured Triton assembler, otherwise use the executable ptxas from CUDA_HOME so torch.compile can target GPU architectures newer than Triton bundled tooling. Assisted-by: Codex:gpt-5 Signed-off-by: Ettore Di Giacinto <mudler@localai.io>
40 lines
1.1 KiB
Bash
40 lines
1.1 KiB
Bash
#!/bin/bash
|
|
set -euo pipefail
|
|
|
|
WORK=$(mktemp -d)
|
|
trap 'rm -rf "$WORK"' EXIT
|
|
|
|
REPO_ROOT=$(dirname "$(dirname "$(dirname "$(realpath "$0")")")")
|
|
BACKEND_DIR="$WORK/fish-speech"
|
|
mkdir -p "$BACKEND_DIR/common" "$WORK/cuda/bin"
|
|
cp "$REPO_ROOT/backend/python/fish-speech/run.sh" "$BACKEND_DIR/run.sh"
|
|
|
|
cat > "$BACKEND_DIR/common/libbackend.sh" <<'LIBBACKEND'
|
|
startBackend() {
|
|
printf '%s\n' "${TRITON_PTXAS_PATH:-}"
|
|
}
|
|
LIBBACKEND
|
|
|
|
fail() {
|
|
echo "FAIL: $*"
|
|
exit 1
|
|
}
|
|
|
|
touch "$WORK/cuda/bin/ptxas"
|
|
chmod +x "$WORK/cuda/bin/ptxas"
|
|
|
|
got=$(CUDA_HOME="$WORK/cuda" bash "$BACKEND_DIR/run.sh")
|
|
[ "$got" = "$WORK/cuda/bin/ptxas" ] || \
|
|
fail "expected toolkit ptxas, got '$got'"
|
|
|
|
got=$(CUDA_HOME="$WORK/cuda" TRITON_PTXAS_PATH=/custom/ptxas \
|
|
bash "$BACKEND_DIR/run.sh")
|
|
[ "$got" = "/custom/ptxas" ] || \
|
|
fail "explicit TRITON_PTXAS_PATH was overwritten with '$got'"
|
|
|
|
chmod -x "$WORK/cuda/bin/ptxas"
|
|
got=$(CUDA_HOME="$WORK/cuda" bash "$BACKEND_DIR/run.sh")
|
|
[ -z "$got" ] || fail "non-executable ptxas was selected as '$got'"
|
|
|
|
echo "PASS: fish-speech selects a usable toolkit ptxas"
|