Skip to content

Fix performance regression caused by comms logger and bug in comms_logger.enabled - #8909

Merged
pengdurice merged 4 commits into
masterfrom
hongwei/fix_log_timer
Oct 27, 2026
Merged

pengdurice merged 4 commits into
masterfrom
hongwei/fix_log_timer

Conversation

@hwchen2017

@hwchen2017 hwchen2017 commented Oct 26, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #8797. With comms logging on, every collective re-read the full history of its timer, so ZeRO-3 step time grew every step and each logged latency was the sum of all earlier calls. Separately, "comms_logger": {"enabled": false} turned logging on.

Root causes

  1. Timer history is never cleared (regression from Wall clock timers API #7714, v0.18.3). Logged latencies are cumulative, which changed the original intent.
  2. The section's enabled field is ignored (since DeepSpeed Communication Profiling and Logging #2012).

Changes

deepspeed/utils/timer.py

  • Timer holds one start/stop event pair, created once and recorded again for each interval, plus a running total and count. It no longer keeps a list of every event pair.
  • elapsed() returns the latest start/stop interval.
  • New elapsed_total() returns the sum of all intervals since the last reset.
  • mean() returns the plain average since the last reset. It used to be a 10% trimmed mean over the stored records.
  • Each interval is measured once, when first needed: on a read or at the next start(). So stop() never waits for the device.
  • Reading a timer that is still running stops it, with no automatic restart.
  • SynchronizedWallClockTimer.log() prints elapsed_total(), so every existing log line is unchanged.
  • Cleanups:
    • Removed the now-unused CudaEventTimer.
    • Added NoopTimer.elapsed_total().
    • psutil is imported only when ThroughputTimer monitors memory.

deepspeed/comm/config.py, deepspeed/comm/comm.py

  • comms_logger_enabled now comes from the section's enabled field. A missing section is parsed with its defaults, the same way the compile section is.
  • Inlined _configure_using_config_file into deepspeed.comm.configure().
  • Removed an outdated comment ("'elapsed' resets events") and the unused timer_summary global.
  • Removed the config argument of deepspeed.init_distributed();

Related PRs

Signed-off-by: Hongwei Chen <[email protected]>
Signed-off-by: Hongwei Chen <[email protected]>
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 26, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ⚠️ Failed 2026-10-26T03:28:03.942794Z
We couldn’t complete this review. Comment @codex review to try again.
76b816e PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@hwchen2017
hwchen2017 enabled auto-merge October 27, 2026 16:00
@hwchen2017
hwchen2017 disabled auto-merge October 27, 2026 16:02
@pengdurice
pengdurice enabled auto-merge October 27, 2026 16:16
@pengdurice
pengdurice added this pull request to the merge queue Oct 27, 2026
Merged via the queue into master with commit 322283b Oct 27, 2026
16 checks passed
@pengdurice
pengdurice deleted the hongwei/fix_log_timer branch October 27, 2026 17:40
@tohtana tohtana added needs-gpu-test GPU testing is recommended to validate the changes in this PR. and removed needs-gpu-test GPU testing is recommended to validate the changes in this PR. labels Nov 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

4 participants