Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[fix] rewrite do_bench with fixed warmup/rep runs mode #411

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

ConvolutedDog
Copy link

@ConvolutedDog ConvolutedDog commented Jan 12, 2025

PR Category

Benchmark

Type of Change

Bug Fix

Description

In the original implementation of triton's do_bench function, when users specify the warmup and rep parameters, the behavior may not align with their expectations. This is because:

  • In triton.testing.do_bench, the warmup and rep parameters are in milliseconds instead of reps, so that triton dynamically adjusts the number of warmup and repetition runs. And this is inconsistent with torch's measurement.

Therefore, this PR rewrites the triton.testing.do_bench function to support a new fixed_warmup_rep_runs parameter, which allows users to choose between two modes:

  1. Dynamic Mode (the original implementation of triton.testing.do_bench): Estimates the runtime of the kernel and dynamically adjusts the number of warmup and repetition runs based on the provided warmup and rep times (in milliseconds).
  2. Fixed Mode (default in this rewritten version, and consistent with torch's testing): Uses the provided warmup and rep values directly as the number of warmup and repetition runs.

Issue

None

Progress

  • Change is properly reviewed (1 reviewer required, 2 recommended).
  • Change is responded to an issue.
  • Change is fully covered by a UT.

Performance

No need

@StrongSpoon
Copy link
Collaborator

thanks for your idea and contribution! I recommend reformat the code according to CONTRIBUTING.md to pass the checks. we will review it soon.

@ConvolutedDog
Copy link
Author

@StrongSpoon Thank you for your feedback! I've reformatted the code according to CONTRIBUTING.md. Please let me know if there's anything else that needs to be adjusted.

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.

2 participants