Scott Wolchok
be849ed1fd
[PyTorch] Make tls_local_dispatch_key_set inlineable ( #49264 )
...
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/49264
FLAGS_disable_variable_dispatch had to go, but it looks like the only user was some benchmarks anyway.
ghstack-source-id: 118480532
Test Plan: Small (order of 0.1% improvement) on Internal benchmarks
Reviewed By: smessmer
Differential Revision: D25489030
fbshipit-source-id: 63147bae783e7a45391dd70d86730e48d3e0cafc
2020-12-14 11:17:35 -08:00
Basil Hosmer
b6810c1064
Include/ExcludeDispatchKeySetGuard API ( #42658 )
...
Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/42658
Test Plan: Imported from OSS
Reviewed By: ezyang
Differential Revision: D22971426
Pulled By: bhosmer
fbshipit-source-id: 4d63e0cb31745e7b662685176ae0126ff04cdece
2020-08-08 16:27:05 -07:00
Basil Hosmer
1f689b6ef9
suppress all Autograd keys in AutoNonVariableTypeMode ( #42610 )
...
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/42610
Fix for https://github.com/pytorch/pytorch/issues/42609 : `AutoNonVariableTypeMode` should suppress all autograd dispatch keys, not just `Autograd` (e.g. `XLAPreAutograd`, `PrivateUse<N>_PreAutograd`)
Test Plan: Imported from OSS
Reviewed By: ezyang
Differential Revision: D22963408
Pulled By: bhosmer
fbshipit-source-id: 2f3516580ce0c9136aff5e025285d679394f2f18
2020-08-06 13:15:42 -07:00
Edward Yang
dd64e738c5
Expunge TensorId from all DispatchKey names. ( #36240 )
...
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/36240
It's annoying, historical, and unnecessary (enum class is already
namespaced). I did this codemod with:
```
git grep -l 'CPUTensorId' | xargs sed -i 's/CPUTensorId/CPU/g'
git grep -l 'CUDATensorId' | xargs sed -i 's/CUDATensorId/CUDA/g'
git grep -l 'VariableTensorId' | xargs sed -i 's/VariableTensorId/Autograd/g'
git grep -l 'HIPTensorId' | xargs sed -i 's/HIPTensorId/HIP/g'
git grep -l 'MSNPUTensorId' | xargs sed -i 's/MSNPUTensorId/MSNPU/g'
git grep -l 'XLATensorId' | xargs sed -i 's/XLATensorId/XLA/g'
git grep -l 'PrivateUse1_TensorId' | xargs sed -i 's/PrivateUse1_TensorId/PrivateUse1/g'
git grep -l 'PrivateUse2_TensorId' | xargs sed -i 's/PrivateUse2_TensorId/PrivateUse2/g'
git grep -l 'PrivateUse3_TensorId' | xargs sed -i 's/PrivateUse3_TensorId/PrivateUse3/g'
git grep -l 'AutocastTensorId' | xargs sed -i 's/AutocastTensorId/Autocast/g'
git grep -l '_PreAutogradTensorId' | xargs sed -i 's/_PreAutogradTensorId/_PreAutograd/g'
git grep -l 'TESTING_ONLY_GenericWrapperTensorId' | xargs sed -i 's/TESTING_ONLY_GenericWrapperTensorId/TESTING_ONLY_GenericWrapper/g'
git grep -l 'TESTING_ONLY_GenericModeTensorId' | xargs sed -i 's/TESTING_ONLY_GenericModeTensorId/TESTING_ONLY_GenericMode/g'
```
Then I did a git grep for remaining TensorId occurrences, and manually
killed those (mostly in codegen, and some docs that needed updating).
Signed-off-by: Edward Z. Yang <ezyang@fb.com>
Test Plan: Imported from OSS
Differential Revision: D20929255
Pulled By: ezyang
fbshipit-source-id: dc371b6aa6e6ea7c0a5660137c14debde806a09d
2020-04-13 23:33:44 -07:00
Ilia Cherniavskii
a5bfcc5323
Unify management of thread local settings ( #35523 )
...
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/35523
In this PR we extend ThreadLocalState to cover dispatch keys and
ThreadLocalDebugInfo and move it from JIT interpreter down to
thread management (at::launch) and autograd (backward threads) code
Test Plan: unit tests (CI)
Reviewed By: dzhulgakov
Differential Revision: D20615714
fbshipit-source-id: 16a9fc96a25cb6c2629230b1187fbf78786ac565
2020-04-01 01:56:39 -07:00
Edward Yang
c7df28a2a3
Delete copy/move constructors on these RAII guards. ( #32727 )
...
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/32727
Signed-off-by: Edward Z. Yang <ezyang@fb.com>
Test Plan: Imported from OSS
Differential Revision: D19621858
Pulled By: ezyang
fbshipit-source-id: 5112c849252478d8249de4f8c8c5a2d6caf60672
2020-01-29 13:20:15 -08:00
Edward Yang
5ffa1efa52
Add missing C10_API to dispatch key TLS setter/getters ( #32557 )
...
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/32557
Signed-off-by: Edward Z. Yang <ezyang@fb.com>
Test Plan: Imported from OSS
Differential Revision: D19579853
Pulled By: ezyang
fbshipit-source-id: 45f83a7a5ead0344e4c13526abb5fafdedaed4a4
2020-01-29 13:20:09 -08:00
Pavel Belevich
62b06b9fae
Rename TensorTypeId to DispatchKey ( #32154 )
...
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/32154
TensorTypeId -> DispatchKey
c10/core/TensorTypeId.h -> c10/core/DispatchKey.h
c10/core/TensorTypeId.cpp -> c10/core/DispatchKey.cpp
TensorTypeId::* -> DispatchKey::*
TensorTypeId type_id -> DispatchKey dispatch_key
type_id -> dispatch_key
TensorTypeId::NumTensorIds -> DispatchKey::NumDispatchKeys
RealTensorTypeId -> RealDispatchKey
TensorTypeSet -> DispatchKeySet
TensorTypeIds -> DispatchKeys
c10/core/TensorTypeSet.h -> c10/core/DispatchKeySet.h
c10/core/TensorTypeSet.cpp -> c10/core/DispatchKeySet.cpp
type_set() -> key_set()
type_set_ -> key_set_
typeSet -> keySet
ExcludeTensorTypeIdGuard -> ExcludeDispatchKeyGuard
IncludeTensorTypeIdGuard -> IncludeDispatchKeyGuard
LocalTensorTypeSet -> LocalDispatchKeySet
c10/core/impl/LocalTensorTypeSet.h -> c10/core/impl/LocalDispatchKeySet.h
c10/core/impl/LocalTensorTypeSet.cpp -> c10/core/impl/LocalDispatchKeySet.cpp
tls_local_tensor_type_set -> tls_local_dispatch_key_set
tls_is_tensor_type_id_excluded -> tls_is_dispatch_key_excluded
tls_set_tensor_type_id_excluded -> tls_set_dispatch_key_excluded
tls_is_tensor_type_id_included -> tls_is_dispatch_key_included
tls_set_tensor_type_id_included -> tls_set_dispatch_key_included
MultiDispatchTensorTypeSet -> MultiDispatchKeySet
multi_dispatch_tensor_type_set -> multi_dispatch_key_set
tensorTypeIdToBackend -> dispatchKeyToBackend
backendToTensorTypeId -> backendToDispatchKey
initForTensorTypeSet -> initForDispatchKeySet
inferred_type_set -> inferred_key_set
computeTensorTypeId -> computeDispatchKey
PODLocalTensorTypeSet raw_local_tensor_type_set -> PODLocalDispatchKeySet raw_local_dispatch_key_set
get_default_tensor_type_id -> get_default_dispatch_key
inferred_type_id -> inferred_dispatch_key
actual_type_id -> actual_dispatch_key
typeSetToDispatchKey_ -> dispatchKeySetToDispatchKey_
get_type_id() -> get_dispatch_key()
legacyExtractTypeId -> legacyExtractDispatchKey
extractTypeId -> extractDispatchKey
Test Plan: Imported from OSS
Differential Revision: D19398900
Pulled By: pbelevich
fbshipit-source-id: 234ad19f93d33e00201b61e153b740a339035776
2020-01-15 11:16:08 -08:00