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
Unified management of thread local variables #28520
Comments
@albanD can you provide some samples of what exactly you want solved with this issue and approaches that you might have in mind? |
This is discussed in #28370 for example. |
We probably want something like:
#34360 is an instance that needs this centralized state. |
it seems we already basically have this, but in a form of
|
For 4. are the thread_local associated to the dispatcher already there? Otherwise, these ones should be added as well. |
No, dispatcher keys are not there yet. |
It looks like ThreadLocal<bool> GradMode_enabled = true; Thoughts? |
@peterbell10 I don't think we have any requirement for extensible thread local state, in which case hard coding the struct is simpler and more efficient. Do you have a use case in mind? |
#35523 addresses this, it cleans up our internal interfaces and propagates thread locals (e.g. grad_mode, dispatch key) as well as thread local debug info which is set by the user |
@ezyang we already have a use case for this in prod, e.g. passing user_id from the user down to logging operator observers |
gh-35523 is merged. @ilia-cher will you be continuing to work on this? |
We should add a centralized thread local handling (in c10).
This would have two main advantages:
at::parallel_for
where it will be able to handle any Tensor operation within the loop.(Setting high priority only to be discussed for triage)
cc @ezyang @gchanan @zou3519 @jerryzh168 @ssnl @albanD @gqchen @VitalyFedyunin @ngimel @mruberry
The text was updated successfully, but these errors were encountered: