diff options
author | Jerry Zhang <jerryzh@fb.com> | 2018-11-05 12:24:37 -0800 |
---|---|---|
committer | Facebook Github Bot <facebook-github-bot@users.noreply.github.com> | 2018-11-05 12:32:11 -0800 |
commit | e06f92785cac559b6c3e25dd6834f10f20df9b59 (patch) | |
tree | fae6b32d7a926e0cf83dcc8a2ea266195f666078 /c10/macros | |
parent | 8c182cd89edfe29e1f11b0778597e185142720c2 (diff) | |
download | pytorch-e06f92785cac559b6c3e25dd6834f10f20df9b59.tar.gz pytorch-e06f92785cac559b6c3e25dd6834f10f20df9b59.tar.bz2 pytorch-e06f92785cac559b6c3e25dd6834f10f20df9b59.zip |
Move ATen/core/Macros.h to c10/macros/Macros.h
Summary:
EXT=h,cc,cpp,hpp,cxx,cu,cuh
d=caffe2/aten/
codemod -m -d $d --extensions $EXT 'AT_HOST_DEVICE' 'C10_HOST_DEVICE'
codemod -m -d $d --extensions $EXT 'AT_DEVICE' 'C10_DEVICE'
codemod -m -d $d --extensions $EXT 'AT_HOST' 'C10_HOST'
codemod -m -d $d --extensions $EXT 'AT_ANDROID' 'C10_ANDROID'
codemod -m -d $d --extensions $EXT 'AT_IOS' 'C10_IOS'
codemod -m -d $d --extensions $EXT 'AT_MOBILE' 'C10_MOBILE'
codemod -m -d $d --extensions $EXT 'ATen/core/Macros.h' 'c10/macros/Macros.h'
codemod -m -d $d --extensions $EXT 'HIP_HOST_DEVICE' 'C10_HIP_HOST_DEVICE'
Reviewed By: dzhulgakov
Differential Revision: D12851341
fbshipit-source-id: 7d540530ef779e16ddf2b4cdda9dcc85a61410c3
Diffstat (limited to 'c10/macros')
-rw-r--r-- | c10/macros/Macros.h | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/c10/macros/Macros.h b/c10/macros/Macros.h index ff00f62d54..2dcf0062da 100644 --- a/c10/macros/Macros.h +++ b/c10/macros/Macros.h @@ -88,4 +88,39 @@ namespace at {using namespace c10;} #define C10_UNLIKELY(expr) (expr) #endif +#include <sstream> +#include <string> + +#if defined(__CUDACC__) || defined(__HIPCC__) +// Designates functions callable from the host (CPU) and the device (GPU) +#define C10_HOST_DEVICE __host__ __device__ +#define C10_DEVICE __device__ +#define C10_HOST __host__ +#else +#define C10_HOST_DEVICE +#define C10_HOST +#define C10_DEVICE +#endif + +#ifdef __HIP_PLATFORM_HCC__ +#define C10_HIP_HOST_DEVICE __host__ __device__ +#else +#define C10_HIP_HOST_DEVICE +#endif + +#if defined(__ANDROID__) +#define C10_ANDROID 1 +#define C10_MOBILE 1 +#elif ( \ + defined(__APPLE__) && \ + (TARGET_IPHONE_SIMULATOR || TARGET_OS_SIMULATOR || TARGET_OS_IPHONE)) +#define C10_IOS 1 +#define C10_MOBILE 1 +#elif (defined(__APPLE__) && TARGET_OS_MAC) +#define C10_IOS 1 +#define C10_MOBILE 0 +#else +#define C10_MOBILE 0 +#endif // ANDROID / IOS / MACOS + #endif // C10_MACROS_MACROS_H_ |