[PyTorch] Gate tls_local_dispatch_key_set off on iOS too (#64753)

Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/64753

This may possibly be causing problems on iOS. (Maybe we should just revert inlining access to this thing? Really don't understand what's wrong with it, though.)
ghstack-source-id: 137830520

Test Plan: CI

Reviewed By: iseeyuan

Differential Revision: D30826897

fbshipit-source-id: 0438dee9d49e7601c26cdca0e8540229c777eddb
This commit is contained in:
Scott Wolchok 2021-09-13 10:48:55 -07:00 committed by Facebook GitHub Bot
parent d4b031b31e
commit 8cfc74400a
2 changed files with 5 additions and 5 deletions

View file

@ -16,11 +16,11 @@ namespace impl {
// logic is encapsulated in struct PODLocalDispatchKeySet.
thread_local PODLocalDispatchKeySet raw_local_dispatch_key_set;
#if defined(_MSC_VER) || defined(C10_ANDROID)
#if defined(_MSC_VER) || defined(C10_ANDROID) || defined(C10_IPHONE)
LocalDispatchKeySet tls_local_dispatch_key_set() {
return raw_local_dispatch_key_set;
}
#endif // defined(_MSC_VER) || defined(C10_ANDROID)
#endif // defined(_MSC_VER) || defined(C10_ANDROID) || defined(C10_IPHONE)
void _force_tls_local_dispatch_key_set(LocalDispatchKeySet key_set) {
raw_local_dispatch_key_set.set_included(key_set.included_);

View file

@ -64,9 +64,9 @@ struct C10_API LocalDispatchKeySet {
// thread_local variables cannot be C10_API on Windows.
// Inlining this seems to break AutoDispatchBelowAutograd on Android.
#if defined(_MSC_VER) || defined(C10_ANDROID)
#if defined(_MSC_VER) || defined(C10_ANDROID) || defined(C10_IPHONE)
C10_API LocalDispatchKeySet tls_local_dispatch_key_set();
#else // defined(_MSC_VER) || defined(C10_ANDROID)
#else // defined(_MSC_VER) || defined(C10_ANDROID) || defined(C10_IPHONE)
extern C10_API thread_local PODLocalDispatchKeySet raw_local_dispatch_key_set;
inline C10_API LocalDispatchKeySet tls_local_dispatch_key_set() {
@ -74,7 +74,7 @@ inline C10_API LocalDispatchKeySet tls_local_dispatch_key_set() {
// because they include this header.
return raw_local_dispatch_key_set;
}
#endif // defined(_MSC_VER) || defined(C10_ANDROID)
#endif // defined(_MSC_VER) || defined(C10_ANDROID) || defined(C10_IPHONE)
// Internal, use ThreadLocalStateGuard
C10_API void _force_tls_local_dispatch_key_set(LocalDispatchKeySet key_set);