unsloth/.github/workflows
Daniel Han 70926822db
studio/setup.sh: guard empty CUDA arch detection in the source build (#5854) (#6481)
* studio/setup.sh: guard empty CUDA arch detection in the source build

PR #5826 hardened setup.sh for fresh CUDA toolkits, but the source build
still set -DCMAKE_CUDA_ARCHITECTURES only when nvidia-smi reported a
compute capability. When that query returns nothing the build proceeded
with no explicit arch list, so llama.cpp built PTX only. On a driver older
than the toolkit that binary fails at runtime with "the provided PTX was
compiled with an unsupported toolchain" - the build succeeds, so neither
the build-time check nor the CPU fallback caught it (issue #5854).

Resolve the arch list before committing to a CUDA build. A new pure helper
_resolve_cuda_archs parses and de-duplicates the nvidia-smi compute_cap
output and honors an explicit UNSLOTH_LLAMA_CUDA_ARCHS override. When the
result is empty, build CPU llama.cpp instead of a PTX-only binary, with a
clear message pointing at the override - so the user still ends up with a
working llama-server. The override also lets advanced users force a native
build on hosts where nvidia-smi cannot report compute_cap.

No behavior change when an arch is detected: -DGGML_CUDA=ON plus the arch,
CUDA flags and NVCC_PREPEND_FLAGS are assembled exactly as before.

Adds tests/sh/test_resolve_cuda_archs.sh (single/multi/dedup/empty/garbage/
whitespace/override cases), wired into tests/run_all.sh and the
studio-backend-ci.yml shell-test loop.

* studio/setup.sh: resolve nvidia-smi via /usr/bin fallback for arch detection

Addresses review feedback on the empty-CUDA-arch guard: _setup_has_usable_nvidia_gpu
classifies a host as NVIDIA-usable using nvidia-smi on PATH OR /usr/bin/nvidia-smi,
but the new arch detection probed only `command -v nvidia-smi`. On a GPU host where
nvidia-smi is off PATH (reachable only at /usr/bin), arch detection returned empty
and the new empty-arch branch dropped the build to CPU, losing CUDA. Mirror the same
PATH-then-/usr/bin resolution so those hosts still get a native CUDA build.

Also scope _resolve_cuda_archs locals with `local` (no behavior change; it already
runs under command substitution).

* tests: update compute_cap-probe assertion for $_smi_bin resolution

The nvidia-smi /usr/bin fallback parameterized the binary in the compute_cap
probe (_setup_run_smi "$_smi_bin" ...), so the literal-string assertion in
test_compute_cap_probe_timeout_wrapped no longer matched. Assert the probe is
preceded by _setup_run_smi (timeout-wrapped) instead, scanning all occurrences
so the comment mention is ignored. Same intent, binary-agnostic.

* tests: ruff-format the compute_cap probe assertion (pre-commit)

Collapse the backslash-continued assert onto one line and normalize slice
spacing so the ruff-format pre-commit hook (0.6.9) is satisfied. Formatting
only; no behavior change.

* Tighten code comments (no logic change)

* studio(windows): build CPU when CUDA arch is undetectable (#5854)

The Windows source build added -DGGML_CUDA=ON unconditionally but only set
-DCMAKE_CUDA_ARCHITECTURES when $CudaArch was detected. With no detectable
compute capability that produced a PTX-only binary, the same hole the Linux
fix closed. Build CPU llama.cpp in that case, and honor UNSLOTH_LLAMA_CUDA_ARCHS
to force a CUDA build, matching setup.sh. Detected-arch builds are unchanged.

* test: anchor NVCC_PREPEND_FLAGS scope check on the final CPU branch

The undetectable-arch CPU fallback adds an earlier -DGGML_CUDA=OFF, so the
ordering check now anchors on -DGGML_CUDA=ON and the last -DGGML_CUDA=OFF
instead of the first.

---------

Co-authored-by: Daniel Han <michaelhan2050@gmail.com>
2026-06-23 01:26:43 -07:00
..
consolidated-tests-ci.yml CI: fix import-hoist false positive, vision-cache test cwd, llama.cpp CLI smoke (#6598) 2026-06-23 01:16:47 -07:00
cross-platform-parity-ci.yml Run cross-platform parity test on Windows and macOS in CI (#6241) 2026-06-12 03:40:50 -07:00
lint-ci.yml Lint CI: diff import-hoist check against the PR merge-base, not the base tip (#6190) 2026-06-11 04:23:41 -07:00
local-agent-guides-ci.yml Add Local Agent Guides CI (#6547) 2026-06-22 04:21:48 -07:00
lockfile-audit.yml ci: advisory lockfile supply-chain audit (no install-script changes) (#5604) 2026-05-19 05:56:56 -07:00
mlx-ci.yml MLX CI: drop removed --simple-policy and stale ggml-org pin from the prebuilt step (#6189) 2026-06-11 00:00:50 -07:00
notebooks-ci.yml ci: install unsloth_zoo from git main in notebooks-ci + studio-backend-ci (#5802) 2026-05-27 01:35:13 -07:00
release-desktop.yml Fix Windows workflow issues(#5694) 2026-05-22 05:32:30 -07:00
security-audit.yml Package scanners: cut false positives and make the CI gate blocking (#6355) 2026-06-16 01:46:15 -07:00
stale.yml CI: scope GITHUB_TOKEN permissions, add MLX CI, unblock ~60 skipped tests (#5312) 2026-05-11 03:19:13 -07:00
studio-api-smoke.yml Studio CI: stop HF 429 rate limits from sinking the llama.cpp prebuilt path (#6199) 2026-06-11 06:57:48 -07:00
studio-backend-ci.yml studio/setup.sh: guard empty CUDA arch detection in the source build (#5854) (#6481) 2026-06-23 01:26:43 -07:00
studio-frontend-ci.yml Frontend CI: hard-fail unreviewed npm install scripts (#6139) 2026-06-10 06:10:16 -07:00
studio-inference-smoke.yml ci(studio): fix Linux tool-calling flake (Q4_K_XL) + capture server logs (#6360) 2026-06-16 03:43:35 -07:00
studio-load-orchestrator-ci.yml studio: unblock /load event loop on detect_audio_type (#5642, #5635) (#5669) 2026-05-22 05:47:58 -07:00
studio-mac-api-smoke.yml Studio CI: stop HF 429 rate limits from sinking the llama.cpp prebuilt path (#6199) 2026-06-11 06:57:48 -07:00
studio-mac-inference-smoke.yml Studio CI: stop HF 429 rate limits from sinking the llama.cpp prebuilt path (#6199) 2026-06-11 06:57:48 -07:00
studio-mac-install-matrix.yml Studio CI: stop HF 429 rate limits from sinking the llama.cpp prebuilt path (#6199) 2026-06-11 06:57:48 -07:00
studio-mac-ui-smoke.yml Studio CI: stop HF 429 rate limits from sinking the llama.cpp prebuilt path (#6199) 2026-06-11 06:57:48 -07:00
studio-mac-update-smoke.yml Studio CI: stop HF 429 rate limits from sinking the llama.cpp prebuilt path (#6199) 2026-06-11 06:57:48 -07:00
studio-tauri-smoke.yml ci: drop cache: 'npm' from setup-node (silent abort on Windows) (#5474) 2026-05-15 20:49:05 -07:00
studio-ui-smoke.yml ci(studio): fix Linux tool-calling flake (Q4_K_XL) + capture server logs (#6360) 2026-06-16 03:43:35 -07:00
studio-update-smoke.yml Studio CI: stop HF 429 rate limits from sinking the llama.cpp prebuilt path (#6199) 2026-06-11 06:57:48 -07:00
studio-windows-api-smoke.yml Studio CI: stop HF 429 rate limits from sinking the llama.cpp prebuilt path (#6199) 2026-06-11 06:57:48 -07:00
studio-windows-inference-smoke.yml Windows installer: fix DiskPart UAC mid-install, drive-root cache, and spurious unsloth.exe rename warning (#6296) 2026-06-22 03:09:08 -07:00
studio-windows-ui-smoke.yml Studio: remove the Windows VBS launcher to clear the Kaspersky false positive (#6326) 2026-06-16 04:00:18 -07:00
studio-windows-update-smoke.yml Studio: use an isolated Node.js for the frontend build instead of replacing the system Node/npm (#6533) 2026-06-21 21:17:29 -07:00
version-compat-ci.yml tests: pinned-symbol canary for unsloth-zoo save_pretrained_merged guards (#5410) (#5433) 2026-05-17 01:35:28 -07:00
wheel-smoke.yml ci: drop cache: 'npm' from setup-node (silent abort on Windows) (#5474) 2026-05-15 20:49:05 -07:00