Skip to content

[JAX] Synchronize tutorial speedometer measurements - #3830

Open
KshitijLakhani wants to merge 3 commits into
NVIDIA:mainfrom
KshitijLakhani:klakhani/fix/tutorial-speedometer
Open

KshitijLakhani wants to merge 3 commits into
NVIDIA:mainfrom
KshitijLakhani:klakhani/fix/tutorial-speedometer

Conversation

@KshitijLakhani

@KshitijLakhani KshitijLakhani commented Nov 6, 2026 •

Copy link
Copy Markdown
Collaborator

Description

Fix JAX tutorial benchmark timing so reported durations include completed forward and backward computation.

Type of change

  • Documentation change (change only to the documentation, either a fix or a new content)
  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Infra/Build change
  • Code refactoring

Changes

  • Wait for all warmup results before starting the timer and all measured results before stopping it.
  • Use time.perf_counter() consistently across JAX tutorial timing loops.

Checklist:

  • I have read and followed the contributing guidelines
  • The functionality is complete
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes

Wait for the complete forward/backward result tree after warmup and before stopping the timer so the reported batch average covers completed device work rather than asynchronous dispatch.

Signed-off-by: Kshitij Janardan Lakhani <klakhani@nvidia.com>
Use time.perf_counter() consistently in the shared tutorial speedometer and both context-parallel attention timing loops to measure elapsed durations with a monotonic clock.

Signed-off-by: Kshitij Janardan Lakhani <klakhani@nvidia.com>
@KshitijLakhani KshitijLakhani self-assigned this Nov 6, 2026
@KshitijLakhani
KshitijLakhani force-pushed the klakhani/fix/tutorial-speedometer branch 2 times, most recently from 6b86b06 to 2780139 Compare November 6, 2026 21:55
@KshitijLakhani
KshitijLakhani marked this pull request as ready for review November 6, 2026 21:56
@greptile-apps

greptile-apps Bot commented Nov 6, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5

[Low impact] The PR appears safe to merge; no actionable issues were found.

Summary

Updates JAX tutorial benchmarks to wait for results before starting and stopping measurements.

  • JAX tutorial benchmarks now time completed forward and backward work.

Reviews (2) · Last reviewed commit: "Refresh JAX tutorial performance results..." · Reviewed by Greptile

@KshitijLakhani

Copy link
Copy Markdown
Collaborator Author

@jberchtold-nvidia if this change makes sense to you (for sync'ing the work after warm up and after completing the actual work) then I can re-run the numbers on GB200 and add them to this PR (if there's any changes)
Didn't want to spend cycles on generating the numbers before agreeing on the fix

@KshitijLakhani

Copy link
Copy Markdown
Collaborator Author

/te-ci jax L0

Signed-off-by: Kshitij Janardan Lakhani <klakhani@nvidia.com>
@KshitijLakhani

KshitijLakhani commented Nov 8, 2026 •

Copy link
Copy Markdown
Collaborator Author

@jberchtold-nvidia I reran the JAX tutorial benchmarks on GB200 after fixing synchronization in the timer, then refreshed the checked-in attention, dense, and context-parallel results.

If you are curious about the change in timings, here's more info:

  • Attention: Its 10 warmups left room to queue most timed calls quickly, so the old result mostly measured submitting work. With proper waiting, the single-GPU times change from about 5.1 → 51.3 ms for native JAX and 0.1 → 1.1 ms for TE.
  • Dense: Its 50 warmups had already filled that queue. Submitting each timed call then had to wait for earlier GPU work, so the old result happened to resemble the real throughput. This is a coincidence, not a different timing rule: with only 10 warmups, the same old dense timer reports about 1.5 ms instead of 18 ms.
  • CP attention: It already waited for GPU work, so its numbers move only slightly between runs.

This branch has not been deployed

No deployments
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.

1 participant