Studio: forward the resolved GPU kind to the source-build smoke test

The post-build smoke test relied on the installer re-detecting the GPU, but on
amd-smi-only or name-inferred ROCm hosts that probe can miss the GPU and resolve
a CPU kind, skipping the offload gate. setup.sh/setup.ps1 now pass --install-kind
from the backend they just built, and the --smoke-test CLI applies --has-rocm /
--rocm-gfx host overrides like the install path does.
This commit is contained in:
danielhanchen 2026-06-01 16:16:22 +00:00
commit ecf90078dd
3 changed files with 28 additions and 4 deletions

View file

@ -7092,7 +7092,16 @@ def main() -> int:
return EXIT_SUCCESS
if args.smoke_test is not None:
host = detect_host()
# Honor the same host overrides as the install path so a caller that
# forwards --has-rocm / --rocm-gfx (setup.sh/setup.ps1 do, because the
# installer's own probe can miss amd-smi-only hosts) is held to the GPU
# offload check instead of silently resolving a CPU kind.
host = _apply_host_overrides(
detect_host(),
override_has_rocm = args.has_rocm,
override_rocm_gfx = args.rocm_gfx,
force_cpu = args.cpu_fallback,
)
try:
resolved_kind = smoke_test_server_binary(
args.smoke_test,

View file

@ -3051,7 +3051,10 @@ if (-not $NeedLlamaSourceBuild) {
if (Test-Path -LiteralPath $builtServer) {
Write-Host ""
Write-Host "--- GPU smoke test ---" -ForegroundColor Cyan
& python "$PSScriptRoot\install_llama_prebuilt.py" --smoke-test "$builtServer" --install-dir "$LlamaCppDir" 2>&1 | Out-String | Write-Host
# $LlamaCudaBuild gates this block, so the build is CUDA; pass the
# explicit kind so the installer's own probe cannot resolve a CPU
# kind and skip the offload gate.
& python "$PSScriptRoot\install_llama_prebuilt.py" --smoke-test "$builtServer" --install-dir "$LlamaCppDir" --install-kind "windows-cuda" 2>&1 | Out-String | Write-Host
$smokeExit = $LASTEXITCODE
if ($smokeExit -eq 2) {
substep "GPU build runs on CPU only (GPU backend failed to initialize)" "Yellow"

View file

@ -1362,11 +1362,23 @@ else
# _gpu_fallback_label is empty for a pure CPU build (nothing to verify).
if [ "$BUILD_OK" = true ]; then
_SMOKE_LABEL="$(_gpu_fallback_label)"
if [ -n "$_SMOKE_LABEL" ] && [ -f "$_BUILD_TMP/build/bin/llama-server" ]; then
# Pass the GPU kind setup resolved, not the installer's own probe:
# on amd-smi-only / name-inferred ROCm hosts the child probe can miss
# the GPU and resolve a CPU kind, which would skip the offload gate.
_SMOKE_KIND=""
if [ "$_TRY_METAL_CPU_FALLBACK" = true ]; then
_SMOKE_KIND="macos-arm64"
elif [ "$GPU_BACKEND" = "cuda" ]; then
_SMOKE_KIND="linux-cuda"
elif [ "$GPU_BACKEND" = "rocm" ]; then
_SMOKE_KIND="linux-rocm"
fi
if [ -n "$_SMOKE_LABEL" ] && [ -n "$_SMOKE_KIND" ] && [ -f "$_BUILD_TMP/build/bin/llama-server" ]; then
# if/else keeps set -e from aborting before we read the code.
if python "$SCRIPT_DIR/install_llama_prebuilt.py" \
--smoke-test "$_BUILD_TMP/build/bin/llama-server" \
--install-dir "$_BUILD_TMP" > "$_BUILD_TMP/gpu-smoke.log" 2>&1; then
--install-dir "$_BUILD_TMP" \
--install-kind "$_SMOKE_KIND" > "$_BUILD_TMP/gpu-smoke.log" 2>&1; then
_SMOKE_RC=0
else
_SMOKE_RC=$?