-
Notifications
You must be signed in to change notification settings - Fork 2.4k
[autotuner] Add default do_bench for CPU hosts #6570
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
Conversation
python/triton/runtime/autotuner.py
Outdated
|
|
||
| if do_bench is None: | ||
| self.do_bench = driver.active.get_benchmarker() | ||
| import torch |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think this is the ideal solution. Maybe we could query if there's any backend exists and just set do_bench = None if no backend is available
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for taking a look. I updated V2 to lazily initialize do_bench. Could you please see if that looks good?
<!--- The core Triton is a small number of people, and we receive many PRs (thank you!). To help us review your code more quickly, **if you are a new contributor (less than 3 PRs merged) we ask that you complete the following tasks and include the filled-out checklist in your PR description.** Complete the following tasks before sending your PR, and replace `[ ]` with `[x]` to indicate you have done them. --> # New contributor declaration - [x] I am not making a trivial change, such as fixing a typo in a comment. - [x] I have written a PR description following these [rules](https://cbea.ms/git-commit/#why-not-how). - [x] I have run `pre-commit run --from-ref origin/main --to-ref HEAD`. - Select one of the following. - [x] I have added tests. - `/test` for `lit` tests - `/unittest` for C++ tests - `/python/test` for end-to-end tests - [ ] This PR does not need a test because `FILL THIS IN`. - Select one of the following. - [ ] I have not added any `lit` tests. - [x] The `lit` tests I have added follow these [best practices](https://mlir.llvm.org/getting_started/TestingGuide/#filecheck-best-practices), including the "tests should be minimal" section. (Usually running Python code and using the instructions it generates is not minimal.) Fixes triton-lang#6150. When running on a CPU host, `triton.autotune()` throws an error: ``` RuntimeError: 0 active drivers ([]). There should only be one. ``` This issue was introduced by triton-lang#4496, which forces the caller to specify `do_bench`. But this may not be easy in a large codebase. Default `do_bench` to `triton.testing.do_bench` when there's no GPU. Add a unit test.
Until patch triton-lang/triton#6570 is available in a new triton release.
Since patch from triton-lang/triton#6570 is out in triton=3.4.0 on conda-forge now.
New contributor declaration
I am not making a trivial change, such as fixing a typo in a comment.
I have written a PR description following these
rules.
I have run
pre-commit run --from-ref origin/main --to-ref HEAD.Select one of the following.
/testforlittests/unittestfor C++ tests/python/testfor end-to-end testsFILL THIS IN.Select one of the following.
littests.littests I have added follow these best practices,including the "tests should be minimal" section. (Usually running Python code
and using the instructions it generates is not minimal.)
Fixes #6150.
When running on a CPU host,
triton.autotune()throws an error:This issue was introduced by #4496,
which forces the caller to specify
do_bench. But this may not be easy in alarge codebase.
Default
do_benchtotriton.testing.do_benchwhen there's no GPU. Add aunit test.