Skip to content

build_orchestrator: merge model-card slurm/distributed config in the main build path#152

Draft
i-kosarev wants to merge 1 commit into
ROCm:fix/slurm-sglang-disagg-co-located-proxyfrom
i-kosarev:fix/slurm-sglang-disagg-co-located-proxy
Draft

build_orchestrator: merge model-card slurm/distributed config in the main build path#152
i-kosarev wants to merge 1 commit into
ROCm:fix/slurm-sglang-disagg-co-located-proxyfrom
i-kosarev:fix/slurm-sglang-disagg-co-located-proxy

Conversation

@i-kosarev

@i-kosarev i-kosarev commented Jul 8, 2026

Copy link
Copy Markdown

Problem

_execute_with_prebuilt_image() already merged the first discovered model's slurm/distributed fields into manifest deployment_config, letting the run phase auto-detect target=slurm from the model card alone. The normal build-from-Dockerfile path (used whenever images are actually built from source, not --use-image) never did this merge -- it only called _save_deployment_config(), which populates deployment_config purely from --additional-context.

A model card with a real "slurm": {...} config but no matching --additional-context override was silently ignored: deployment_config.slurm stayed unset, _infer_deployment_target() fell back to "local", and on GPU-less nodes (e.g. a SLURM login node used only to submit jobs) this caused GPU detection failed: Unable to determine gpu vendor instead of dispatching via sbatch.

Fix

Extract the merge logic into _merge_model_config_into_deployment() and call it from both build paths right after _save_deployment_config().

(Supersedes the earlier version of this PR, which worked around the symptom by pre-loading gpu_vendor before local GPU detection. That workaround is no longer needed once deployment_config.slurm is populated correctly -- target inference routes to SlurmDeployment before local GPU detection ever runs.)

Copilot AI review requested due to automatic review settings July 8, 2026 16:30

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR aims to prevent runtime GPU auto-detection from failing on SLURM login nodes (where no local GPU is present) by reusing GPU vendor information already recorded in the build manifest, allowing runs to proceed far enough to be dispatched to GPU compute nodes. It also reduces the risk of node-info commands hanging by bounding package-manager queries.

Changes:

  • Pre-load gpu_vendor (and related GPU docker env vars) from the build manifest into additional_context before runtime context initialization.
  • Add a 10-second timeout to host package-manager queries in _show_node_info().

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +532 to +553
manifest_context = manifest.get("context", {})
if not self.additional_context:
self.additional_context = {}
if "gpu_vendor" in manifest_context and "gpu_vendor" not in self.additional_context:
vendor = manifest_context["gpu_vendor"]
self.additional_context["gpu_vendor"] = vendor
# Pre-populate GPU docker_env_vars so init_gpu_context() skips the per-field
# detection calls (get_system_ngpus etc.) that fail on GPU-less login nodes.
# Use -1 / empty placeholders; the actual values are set inside the container.
if "docker_env_vars" not in self.additional_context:
self.additional_context["docker_env_vars"] = {}
denv = self.additional_context["docker_env_vars"]
if "MAD_GPU_VENDOR" not in denv:
denv["MAD_GPU_VENDOR"] = vendor
if "MAD_SYSTEM_NGPUS" not in denv:
denv["MAD_SYSTEM_NGPUS"] = -1
if "MAD_SYSTEM_GPU_ARCHITECTURE" not in denv:
denv["MAD_SYSTEM_GPU_ARCHITECTURE"] = manifest_context.get("gpu_arch", "")
if "MAD_SYSTEM_HIP_VERSION" not in denv:
denv["MAD_SYSTEM_HIP_VERSION"] = ""
if "MAD_SYSTEM_GPU_PRODUCT_NAME" not in denv:
denv["MAD_SYSTEM_GPU_PRODUCT_NAME"] = ""
Comment on lines 795 to +802
if "HOST_UBUNTU" in host_os:
print(self.console.sh("apt show rocm-libs -a", canFail=True))
print(self.console.sh("timeout 10 apt show rocm-libs -a", canFail=True))
elif "HOST_CENTOS" in host_os:
print(self.console.sh("yum info rocm-libs", canFail=True))
print(self.console.sh("timeout 10 yum info rocm-libs", canFail=True))
elif "HOST_SLES" in host_os:
print(self.console.sh("zypper info rocm-libs", canFail=True))
print(self.console.sh("timeout 10 zypper info rocm-libs", canFail=True))
elif "HOST_AZURE" in host_os:
print(self.console.sh("tdnf info rocm-libs", canFail=True))
print(self.console.sh("timeout 10 tdnf info rocm-libs", canFail=True))
Comment on lines +527 to +531
# Pre-load gpu_vendor from manifest context into additional_context so that
# _init_runtime_context() can skip local GPU detection on nodes (e.g. SLURM
# login nodes) where the GPU is on remote compute nodes, not the local host.
# The build phase records the target GPU vendor; re-use it here instead of
# trying to detect a GPU that does not exist on the login node.
…main build path too

_execute_with_prebuilt_image() already merged the first discovered model's
"slurm"/"distributed" fields into manifest deployment_config, letting the
run phase auto-detect target=slurm from the model card alone. The normal
build-from-Dockerfile path (the one actually used when building images
from source, e.g. any CI run that isn't --use-image) never did this merge
-- it only called _save_deployment_config(), which populates
deployment_config purely from --additional-context. A model card with a
real "slurm" config but no matching --additional-context override was
silently ignored: deployment_config.slurm stayed unset,
_infer_deployment_target() fell back to "local", and on GPU-less nodes
(e.g. a SLURM login node used only to submit jobs) this caused
"GPU detection failed: Unable to determine gpu vendor" instead of
dispatching via sbatch.

Extract the merge logic into _merge_model_config_into_deployment() and
call it from both build paths right after _save_deployment_config().
@i-kosarev
i-kosarev force-pushed the fix/slurm-sglang-disagg-co-located-proxy branch from 32142bf to 183b679 Compare July 22, 2026 13:47
Copilot AI review requested due to automatic review settings July 22, 2026 13:47
@i-kosarev i-kosarev changed the title run_orchestrator: pre-load gpu_vendor from manifest to fix SLURM login node runs build_orchestrator: merge model-card slurm/distributed config in the main build path Jul 22, 2026

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated no new comments.

@i-kosarev
i-kosarev marked this pull request as draft July 22, 2026 15:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants