Skip to content

chore: extends engine perf instrumentation#562

Merged
garrett4wade merged 2 commits intomainfrom
rchardx/update_weights
Nov 11, 2025
Merged

chore: extends engine perf instrumentation#562
garrett4wade merged 2 commits intomainfrom
rchardx/update_weights

Conversation

@rchardx
Copy link
Collaborator

@rchardx rchardx commented Nov 11, 2025

Description

Improves visibility into async control and distributed weight ops to tighten performance tracing coverage. Standardizes trace_scope usage so training spans emit consistent profiler data across engines.

Type of Change

  • Bug fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not
    work as expected)
  • Documentation update
  • Code refactoring (no functional changes)
  • Performance improvement
  • Test coverage improvement

Checklist

  • I have read the Contributing Guide
  • I have run formatting tools (pre-commit or manual)
  • I have run relevant unit tests and they pass
  • I have added tests for new functionality
  • I have updated documentation if needed
  • My branch is up to date with main
  • This PR introduces breaking changes (if yes, fill out details below)
  • If this PR changes documentation, I have built and previewed it locally with
    jb build docs
  • No critical issues raised by AI reviewers (/gemini review)

Improves visibility into async control and distributed weight ops to tighten performance tracing coverage.
Standardizes trace_scope usage so training spans emit consistent profiler data across engines.
@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @rchardx, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request significantly enhances the performance instrumentation within the engine components. The primary goal is to improve visibility into asynchronous control flows and distributed weight operations, which are crucial for optimizing large-scale model training and inference. By standardizing tracing mechanisms, the changes ensure more consistent and comprehensive profiling data, aiding in performance bottleneck identification and resolution.

Highlights

  • Enhanced Async Control Tracing: Performance tracing has been added to asynchronous control operations (pause_generation, continue_generation) within the remote inference engine, providing better visibility into these critical phases.
  • Extended Distributed Weight Tracing: Instrumentation has been expanded to cover distributed weight update mechanisms and tensor gathering in both FSDP and Megatron engines, allowing for more detailed performance analysis of communication-heavy operations.
  • Standardized Trace Scope Usage: The usage of trace_scope has been standardized across various engine operations, including training, evaluation, and forward passes, ensuring consistent and comprehensive profiler data collection.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

Copilot AI left a comment

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 extends performance instrumentation across multiple engine implementations to improve profiling visibility. The changes add trace_perf decorators and trace_scope context managers to communication and weight update operations, standardizing trace usage across the codebase.

  • Added @trace_perf decorators to bucket weight update methods in megatron and fsdp engines
  • Wrapped tensor gathering operations with trace_scope context managers for granular profiling
  • Added tracing to async control operations (pause/continue generation) in remote inference engine

Reviewed Changes

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

File Description
areal/engine/megatron_engine.py Added trace decorators to weight bucket update methods and wrapped gather operations with trace_scope
areal/engine/fsdp_engine.py Added trace decorator to bucket update method, wrapped tensor gathering in trace_scope, and replaced direct perf_tracer calls with trace_scope
areal/core/remote_inf_engine.py Added trace decorators to pause/continue generation methods for async control visibility

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

Removes redundant tracing around parameter collection to cut profiling overhead and clarify communication metrics.
Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request enhances performance tracing by adding instrumentation to asynchronous control and distributed weight operations in various engines. The changes standardize the use of trace_scope and add trace_perf decorators to key functions, improving visibility into performance bottlenecks. The modifications are well-implemented and align with the goal of tightening performance tracing coverage. One minor issue was found where a function was being called without its return value being used, which has been corrected.

@garrett4wade garrett4wade merged commit 1e7cf19 into main Nov 11, 2025
1 check passed
@garrett4wade garrett4wade deleted the rchardx/update_weights branch November 11, 2025 11:05
Bruce-rl-hw pushed a commit to Bruce-rl-hw/AReaL-vllm that referenced this pull request Dec 4, 2025
* chore: extends engine perf instrumentation

Improves visibility into async control and distributed weight ops to tighten performance tracing coverage.
Standardizes trace_scope usage so training spans emit consistent profiler data across engines.

* Simplifies gather tracing

Removes redundant tracing around parameter collection to cut profiling overhead and clarify communication metrics.
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.

3 participants