Skip to content

Conversation

@tedzhouhk
Copy link
Contributor

@tedzhouhk tedzhouhk commented Aug 9, 2025

Summary by CodeRabbit

  • New Features

    • Added a new script for profiling endpoint performance in prefill or decode modes, with configurable parameters and logging.
    • Introduced dedicated modules for profiling prefill and decode performance, including data collection, saving, and visualization.
  • Refactor

    • Streamlined the profiling workflow by delegating detailed profiling and plotting logic to new utility functions, simplifying the main profiling script.
  • Style

    • Improved logging and output formatting for profiling scripts and utilities.
  • Documentation

    • Enhanced in-script documentation and logging messages to clarify profiling steps and outputs.

@copy-pr-bot
Copy link

copy-pr-bot bot commented Aug 9, 2025

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.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Aug 9, 2025

Walkthrough

A new profiling script, profile_endpoint.py, is added to provide a command-line interface for profiling model endpoints in prefill or decode mode. Profiling logic in profile_sla.py is refactored to delegate detailed benchmarking and plotting to new utility modules, profile_prefill.py and profile_deocde.py. Plotting utilities are updated to support the new profiling structure and output formats.

Changes

Cohort / File(s) Change Summary
New Endpoint Profiling Script
benchmarks/profiler/profile_endpoint.py
Adds a CLI script for profiling endpoints, selecting between prefill and decode modes, and invoking corresponding utility functions with argument validation and logging.
Refactor SLA Profiling Control Flow
benchmarks/profiler/profile_sla.py
Refactors to delegate prefill and decode profiling to new utility functions, removing inline loops, data collection, and plotting logic. Simplifies control flow and updates imports.
Prefill Profiling Utility
benchmarks/profiler/utils/profile_prefill.py
Introduces a function to benchmark prefill performance over input sequence lengths, collect TTFT and throughput data, save results, and generate interpolation plots.
Decode Profiling Utility
benchmarks/profiler/utils/profile_deocde.py
Adds a function to benchmark decode performance over context lengths and concurrency, collect ITL and throughput data, save results, and generate 3D surface plots.
Plotting Utilities Update
benchmarks/profiler/utils/plot.py
Updates plotting functions: removes throughput curve fitting in prefill plots, changes decode surface plotting to produce separate ITL and throughput 3D surfaces, and updates function signatures accordingly.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant profile_endpoint.py
    participant profile_prefill.py
    participant profile_deocde.py
    participant plot.py

    User->>profile_endpoint.py: Run with CLI arguments (mode, model, etc.)
    alt mode == prefill
        profile_endpoint.py->>profile_prefill.py: profile_prefill(...)
        profile_prefill.py->>plot.py: plot_prefill_interpolation(...)
    else mode == decode
        profile_endpoint.py->>profile_deocde.py: profile_decode(...)
        profile_deocde.py->>plot.py: plot_decode_3d_surface(...)
    end
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~18 minutes

Possibly related PRs

Poem

A bunny with graphs in its sight,
Hopped through the code, day and night.
With endpoints to test,
And benchmarks addressed,
Now plots bloom in colors so bright!
🐇📊✨

Note

🔌 MCP (Model Context Protocol) integration is now available in Early Access!

Pro users can now connect to remote MCP servers under the Integrations page to get reviews and chat conversations that understand additional development context.


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
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 7

🧹 Nitpick comments (4)
benchmarks/profiler/utils/profile_prefill.py (1)

10-18: Repeated logger handler attachment across modules

Each utility module adds an unconditional StreamHandler, so importing them multiple times duplicates log lines.
Wrap the handler addition behind if not logger.handlers: to avoid spam.

benchmarks/profiler/utils/profile_deocde.py (1)

10-18: Duplicate logging handlers

Same duplication issue as in profile_prefill.py; guard with if not logger.handlers:.

benchmarks/profiler/utils/plot.py (2)

176-183: griddata with method "cubic" requires ≥ 16 points

If fewer samples are recorded the cubic interpolator will raise. Either fall back to linear/nearest or skip the surface plot with a warning.

method = "cubic" if len(x_kv_usage) >= 16 else "linear"
Z_itl  = griddata((x_kv_usage, y_context_length), z_itl,  (X, Y), method=method)

148-154: Consider fitting a curve or at least connecting points

Throughput is now displayed as scattered dots without any visual trend, unlike TTFT.
A simple line or polynomial fit would help users interpret the data.

📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between fa4a7f1 and 80c8d0a.

📒 Files selected for processing (5)
  • benchmarks/profiler/profile_endpoint.py (1 hunks)
  • benchmarks/profiler/profile_sla.py (3 hunks)
  • benchmarks/profiler/utils/plot.py (3 hunks)
  • benchmarks/profiler/utils/profile_deocde.py (1 hunks)
  • benchmarks/profiler/utils/profile_prefill.py (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: Build and Test - dynamo
🔇 Additional comments (1)
benchmarks/profiler/profile_sla.py (1)

417-425: Propagation of missing work-dir creation

profile_prefill() is called with work_dir that is created just above (os.makedirs(work_dir, exist_ok=True)), so OK.
No action needed.

@tedzhouhk tedzhouhk enabled auto-merge (squash) August 9, 2025 18:39
@tedzhouhk tedzhouhk disabled auto-merge August 9, 2025 18:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants