-
Notifications
You must be signed in to change notification settings - Fork 52
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
Add enable_options
and disable_options
to fd.execute
#3270
base: main
Are you sure you want to change the base?
Conversation
6b0d5ae
to
490358d
Compare
!build |
Thanks for taking the initiative with this! We will also need to update FusionExecutorCache to be option-aware so that we don't re-use kernels compiled with different options. That was part of the idea with #2077: separating options (features) into ones that affect each level of caching or not. |
Got it -- we can add that support separately, what do you think? That will allow development on #3022. IIUC, we are currently missing this for the environment variables based approach as well so we may be reusing kernels which used different env variables? |
I guess this is true: a process can change its env vars at any time and we will not recognize that change after the first time we look up an option. However that is off-label use. If we are providing a kwarg to I wonder if we could do something quickly like use a separate |
What do you mean by using separate A fusion cache is initialized here: Fuser/csrc/python_frontend/fusion_definition.cpp Lines 58 to 67 in f6975f3
execute method so they are not available when the fusion definition is initialized.
I am still going through the |
Hmmm. Yeah I guess you're right. Fuser/csrc/python_frontend/fusion_definition.cpp Lines 387 to 390 in 5db18de
Here scheds->auto_gen_schedules is a unique_ptr<FusionExecutorCache> . This is fine as a default but when features are supplied, we should create a new cache and use it instead I think.
|
818d87b
to
d39ac44
Compare
if len(_enable_options) or len(_disable_options): | ||
warnings.warn( | ||
"Reset the FusionCache manually to avoid reusing kernels when re-executing the fusion definition with different options." | ||
) | ||
|
||
results = self._execute( | ||
inputs, | ||
device=device, | ||
override_user_schedule=override_user_schedule, | ||
capture_debug_output=capture_debug_output, | ||
profile=profile, | ||
_enable_options=_enable_options, | ||
_disable_options=_disable_options, |
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.
As discussed offline, moving forward with renaming the kwargs to _enable/_disable_options
. I added a warning about the possibility of kernel reuse so that we are aware of this when utilizing this feature.
!build |
fab1caa
to
4c2963d
Compare
!build |
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.
LGTM. Thanks for making it clear that this is a somewhat unsafe option at least until we figure out the caching problem.
Co-authored-by: Ryan Spring <[email protected]>
1d7f5ea
to
e23555a
Compare
!test |
!test --serde |
!test |
This PR adds
enable_options
anddisable_options
tofd.execute
to allow setting them through the python frontend in lieu of the environment variables.This work will be used to allow enabling nvfuser matmul codegen from within Thunder.
Inspired by @jacobhinkle's PR #1905!
Tracking Issue: #3022