-
Notifications
You must be signed in to change notification settings - Fork 75
feat(autotuner): Make autotune cache class configurable via env var #1071
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
jansel
left a comment
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.
Perhaps we should make this more generic (similar to settings.autotuner_fn) so that as we add more classes we the config will still work.
Can you add a test?
4bbb119 to
18c0b14
Compare
|
@jansel Thanks for the review! Let me know if it looks good now. |
18c0b14 to
54add4e
Compare
|
@jansel I don't know if the cpu fail is caused by this PR. I've added a baseline for the other failed test. |
|
@jansel it looks like the cpu workflow does not install triton for some reason that does not depend on this PR |
Adds a new boolean setting, `use_strict_cache`, to `helion.runtime.Settings`, controlled by the `HELION_USE_STRICT_CACHE` environment variable. The `default_autotuner_fn` now reads this setting and selects `StrictLocalAutotuneCache` if set to true, falling back to `LocalAutotuneCache` otherwise. This allows users to easily enable stricter cache validation without needing to write a custom `autotuner_fn`. Signed-off-by: Alessandro Sangiorgi <asangior@redhat.com>
Adds a new `HELION_AUTOTUNE_CACHE` environment variable to allow
users to select the autotuner cache implementation, similar to how
`HELION_AUTOTUNER` selects the search algorithm.
- `helion/autotuner/__init__.py`:
- Adds a `cache_classes` dictionary to register available cache
implementations (LocalAutotuneCache, StrictLocalAutotuneCache).
- `helion/runtime/settings.py`:
- Adds a new string setting, `autotune_cache`, which defaults
to "LocalAutotuneCache" and is controlled by the
`HELION_AUTOTUNE_CACHE` environment variable.
- Updates `default_autotuner_fn` to use this new setting to
look up and instantiate the correct cache class from
`autotuner.cache_classes`.
- `test_autotuner.py`:
- Adds the `TestAutotuneCacheSelection` test case.
- Verifies that the default cache is `LocalAutotuneCache`.
- Verifies that `HELION_AUTOTUNE_CACHE=StrictLocalAutotuneCache`
correctly selects `StrictLocalAutotuneCache`.
- Verifies that an invalid cache name raises a `ValueError`.
Signed-off-by: Alessandro Sangiorgi <asangior@redhat.com>
e08b536 to
32fc11d
Compare
|
@jansel I've fixed the issue with the cpu environment and tested locally |
Adds a new
HELION_AUTOTUNE_CACHEenvironment variable to allowusers to select the autotuner cache implementation, similar to how
HELION_AUTOTUNERselects the search algorithm.helion/autotuner/__init__.py:cache_classesdictionary to register available cacheimplementations (LocalAutotuneCache, StrictLocalAutotuneCache).
helion/runtime/settings.py:autotune_cache, which defaultsto "LocalAutotuneCache" and is controlled by the
HELION_AUTOTUNE_CACHEenvironment variable.default_autotuner_fnto use this new setting tolook up and instantiate the correct cache class from
autotuner.cache_classes.test_autotuner.py:TestAutotuneCacheSelectiontest case.LocalAutotuneCache.HELION_AUTOTUNE_CACHE=StrictLocalAutotuneCachecorrectly selects
StrictLocalAutotuneCache.ValueError.