File tree Expand file tree Collapse file tree 1 file changed +9
-6
lines changed Expand file tree Collapse file tree 1 file changed +9
-6
lines changed Original file line number Diff line number Diff line change 17
17
#define RPC_TARGET_IS_GPU
18
18
#endif
19
19
20
+ // Workaround for missing __has_builtin in < GCC 10.
21
+ #ifndef __has_builtin
22
+ #define __has_builtin (x ) 0
23
+ #endif
24
+
20
25
#ifndef RPC_INLINE
21
26
#define RPC_INLINE inline
22
27
#endif
@@ -141,17 +146,15 @@ template <typename T> class optional {
141
146
142
147
// / Suspend the thread briefly to assist the thread scheduler during busy loops.
143
148
RPC_INLINE void sleep_briefly () {
144
- #if defined(LIBC_TARGET_ARCH_IS_NVPTX )
149
+ #if defined(__NVPTX__ )
145
150
if (__nvvm_reflect (" __CUDA_ARCH" ) >= 700 )
146
151
asm (" nanosleep.u32 64;" ::: " memory" );
147
- #elif defined(LIBC_TARGET_ARCH_IS_AMDGPU )
152
+ #elif defined(__AMDGPU__ )
148
153
__builtin_amdgcn_s_sleep (2 );
149
- #elif defined(LIBC_TARGET_ARCH_IS_X86 )
154
+ #elif __has_builtin(__builtin_ia32_pause )
150
155
__builtin_ia32_pause ();
151
- #elif defined(LIBC_TARGET_ARCH_IS_AARCH64) && __has_builtin(__builtin_arm_isb)
156
+ #elif __has_builtin(__builtin_arm_isb)
152
157
__builtin_arm_isb (0xf );
153
- #elif defined(LIBC_TARGET_ARCH_IS_AARCH64)
154
- asm volatile (" isb\n " ::: " memory" );
155
158
#else
156
159
// Simply do nothing if sleeping isn't supported on this platform.
157
160
#endif
You can’t perform that action at this time.
0 commit comments