|
1 | 1 | #ifndef C10_MACROS_MACROS_H_ |
2 | 2 | #define C10_MACROS_MACROS_H_ |
3 | | - |
4 | | -#ifdef __cplusplus |
5 | 3 | #include <cassert> |
6 | | -#else |
7 | | -#include <assert.h> |
8 | | -#endif |
9 | 4 |
|
10 | 5 | /* Main entry for torch/headeronly/macros (used to be c10/macros). |
11 | 6 | * |
|
144 | 139 |
|
145 | 140 | #define C10_RESTRICT __restrict |
146 | 141 |
|
147 | | -#ifdef __cplusplus |
148 | | - |
149 | 142 | // Simply define the namespace, in case a dependent library want to refer to |
150 | 143 | // the c10 namespace but not any nontrivial files. |
151 | 144 | namespace c10 {} |
@@ -183,8 +176,6 @@ namespace at::xpu { |
183 | 176 | using namespace c10::xpu; |
184 | 177 | } // namespace at::xpu |
185 | 178 |
|
186 | | -#endif // __cplusplus |
187 | | - |
188 | 179 | // C10_LIKELY/C10_UNLIKELY |
189 | 180 | // |
190 | 181 | // These macros provide parentheses, so you can use these macros as: |
@@ -245,11 +236,7 @@ using namespace c10::xpu; |
245 | 236 |
|
246 | 237 | #define C10_ERASE C10_ALWAYS_INLINE C10_ATTR_VISIBILITY_HIDDEN |
247 | 238 |
|
248 | | -#ifdef __cplusplus |
249 | 239 | #include <cstdint> |
250 | | -#else |
251 | | -#include <stdint.h> |
252 | | -#endif |
253 | 240 |
|
254 | 241 | #ifdef __HIPCC__ |
255 | 242 | // Unlike CUDA, HIP requires a HIP header to be included for __host__ to work. |
@@ -480,7 +467,7 @@ __host__ __device__ |
480 | 467 | // a non-negligible performance impact even if the assert condition is |
481 | 468 | // never triggered. We choose to use abort() instead which will still |
482 | 469 | // terminate the application but without a more useful error message. |
483 | | -#if !defined(C10_USE_ROCM_KERNEL_ASSERT) && defined(USE_ROCM) |
| 470 | +#if !defined(C10_USE_ROCM_KERNEL_ASSERT) and defined(USE_ROCM) |
484 | 471 | #define CUDA_KERNEL_ASSERT(cond) \ |
485 | 472 | if C10_UNLIKELY (!(cond)) { \ |
486 | 473 | abort(); \ |
@@ -530,7 +517,7 @@ __host__ __device__ |
530 | 517 | __assert_fail( \ |
531 | 518 | #cond, __FILE__, static_cast<unsigned int>(__LINE__), __func__); \ |
532 | 519 | } |
533 | | -#endif // C10_USE_ROCM_KERNEL_ASSERT && USE_ROCM |
| 520 | +#endif // C10_USE_ROCM_KERNEL_ASSERT and USE_ROCM |
534 | 521 | #endif // __APPLE__ |
535 | 522 |
|
536 | 523 | // Compile-time switch to control how assertions are logged inside CUDA kernels. |
|
0 commit comments