← Back to Pull requests

fix: size a multinode worker's GPU limit per pod #1173

Open
dundysm opened this pull request with 176 lines diff across 3 files
View on GitHub
dundysm dundysm commented on Dec 04, 2026 17:07 UTC
Author

Fixes #1172

Why and what changed

A DGD GPU limit is per Pod, and a worker with multinode.nodeCount runs one Pod per node (Dynamo's 16-GPU recipes use nodeCount: 2 with gpu: "8"). The k8s builder put the worker's total GPU count in the limit, so a TP16 worker on 8-GPU nodes came out as nodeCount: 2 with gpu: "16": each Pod asks for 16 GPUs on an 8-GPU node and never schedules, and AISim's own DGD config adapter (_gpu_limit _node_count) reads the same file back as a 32-GPU worker.

This change, in the render_worker helper of all three backends in k8s_builder.py (kept replicated per backend, as the file asks):

  • computes nodeCount as before (ceil(total / num_gpus_per_node)) and emits total // nodeCount as the per-Pod GPU limit; the EFA resource request follows the same per-Pod count;

  • fails generation when the total does not split evenly over those nodes (for example 9 GPUs on 8-GPU nodes), so no DGD that cannot schedule is written; the engine already turns a builder error into a logged warning and no k8s_deploy.yaml;

  • leaves single-node workers untouched.
  • The FPM target lowers the same DGD worker and read its limit as the total (_resolve_topology divided it by nodeCount); it now reads it as the per-node count and derives the total as limit nodeCount. The FPM resource Pods already request the per-node count, so their output does not change.

    Review map

  • Risk level: low

  • Start with: the render_worker GPU sizing in _populate_vllm (the sglang and trtllm copies are identical), then _resolve_topology in fpm_builder.py

  • Public or serialized contract changed: yes, the generated DGD for multinode workers now carries the per-Pod GPU limit Dynamo expects; single-node output is unchanged

  • Feature Support Matrix: unaffected

  • Compatibility or rollback concern: a worker whose GPU total does not split evenly over its nodes now gets no k8s_deploy.yaml (with a warning naming the counts) instead of an unschedulable one
  • Evidence

  • Tests: PYTHONPATH=src python -m pytest tests/unit/generator tests/unit/sdk/config_adapter/test_dynamo.py from python/aisim: 1189 passed, 4 skipped; the one failure, test_module_bridge_recommend_gpus.py::test_uses_total_gpus_needed_over_task_budget, is a pytest-timeout while Hugging Face rate limited the op-latency download in my environment, unrelated to this change.

  • New tests/unit/generator/test_k8s_multinode_gpu_limit.py (8 cases): TP16 on 8-GPU nodes gives nodeCount: 2 and gpu: "8" for vllm, sglang and trtllm; a 4-GPU worker keeps gpu: "4" and no multinode; 12 GPUs give two Pods of 6; 9 GPUs emit no DGD and log the reason. On main 5 of them fail (assert '16' == '8', assert '12' == '6', and a DGD is emitted for 9 GPUs).

  • The existing multinode FPM tests in test_fpm_artifacts.py (TP and DP topologies) still pass unchanged.

  • ruff check and ruff format --check clean on the changed files.

  • Fast CI / Full CI / CodeRabbit / Codex: pending.

  • Expected-value derivation: 16 / ceil(16 / 8) = 8; 12 / ceil(12 / 8) = 6; 9 / ceil(9 / 8) is not an integer.

  • Before/after: the repro in #1172 prints {'nodeCount': 2} {'gpu': '16'} on main and {'nodeCount': 2} {'gpu': '8'} with this change.
  • Modeling or data provenance

    N/A

    Tracking

  • Closes: #1172
  • Diff: 176 lines (+148 / -28) across 3 files Reviewer: None requested Review duration: 875m
    All Vouch review confidence checks passed
    Residual risk 0.27 = Change Risk (0.49) × (1 − Review Confidence (0.44)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.49 · 176 lines diff across 3 files
    0.49
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.02 · 1 substantive comment(s)
    0.02
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 10%
    44%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Shallow Review Depth shallow_review_depth
    0.344
    Diff Size diff_size
    0.310
    No Reviewer Assigned no_reviewer_assigned
    0.120
    Real PR Conversation Timeline
    1 comments
    "Review active on #1173"
    general weight: 0.35
    Reviewers
    None requested
    Assignees
    dundysm dundysm
    Labels
    risk: low confidence: 44.2% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 48.9% (MEDIUM) · Higher = larger blast radius
    48.9%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 44.2% · Lower = rushed or shallow review
    44.2%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 27.3% · Safe to merge
    27.3%