Skip to content

fix(profiler): return None from get_prefill_ttft when AIPerf fails - #17265

Open
lonexreb wants to merge 1 commit into
ai-dynamo:mainfrom
lonexreb:lonexreb/fix-16971-prefill-ttft-none
Open

lonexreb wants to merge 1 commit into
ai-dynamo:mainfrom
lonexreb:lonexreb/fix-16971-prefill-ttft-none

Conversation

@lonexreb

@lonexreb lonexreb commented Oct 25, 2026 •

Copy link
Copy Markdown

Overview:

Summary

get_prefill_ttft() documents that it returns None on benchmark failure, but both its default and attention-DP paths do assert aiperf_result is not None right after benchmark_prefill(). A nonzero AIPerf exit (for example an endpoint returning HTTP 503) therefore raises AssertionError and aborts the whole profiling sweep, instead of letting the sweep skip that one measurement.

Details:

Replace the two asserts with return None. benchmark_prefill() already logs the AIPerf exit code, stdout and stderr before returning None, so nothing is lost. Both callers already handle a None TTFT:

  • components/src/dynamo/profiler/thorough.py appends a prefill row only if ttft is not None
  • components/src/dynamo/profiler/utils/profile_prefill.py does the same in _profile_prefill_helper

This matches the decode helper, which returns (None, None) on failure. It picks up the fix proposed in #14322, which was closed before review.

Validation

New unit test patches benchmark_prefill to return None and calls get_prefill_ttft() with attention_dp_size=1 and 2.

Before the fix:

FAILED components/src/dynamo/profiler/tests/unit/test_aiperf.py::test_get_prefill_ttft_returns_none_when_benchmark_fails[default] - AssertionError
FAILED components/src/dynamo/profiler/tests/unit/test_aiperf.py::test_get_prefill_ttft_returns_none_when_benchmark_fails[attention-dp] - AssertionError
2 failed, 4 passed

After:

$ PYTHONPATH=components/src python -m pytest components/src/dynamo/profiler/tests/unit/test_aiperf.py -q
6 passed

pre-commit run --files <changed files>: isort, black, flake8, ruff, codespell pass.

Where should the reviewer start?

components/src/dynamo/profiler/utils/aiperf.py, get_prefill_ttft().

Related Issues

Summary by CodeRabbit

  • Bug Fixes
    • Prefill time-to-first-token results now handle cases where no benchmark result is available, returning no value instead of raising an assertion.

get_prefill_ttft() documents that it returns None on benchmark failure,
but both the default and attention-DP paths asserted that
benchmark_prefill() succeeded. A nonzero AIPerf exit therefore raised
AssertionError and aborted the whole profiling sweep instead of letting
the caller skip that measurement.

Return None in both paths. The two callers (thorough.py and
profile_prefill.py) already skip a None TTFT, matching the decode helper.

Closes ai-dynamo#16971

Signed-off-by: lonexreb <reach2shubhankar@gmail.com>
@lonexreb
lonexreb requested a review from a team as a code owner October 25, 2026 06:03
@copy-pr-bot

copy-pr-bot Bot commented Oct 25, 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.

@lonexreb
lonexreb temporarily deployed to external_collaborator October 25, 2026 06:04 — with GitHub Actions Inactive
@lonexreb
lonexreb temporarily deployed to external_collaborator October 25, 2026 06:04 — with GitHub Actions Inactive
@github-actions

Copy link
Copy Markdown
Contributor

👋 Hi lonexreb! 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 fix external-contribution Pull request is from an external contributor planner labels Oct 25, 2026
@coderabbitai

coderabbitai Bot commented Oct 25, 2026

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review.

Recent review info
Run configuration
Commits

Reviewing files that changed from the base of the PR and between 1ecc870 and 24bdf75.

Files selected for processing: 2
  • components/src/dynamo/profiler/tests/unit/test_aiperf.py
  • components/src/dynamo/profiler/utils/aiperf.py

Included review availability: This review used your included allowance. Your plan provides up to 12 included reviews per hour; 10 remain after this review.

Walkthrough

get_prefill_ttft now returns None when the prefill benchmark fails in both execution paths. A parameterized test checks this behavior for attention data-parallel sizes 1 and 2.

Changes

AIPerf prefill failure handling

Layer / File(s) Summary
Return None for failed prefill benchmarks
components/src/dynamo/profiler/utils/aiperf.py, components/src/dynamo/profiler/tests/unit/test_aiperf.py
Both execution paths return None when benchmark_prefill returns no result. A parameterized test checks the return value and verifies that the benchmark is called once for attention data-parallel sizes 1 and 2.

Priority: Normal

Estimated code review effort: 2 (Simple) | ~5 minutes

Severity of issue fixed: Medium

Merge Risk: Minimal · up to 24bdf

Failed prefill measurements can now be skipped so the profiling sweep continues, with both execution paths covered by the new test.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 33.33% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 3 functions across 2 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Title check Passed The title clearly and concisely describes the main change: returning None from get_prefill_ttft when AIPerf fails.
Description check Passed The description includes all required sections, explains the failure and fix, identifies review starting points, links related issues, and documents validation results.
Linked Issues check Passed Directly linked issue #16971 requires that get_prefill_ttft() return None when AIPerf fails, in both the default path and the attention-DP path, instead of raising AssertionError. The diff to componen…
Out of Scope Changes check Passed The whole-PR diff against the merge base touches only two files. components/src/dynamo/profiler/utils/aiperf.py changes only the two assertion sites in get_prefill_ttft() to None returns. components/s…
Full details: Linked Issues check

Explanation

Directly linked issue #16971 requires that get_prefill_ttft() return None when AIPerf fails, in both the default path and the attention-DP path, instead of raising AssertionError. The diff to components/src/dynamo/profiler/utils/aiperf.py replaces assert aiperf_result is not None with if aiperf_result is None: return None in both paths (the DEP branch at the benchmark_prefill call, and the default branch after it). The function already returns None for TTFT extraction failures, so the documented None contract holds for all failure points. The new test test_get_prefill_ttft_returns_none_when_benchmark_fails in components/src/dynamo/profiler/tests/unit/test_aiperf.py is parametrized over attention_dp_size 1 and 2. It patches dynamo.profiler.utils.aiperf.benchmark_prefill to return None and asserts that the result is None and that the benchmark is called once. This covers the coding requirement. The caller in components/src/dynamo/profiler/utils/profile_prefill.py skips points where ttft is None, so the sweep continues as the issue expects. The PR's reported before/after pytest output was not re-run by this assessment. The assessment relies on the diff and source read at head. Issue #16672 and #7038 are out of scope for this issue and are not required here.

Full details: Out of Scope Changes check

Explanation

The whole-PR diff against the merge base touches only two files. components/src/dynamo/profiler/utils/aiperf.py changes only the two assertion sites in get_prefill_ttft() to None returns. components/src/dynamo/profiler/tests/unit/test_aiperf.py adds the import of get_prefill_ttft and one parametrized regression test for the same behavior. No unrelated code, configuration, or documentation changes appear. Both changes directly implement issue #16971. The docstring already states the None-on-failure contract, so no doc change is needed.

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

@devin-ai-integration

Copy link
Copy Markdown
Contributor

External PR triage

Blocker: Trusted CI has never run (no /ok to test for 24bdf75). No human review since the planner codeowners were requested when the PR opened on 2026-10-25 (more than 72h ago).

Next action (@ai-dynamo/dynamo-planner-codeowners): Review the PR and post /ok to test 24bdf75612.

Supply-chain audit of 24bdf75612: Looks safe to approve. No workflow/CI, dependency, download-URL, script, secret, or binary changes. The diff is a 4-line change to components/src/dynamo/profiler/utils/aiperf.py plus a unit test.

Status as of 2026-10-29 for head 24bdf75612. This comment is edited in place on later runs.

Written by Devin

This branch was previously deployed

1 inactive deployment
external_collaborator — 24bdf756 Deployed Oct 25, 2026 by lonexreb via ok-to-test #38493
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/S

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG]: Failed AIPerf prefill measurements abort the profiling sweep

1 participant