Skip to content

fix(profiler): propagate spec.sla.{ttft,itl} into PlannerConfig - #9537

Merged
hhzhang16 merged 12 commits into
ai-dynamo:mainfrom
jooe0824:jooe0824/planner-sla-passthrough
May 20, 2026
Merged

fix(profiler): propagate spec.sla.{ttft,itl} into PlannerConfig#9537
hhzhang16 merged 12 commits into
ai-dynamo:mainfrom
jooe0824:jooe0824/planner-sla-passthrough

Conversation

@jooe0824

@jooe0824 jooe0824 commented May 14, 2026

Copy link
Copy Markdown
Contributor

Overview:

_build_planner_config() in components/src/dynamo/profiler/utils/dgd_generation.py builds the 'PlannerConfig'. 'PlannerConfig'  silently drops dgdr.sla.ttft and dgdr.sla.itl fields the user already provided as the  SLA targets for the deployment, when deploying DGDR. The result: the post-deployment Planner enforces SLAPlannerDefaults.ttft_ms = 500.0 and SLAPlannerDefaults.itl_ms = 50.0 (components/src/dynamo/planner/config/defaults.py, class SLAPlannerDefaults) regardless of what the user wrote in spec.sla. This violates the implicit contract that spec.sla is the canonical SLA target for the whole DGDR.

Field on SLASpec (DGDR) user spec.sla PlannerConfig (current bug) PlannerConfig (with fix)
ttft 1500 500 (SLAPlannerDefaults) 1500
itl 15 50 (SLAPlannerDefaults) 15

Details:

At the end of _build_planner_config() (before return planner_cfg), propagate dgdr.sla.{ttft,itl} into planner_cfg.{ttft_ms,itl_ms} — unless the user explicitly set those fields on features.planner.

  • spec.sla.e2eLatency is left as-is — PlannerConfig has no e2e_latency field, so any e2e enforcement requires explicit conversion to ttft/itl, which depends on workload characteristics the profiler doesn't have a principled rule for.
  • Backwards compatible: existing DGDRs without spec.sla, or DGDRs that explicitly set features.planner.{ttft_ms,itl_ms}, produce exactly the same PlannerConfig as before.

Where should the reviewer start?

components/src/dynamo/profiler/utils/dgd_generation.py:479 — the _build_planner_config function (lines 479–525 after this patch). The change is a 24-line append (including an 8-line comment block explaining the model_fields_set idiom and the e2eLatency skip rationale) at the end of the function before return planner_cfg.

Related Issues: (use one of the action keywords Closes / Fixes / Resolves / Relates to)

Relates to issue #8469 ("[BUG][GROUP]: fix DGDR profiling and deployment errors on existing models and backends") — natural sub-issue under that bucket.

Tests: A test file is ready locally and can be added to this PR or submitted as a follow-up — whichever the reviewer prefers.


Open in Devin Review

Summary by CodeRabbit

  • Improvements
    • Enhanced planner configuration handling to ensure proper propagation of timing settings when available.

Review Change Stack

'_build_planner_config()' in 'components/src/dynamo/profiler/utils/dgd_generation.py' builds the 'PlannerConfig'.
'PlannerConfig'  silently drops 'dgdr.sla.ttft' and 'dgdr.sla.itl' fields the user already provided as the  SLA targets for the deployment, when deploying DGDR.
The result: the post-deployment Planner enforces 'SLAPlannerDefaults.ttft_ms = 500.0' and'SLAPlannerDefaults.itl_ms = 50.0' (dynamo/components/src/dynamo/planner/config/defaults.py, class SLAPlannerDefualts) regardless of what the user wrote in 'spec.sla'. This violates the implicit contract that 'spec.sla' is the canonical SLA target for the whole DGDR.

Signed-off-by: jooe0824 <jooe0824@gmail.com>
@jooe0824
jooe0824 requested review from a team as code owners May 14, 2026 04:47
@copy-pr-bot

copy-pr-bot Bot commented May 14, 2026

Copy link
Copy Markdown

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

@github-actions

Copy link
Copy Markdown
Contributor

👋 Hi jooe0824! Thank you for contributing to ai-dynamo/dynamo.

Just a reminder: The NVIDIA Test Github Validation CI runs an essential subset of the testing framework to quickly catch errors.Your PR reviewers may elect to test the changes comprehensively before approving your changes.

🚀

@github-actions github-actions Bot added external-contribution Pull request is from an external contributor planner labels May 14, 2026
@coderabbitai

coderabbitai Bot commented May 14, 2026

Copy link
Copy Markdown
Contributor

Walkthrough

This PR adds SLA timing propagation logic to the planner configuration builder. When SLA targets exist (ttft and itl) but e2eLatency is unset, the builder now maps these values into the generated PlannerConfig, unless the fields were explicitly overridden.

Changes

SLA Timing Propagation

Layer / File(s) Summary
SLA timing to planner config mapping
components/src/dynamo/profiler/utils/dgd_generation.py
_build_planner_config conditionally propagates dgdr.sla.ttft and dgdr.sla.itl into planner_cfg.ttft_ms and planner_cfg.itl_ms when sla.e2eLatency is unset and user overrides are not detected via model_fields_set.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and specifically describes the main change: propagating SLA timing targets (ttft and itl) from spec.sla into PlannerConfig.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description check ✅ Passed The PR description comprehensively covers all required sections with clear explanations of the bug, the fix, and reviewer guidance.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

Tip

💬 Introducing Slack Agent: The best way for teams to turn conversations into code.

Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.

  • Generate code and open pull requests
  • Plan features and break down work
  • Investigate incidents and troubleshoot customer tickets together
  • Automate recurring tasks and respond to alerts with triggers
  • Summarize progress and report instantly

Built for teams:

  • Shared memory across your entire org—no repeating context
  • Per-thread sandboxes to safely plan and execute work
  • Governance built-in—scoped access, auditability, and budget controls

One agent for your entire SDLC. Right inside Slack.

👉 Get started


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
components/src/dynamo/profiler/utils/dgd_generation.py (1)

500-506: ⚡ Quick win

Convert the triple-quoted string to regular comments.

The triple-quoted string at lines 500–506 is being used as a block comment, which violates PEP 8 conventions. PEP 8 reserves triple-quoted strings for docstrings (module/class/function documentation), and requires inline comments to use #.

As per coding guidelines, this file must follow PEP 8.

♻️ Suggested fix
-    """
-    Propagate SLA targets from spec.sla so the post-deployment planner
-    enforces the same SLA used at sweep time. Without this, the planner silently uses SLAPlannerDefaults
-    ttft_ms=500 / itl_ms=50
-
-    Explicit user overrides on features.planner.{ttft_ms, itl_ms} take precedence - detected via model_fields_set
-    """
+    # Propagate SLA targets from spec.sla so the post-deployment planner
+    # enforces the same SLA used at sweep time. Without this, the planner
+    # silently uses SLAPlannerDefaults ttft_ms=500 / itl_ms=50.
+    #
+    # Explicit user overrides on features.planner.{ttft_ms, itl_ms} take
+    # precedence - detected via model_fields_set.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@components/src/dynamo/profiler/utils/dgd_generation.py` around lines 500 -
506, The triple-quoted block starting with "Propagate SLA targets from
spec.sla..." should be converted to PEP8-compliant inline comments: replace the
""""..."""" block with one or more lines prefixed by #, keeping the same wording
and references to spec.sla, SLAPlannerDefaults, features.planner.{ttft_ms,
itl_ms}, and model_fields_set so the intent is preserved; ensure the comment is
placed immediately where the original block was (in dgd_generation.py) and
retain the note about explicit overrides taking precedence.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@components/src/dynamo/profiler/utils/dgd_generation.py`:
- Around line 500-506: The triple-quoted block starting with "Propagate SLA
targets from spec.sla..." should be converted to PEP8-compliant inline comments:
replace the """"..."""" block with one or more lines prefixed by #, keeping the
same wording and references to spec.sla, SLAPlannerDefaults,
features.planner.{ttft_ms, itl_ms}, and model_fields_set so the intent is
preserved; ensure the comment is placed immediately where the original block was
(in dgd_generation.py) and retain the note about explicit overrides taking
precedence.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 76612337-03e8-4ee8-9f27-2d6520a60311

📥 Commits

Reviewing files that changed from the base of the PR and between 4179646 and 50a9ddf.

📒 Files selected for processing (1)
  • components/src/dynamo/profiler/utils/dgd_generation.py

Comment thread components/src/dynamo/profiler/utils/dgd_generation.py
jooe0824 and others added 2 commits May 19, 2026 13:17
…add unit tests

Addresses review on ai-dynamo#9537.
valid_dgdr_spec() injects a defaulted SLASpec(ttft=2000, itl=30) when spec.sla is omitted, so the previous  check silently overwrote SLAPlannerDefaults (500/50) for deployments without spec.sla.
The propagation now requires both 'ttft' and 'itl' in sla.model_fields_set and is skipped entirely in e2eLatency mode. Explicit features.planner overrides retain precedence.

Adds test_dgd_generation_planner_sla.py covering:
  - Backwards- compatibility preservation when spec.sla is omitted or set as empty SLASpec()
  - forward propagation of explicit sla.ttft/itl
  - precedence of features.planner.{ttft_ms,itl_ms} overrides
  - e2eLatency mode skipping ttft/itl propagation

Signed-off-by: jooe0824 <jooe0824@sk.com>
@pull-request-size pull-request-size Bot added size/L and removed size/S labels May 19, 2026
@hhzhang16

Copy link
Copy Markdown
Contributor

/ok to test d2ff3b6

Comment thread components/src/dynamo/profiler/utils/dgd_generation.py Outdated
jooe0824 and others added 6 commits May 20, 2026 10:08
Previously both ttft and itl
  had to be in model_fiels_set for SLA values to flow into the planner config. Change the gate to OR so a partial spec
  still propagates,

Adds unit tests covering ttft-only and itl-only paths

Signed-off-by: jooe0824 <jooe0824@sk.com>
@hhzhang16

Copy link
Copy Markdown
Contributor

/ok to test 17d1e96

@hhzhang16
hhzhang16 enabled auto-merge (squash) May 20, 2026 18:49
@hhzhang16
hhzhang16 merged commit ca1dacc into ai-dynamo:main May 20, 2026
72 checks passed
@jooe0824

Copy link
Copy Markdown
Contributor Author

Hi @hhzhang16, thank you again for reviewing my earlier profiler PR! 🙏
I came across another profiler issue in the same area and opened a fix for it:

It's a small change with unit tests included. Whenever you have time, I'd really appreciate it if you could take a look. Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

external-contribution Pull request is from an external contributor fix planner size/L

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants