@cpp-linter/clang-tidy-win32-x64 12.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.TXT +279 -0
- package/README.md +7 -0
- package/bin/clang-tidy.exe +4 -0
- package/lib/clang/12.0.1/include/__clang_cuda_builtin_vars.h +121 -0
- package/lib/clang/12.0.1/include/__clang_cuda_cmath.h +512 -0
- package/lib/clang/12.0.1/include/__clang_cuda_complex_builtins.h +285 -0
- package/lib/clang/12.0.1/include/__clang_cuda_device_functions.h +1486 -0
- package/lib/clang/12.0.1/include/__clang_cuda_intrinsics.h +486 -0
- package/lib/clang/12.0.1/include/__clang_cuda_libdevice_declares.h +462 -0
- package/lib/clang/12.0.1/include/__clang_cuda_math.h +348 -0
- package/lib/clang/12.0.1/include/__clang_cuda_math_forward_declares.h +284 -0
- package/lib/clang/12.0.1/include/__clang_cuda_runtime_wrapper.h +443 -0
- package/lib/clang/12.0.1/include/__clang_hip_cmath.h +664 -0
- package/lib/clang/12.0.1/include/__clang_hip_libdevice_declares.h +334 -0
- package/lib/clang/12.0.1/include/__clang_hip_math.h +1275 -0
- package/lib/clang/12.0.1/include/__clang_hip_runtime_wrapper.h +69 -0
- package/lib/clang/12.0.1/include/__stddef_max_align_t.h +27 -0
- package/lib/clang/12.0.1/include/__wmmintrin_aes.h +140 -0
- package/lib/clang/12.0.1/include/__wmmintrin_pclmul.h +48 -0
- package/lib/clang/12.0.1/include/adxintrin.h +72 -0
- package/lib/clang/12.0.1/include/altivec.h +18239 -0
- package/lib/clang/12.0.1/include/ammintrin.h +179 -0
- package/lib/clang/12.0.1/include/amxintrin.h +278 -0
- package/lib/clang/12.0.1/include/arm64intr.h +35 -0
- package/lib/clang/12.0.1/include/arm_acle.h +716 -0
- package/lib/clang/12.0.1/include/arm_bf16.h +20 -0
- package/lib/clang/12.0.1/include/arm_cde.h +410 -0
- package/lib/clang/12.0.1/include/arm_cmse.h +217 -0
- package/lib/clang/12.0.1/include/arm_fp16.h +596 -0
- package/lib/clang/12.0.1/include/arm_mve.h +19187 -0
- package/lib/clang/12.0.1/include/arm_neon.h +68982 -0
- package/lib/clang/12.0.1/include/arm_sve.h +18148 -0
- package/lib/clang/12.0.1/include/armintr.h +31 -0
- package/lib/clang/12.0.1/include/avx2intrin.h +1148 -0
- package/lib/clang/12.0.1/include/avx512bf16intrin.h +279 -0
- package/lib/clang/12.0.1/include/avx512bitalgintrin.h +83 -0
- package/lib/clang/12.0.1/include/avx512bwintrin.h +2024 -0
- package/lib/clang/12.0.1/include/avx512cdintrin.h +123 -0
- package/lib/clang/12.0.1/include/avx512dqintrin.h +1377 -0
- package/lib/clang/12.0.1/include/avx512erintrin.h +271 -0
- package/lib/clang/12.0.1/include/avx512fintrin.h +9618 -0
- package/lib/clang/12.0.1/include/avx512ifmaintrin.h +68 -0
- package/lib/clang/12.0.1/include/avx512ifmavlintrin.h +119 -0
- package/lib/clang/12.0.1/include/avx512pfintrin.h +97 -0
- package/lib/clang/12.0.1/include/avx512vbmi2intrin.h +357 -0
- package/lib/clang/12.0.1/include/avx512vbmiintrin.h +105 -0
- package/lib/clang/12.0.1/include/avx512vbmivlintrin.h +188 -0
- package/lib/clang/12.0.1/include/avx512vlbf16intrin.h +474 -0
- package/lib/clang/12.0.1/include/avx512vlbitalgintrin.h +145 -0
- package/lib/clang/12.0.1/include/avx512vlbwintrin.h +2809 -0
- package/lib/clang/12.0.1/include/avx512vlcdintrin.h +225 -0
- package/lib/clang/12.0.1/include/avx512vldqintrin.h +1167 -0
- package/lib/clang/12.0.1/include/avx512vlintrin.h +8445 -0
- package/lib/clang/12.0.1/include/avx512vlvbmi2intrin.h +689 -0
- package/lib/clang/12.0.1/include/avx512vlvnniintrin.h +304 -0
- package/lib/clang/12.0.1/include/avx512vlvp2intersectintrin.h +121 -0
- package/lib/clang/12.0.1/include/avx512vnniintrin.h +115 -0
- package/lib/clang/12.0.1/include/avx512vp2intersectintrin.h +77 -0
- package/lib/clang/12.0.1/include/avx512vpopcntdqintrin.h +54 -0
- package/lib/clang/12.0.1/include/avx512vpopcntdqvlintrin.h +91 -0
- package/lib/clang/12.0.1/include/avxintrin.h +5053 -0
- package/lib/clang/12.0.1/include/avxvnniintrin.h +225 -0
- package/lib/clang/12.0.1/include/bmi2intrin.h +81 -0
- package/lib/clang/12.0.1/include/bmiintrin.h +427 -0
- package/lib/clang/12.0.1/include/cet.h +66 -0
- package/lib/clang/12.0.1/include/cetintrin.h +99 -0
- package/lib/clang/12.0.1/include/cldemoteintrin.h +36 -0
- package/lib/clang/12.0.1/include/clflushoptintrin.h +27 -0
- package/lib/clang/12.0.1/include/clwbintrin.h +38 -0
- package/lib/clang/12.0.1/include/clzerointrin.h +36 -0
- package/lib/clang/12.0.1/include/cpuid.h +319 -0
- package/lib/clang/12.0.1/include/cuda_wrappers/algorithm +116 -0
- package/lib/clang/12.0.1/include/cuda_wrappers/complex +82 -0
- package/lib/clang/12.0.1/include/cuda_wrappers/new +106 -0
- package/lib/clang/12.0.1/include/emmintrin.h +4981 -0
- package/lib/clang/12.0.1/include/enqcmdintrin.h +63 -0
- package/lib/clang/12.0.1/include/f16cintrin.h +162 -0
- package/lib/clang/12.0.1/include/float.h +152 -0
- package/lib/clang/12.0.1/include/fma4intrin.h +218 -0
- package/lib/clang/12.0.1/include/fmaintrin.h +216 -0
- package/lib/clang/12.0.1/include/fxsrintrin.h +91 -0
- package/lib/clang/12.0.1/include/gfniintrin.h +193 -0
- package/lib/clang/12.0.1/include/hresetintrin.h +49 -0
- package/lib/clang/12.0.1/include/htmintrin.h +212 -0
- package/lib/clang/12.0.1/include/htmxlintrin.h +345 -0
- package/lib/clang/12.0.1/include/ia32intrin.h +441 -0
- package/lib/clang/12.0.1/include/immintrin.h +600 -0
- package/lib/clang/12.0.1/include/intrin.h +585 -0
- package/lib/clang/12.0.1/include/inttypes.h +97 -0
- package/lib/clang/12.0.1/include/invpcidintrin.h +23 -0
- package/lib/clang/12.0.1/include/iso646.h +27 -0
- package/lib/clang/12.0.1/include/keylockerintrin.h +506 -0
- package/lib/clang/12.0.1/include/limits.h +102 -0
- package/lib/clang/12.0.1/include/lwpintrin.h +136 -0
- package/lib/clang/12.0.1/include/lzcntintrin.h +104 -0
- package/lib/clang/12.0.1/include/mm3dnow.h +157 -0
- package/lib/clang/12.0.1/include/mm_malloc.h +67 -0
- package/lib/clang/12.0.1/include/mmintrin.h +1558 -0
- package/lib/clang/12.0.1/include/module.modulemap +164 -0
- package/lib/clang/12.0.1/include/movdirintrin.h +49 -0
- package/lib/clang/12.0.1/include/msa.h +573 -0
- package/lib/clang/12.0.1/include/mwaitxintrin.h +33 -0
- package/lib/clang/12.0.1/include/nmmintrin.h +16 -0
- package/lib/clang/12.0.1/include/opencl-c-base.h +589 -0
- package/lib/clang/12.0.1/include/opencl-c.h +17162 -0
- package/lib/clang/12.0.1/include/openmp_wrappers/__clang_openmp_device_functions.h +42 -0
- package/lib/clang/12.0.1/include/openmp_wrappers/cmath +78 -0
- package/lib/clang/12.0.1/include/openmp_wrappers/complex +52 -0
- package/lib/clang/12.0.1/include/openmp_wrappers/complex.h +27 -0
- package/lib/clang/12.0.1/include/openmp_wrappers/complex_cmath.h +388 -0
- package/lib/clang/12.0.1/include/openmp_wrappers/math.h +51 -0
- package/lib/clang/12.0.1/include/openmp_wrappers/new +70 -0
- package/lib/clang/12.0.1/include/pconfigintrin.h +40 -0
- package/lib/clang/12.0.1/include/pkuintrin.h +34 -0
- package/lib/clang/12.0.1/include/pmmintrin.h +290 -0
- package/lib/clang/12.0.1/include/popcntintrin.h +59 -0
- package/lib/clang/12.0.1/include/ppc_wrappers/emmintrin.h +2324 -0
- package/lib/clang/12.0.1/include/ppc_wrappers/mm_malloc.h +50 -0
- package/lib/clang/12.0.1/include/ppc_wrappers/mmintrin.h +1450 -0
- package/lib/clang/12.0.1/include/ppc_wrappers/pmmintrin.h +150 -0
- package/lib/clang/12.0.1/include/ppc_wrappers/smmintrin.h +109 -0
- package/lib/clang/12.0.1/include/ppc_wrappers/tmmintrin.h +495 -0
- package/lib/clang/12.0.1/include/ppc_wrappers/xmmintrin.h +1843 -0
- package/lib/clang/12.0.1/include/prfchwintrin.h +55 -0
- package/lib/clang/12.0.1/include/ptwriteintrin.h +37 -0
- package/lib/clang/12.0.1/include/rdseedintrin.h +42 -0
- package/lib/clang/12.0.1/include/rtmintrin.h +45 -0
- package/lib/clang/12.0.1/include/s390intrin.h +25 -0
- package/lib/clang/12.0.1/include/serializeintrin.h +30 -0
- package/lib/clang/12.0.1/include/sgxintrin.h +60 -0
- package/lib/clang/12.0.1/include/shaintrin.h +61 -0
- package/lib/clang/12.0.1/include/smmintrin.h +2430 -0
- package/lib/clang/12.0.1/include/stdalign.h +21 -0
- package/lib/clang/12.0.1/include/stdarg.h +35 -0
- package/lib/clang/12.0.1/include/stdatomic.h +176 -0
- package/lib/clang/12.0.1/include/stdbool.h +31 -0
- package/lib/clang/12.0.1/include/stddef.h +121 -0
- package/lib/clang/12.0.1/include/stdint.h +693 -0
- package/lib/clang/12.0.1/include/stdnoreturn.h +16 -0
- package/lib/clang/12.0.1/include/tbmintrin.h +140 -0
- package/lib/clang/12.0.1/include/tgmath.h +1368 -0
- package/lib/clang/12.0.1/include/tmmintrin.h +771 -0
- package/lib/clang/12.0.1/include/tsxldtrkintrin.h +56 -0
- package/lib/clang/12.0.1/include/uintrintrin.h +150 -0
- package/lib/clang/12.0.1/include/unwind.h +327 -0
- package/lib/clang/12.0.1/include/vadefs.h +51 -0
- package/lib/clang/12.0.1/include/vaesintrin.h +84 -0
- package/lib/clang/12.0.1/include/varargs.h +12 -0
- package/lib/clang/12.0.1/include/vecintrin.h +10998 -0
- package/lib/clang/12.0.1/include/vpclmulqdqintrin.h +28 -0
- package/lib/clang/12.0.1/include/waitpkgintrin.h +42 -0
- package/lib/clang/12.0.1/include/wasm_simd128.h +1167 -0
- package/lib/clang/12.0.1/include/wbnoinvdintrin.h +24 -0
- package/lib/clang/12.0.1/include/wmmintrin.h +19 -0
- package/lib/clang/12.0.1/include/x86gprintrin.h +23 -0
- package/lib/clang/12.0.1/include/x86intrin.h +63 -0
- package/lib/clang/12.0.1/include/xmmintrin.h +3008 -0
- package/lib/clang/12.0.1/include/xopintrin.h +770 -0
- package/lib/clang/12.0.1/include/xsavecintrin.h +34 -0
- package/lib/clang/12.0.1/include/xsaveintrin.h +63 -0
- package/lib/clang/12.0.1/include/xsaveoptintrin.h +34 -0
- package/lib/clang/12.0.1/include/xsavesintrin.h +44 -0
- package/lib/clang/12.0.1/include/xtestintrin.h +27 -0
- package/package.json +32 -0
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/*===- __clang_openmp_device_functions.h - OpenMP device function declares -===
|
|
2
|
+
*
|
|
3
|
+
* Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
|
4
|
+
* See https://llvm.org/LICENSE.txt for license information.
|
|
5
|
+
* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
|
6
|
+
*
|
|
7
|
+
*===-----------------------------------------------------------------------===
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
#ifndef __CLANG_OPENMP_DEVICE_FUNCTIONS_H__
|
|
11
|
+
#define __CLANG_OPENMP_DEVICE_FUNCTIONS_H__
|
|
12
|
+
|
|
13
|
+
#ifndef _OPENMP
|
|
14
|
+
#error "This file is for OpenMP compilation only."
|
|
15
|
+
#endif
|
|
16
|
+
|
|
17
|
+
#pragma omp begin declare variant match( \
|
|
18
|
+
device = {arch(nvptx, nvptx64)}, implementation = {extension(match_any)})
|
|
19
|
+
|
|
20
|
+
#ifdef __cplusplus
|
|
21
|
+
extern "C" {
|
|
22
|
+
#endif
|
|
23
|
+
|
|
24
|
+
#define __CUDA__
|
|
25
|
+
#define __OPENMP_NVPTX__
|
|
26
|
+
|
|
27
|
+
/// Include declarations for libdevice functions.
|
|
28
|
+
#include <__clang_cuda_libdevice_declares.h>
|
|
29
|
+
|
|
30
|
+
/// Provide definitions for these functions.
|
|
31
|
+
#include <__clang_cuda_device_functions.h>
|
|
32
|
+
|
|
33
|
+
#undef __OPENMP_NVPTX__
|
|
34
|
+
#undef __CUDA__
|
|
35
|
+
|
|
36
|
+
#ifdef __cplusplus
|
|
37
|
+
} // extern "C"
|
|
38
|
+
#endif
|
|
39
|
+
|
|
40
|
+
#pragma omp end declare variant
|
|
41
|
+
|
|
42
|
+
#endif
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
/*===-- __clang_openmp_device_functions.h - OpenMP math declares ------ c++ -===
|
|
2
|
+
*
|
|
3
|
+
* Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
|
4
|
+
* See https://llvm.org/LICENSE.txt for license information.
|
|
5
|
+
* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
|
6
|
+
*
|
|
7
|
+
*===-----------------------------------------------------------------------===
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
#ifndef __CLANG_OPENMP_CMATH_H__
|
|
11
|
+
#define __CLANG_OPENMP_CMATH_H__
|
|
12
|
+
|
|
13
|
+
#ifndef _OPENMP
|
|
14
|
+
#error "This file is for OpenMP compilation only."
|
|
15
|
+
#endif
|
|
16
|
+
|
|
17
|
+
#include_next <cmath>
|
|
18
|
+
|
|
19
|
+
// Make sure we include our math.h overlay, it probably happend already but we
|
|
20
|
+
// need to be sure.
|
|
21
|
+
#include <math.h>
|
|
22
|
+
|
|
23
|
+
// We (might) need cstdlib because __clang_cuda_cmath.h below declares `abs`
|
|
24
|
+
// which might live in cstdlib.
|
|
25
|
+
#include <cstdlib>
|
|
26
|
+
|
|
27
|
+
// We need limits because __clang_cuda_cmath.h below uses `std::numeric_limit`.
|
|
28
|
+
#include <limits>
|
|
29
|
+
|
|
30
|
+
#pragma omp begin declare variant match( \
|
|
31
|
+
device = {arch(nvptx, nvptx64)}, implementation = {extension(match_any, allow_templates)})
|
|
32
|
+
|
|
33
|
+
#define __CUDA__
|
|
34
|
+
#define __OPENMP_NVPTX__
|
|
35
|
+
#include <__clang_cuda_cmath.h>
|
|
36
|
+
#undef __OPENMP_NVPTX__
|
|
37
|
+
#undef __CUDA__
|
|
38
|
+
|
|
39
|
+
// Overloads not provided by the CUDA wrappers but by the CUDA system headers.
|
|
40
|
+
// Since we do not include the latter we define them ourselves.
|
|
41
|
+
#define __DEVICE__ static constexpr __attribute__((always_inline, nothrow))
|
|
42
|
+
|
|
43
|
+
__DEVICE__ float acosh(float __x) { return ::acoshf(__x); }
|
|
44
|
+
__DEVICE__ float asinh(float __x) { return ::asinhf(__x); }
|
|
45
|
+
__DEVICE__ float atanh(float __x) { return ::atanhf(__x); }
|
|
46
|
+
__DEVICE__ float cbrt(float __x) { return ::cbrtf(__x); }
|
|
47
|
+
__DEVICE__ float erf(float __x) { return ::erff(__x); }
|
|
48
|
+
__DEVICE__ float erfc(float __x) { return ::erfcf(__x); }
|
|
49
|
+
__DEVICE__ float exp2(float __x) { return ::exp2f(__x); }
|
|
50
|
+
__DEVICE__ float expm1(float __x) { return ::expm1f(__x); }
|
|
51
|
+
__DEVICE__ float fdim(float __x, float __y) { return ::fdimf(__x, __y); }
|
|
52
|
+
__DEVICE__ float hypot(float __x, float __y) { return ::hypotf(__x, __y); }
|
|
53
|
+
__DEVICE__ int ilogb(float __x) { return ::ilogbf(__x); }
|
|
54
|
+
__DEVICE__ float lgamma(float __x) { return ::lgammaf(__x); }
|
|
55
|
+
__DEVICE__ long long int llrint(float __x) { return ::llrintf(__x); }
|
|
56
|
+
__DEVICE__ long long int llround(float __x) { return ::llroundf(__x); }
|
|
57
|
+
__DEVICE__ float log1p(float __x) { return ::log1pf(__x); }
|
|
58
|
+
__DEVICE__ float log2(float __x) { return ::log2f(__x); }
|
|
59
|
+
__DEVICE__ float logb(float __x) { return ::logbf(__x); }
|
|
60
|
+
__DEVICE__ long int lrint(float __x) { return ::lrintf(__x); }
|
|
61
|
+
__DEVICE__ long int lround(float __x) { return ::lroundf(__x); }
|
|
62
|
+
__DEVICE__ float nextafter(float __x, float __y) {
|
|
63
|
+
return ::nextafterf(__x, __y);
|
|
64
|
+
}
|
|
65
|
+
__DEVICE__ float remainder(float __x, float __y) {
|
|
66
|
+
return ::remainderf(__x, __y);
|
|
67
|
+
}
|
|
68
|
+
__DEVICE__ float scalbln(float __x, long int __y) {
|
|
69
|
+
return ::scalblnf(__x, __y);
|
|
70
|
+
}
|
|
71
|
+
__DEVICE__ float scalbn(float __x, int __y) { return ::scalbnf(__x, __y); }
|
|
72
|
+
__DEVICE__ float tgamma(float __x) { return ::tgammaf(__x); }
|
|
73
|
+
|
|
74
|
+
#undef __DEVICE__
|
|
75
|
+
|
|
76
|
+
#pragma omp end declare variant
|
|
77
|
+
|
|
78
|
+
#endif
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/*===-- complex --- OpenMP complex wrapper for target regions --------- c++ -===
|
|
2
|
+
*
|
|
3
|
+
* Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
|
4
|
+
* See https://llvm.org/LICENSE.txt for license information.
|
|
5
|
+
* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
|
6
|
+
*
|
|
7
|
+
*===-----------------------------------------------------------------------===
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
#ifndef __CLANG_OPENMP_COMPLEX__
|
|
11
|
+
#define __CLANG_OPENMP_COMPLEX__
|
|
12
|
+
|
|
13
|
+
#ifndef _OPENMP
|
|
14
|
+
#error "This file is for OpenMP compilation only."
|
|
15
|
+
#endif
|
|
16
|
+
|
|
17
|
+
// We require std::math functions in the complex builtins below.
|
|
18
|
+
#include <cmath>
|
|
19
|
+
|
|
20
|
+
#define __CUDA__
|
|
21
|
+
#define __OPENMP_NVPTX__
|
|
22
|
+
#include <__clang_cuda_complex_builtins.h>
|
|
23
|
+
#undef __OPENMP_NVPTX__
|
|
24
|
+
#endif
|
|
25
|
+
|
|
26
|
+
// Grab the host header too.
|
|
27
|
+
#include_next <complex>
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
#ifdef __cplusplus
|
|
31
|
+
|
|
32
|
+
// If we are compiling against libc++, the macro _LIBCPP_STD_VER should be set
|
|
33
|
+
// after including <cmath> above. Since the complex header we use is a
|
|
34
|
+
// simplified version of the libc++, we don't need it in this case. If we
|
|
35
|
+
// compile against libstdc++, or any other standard library, we will overload
|
|
36
|
+
// the (hopefully template) functions in the <complex> header with the ones we
|
|
37
|
+
// got from libc++ which decomposes math functions, like `std::sin`, into
|
|
38
|
+
// arithmetic and calls to non-complex functions, all of which we can then
|
|
39
|
+
// handle.
|
|
40
|
+
#ifndef _LIBCPP_STD_VER
|
|
41
|
+
|
|
42
|
+
#pragma omp begin declare variant match( \
|
|
43
|
+
device = {arch(nvptx, nvptx64)}, \
|
|
44
|
+
implementation = {extension(match_any, allow_templates)})
|
|
45
|
+
|
|
46
|
+
#include <complex_cmath.h>
|
|
47
|
+
|
|
48
|
+
#pragma omp end declare variant
|
|
49
|
+
|
|
50
|
+
#endif
|
|
51
|
+
|
|
52
|
+
#endif
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/*===-- complex --- OpenMP complex wrapper for target regions --------- c++ -===
|
|
2
|
+
*
|
|
3
|
+
* Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
|
4
|
+
* See https://llvm.org/LICENSE.txt for license information.
|
|
5
|
+
* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
|
6
|
+
*
|
|
7
|
+
*===-----------------------------------------------------------------------===
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
#ifndef __CLANG_OPENMP_COMPLEX_H__
|
|
11
|
+
#define __CLANG_OPENMP_COMPLEX_H__
|
|
12
|
+
|
|
13
|
+
#ifndef _OPENMP
|
|
14
|
+
#error "This file is for OpenMP compilation only."
|
|
15
|
+
#endif
|
|
16
|
+
|
|
17
|
+
// We require math functions in the complex builtins below.
|
|
18
|
+
#include <math.h>
|
|
19
|
+
|
|
20
|
+
#define __CUDA__
|
|
21
|
+
#define __OPENMP_NVPTX__
|
|
22
|
+
#include <__clang_cuda_complex_builtins.h>
|
|
23
|
+
#undef __OPENMP_NVPTX__
|
|
24
|
+
#endif
|
|
25
|
+
|
|
26
|
+
// Grab the host header too.
|
|
27
|
+
#include_next <complex.h>
|
|
@@ -0,0 +1,388 @@
|
|
|
1
|
+
//===------------------------- __complex_cmath.h --------------------------===//
|
|
2
|
+
//
|
|
3
|
+
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
|
4
|
+
// See https://llvm.org/LICENSE.txt for license information.
|
|
5
|
+
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
|
6
|
+
//
|
|
7
|
+
//===----------------------------------------------------------------------===//
|
|
8
|
+
//
|
|
9
|
+
// std::complex header copied from the libcxx source and simplified for use in
|
|
10
|
+
// OpenMP target offload regions.
|
|
11
|
+
//
|
|
12
|
+
//===----------------------------------------------------------------------===//
|
|
13
|
+
|
|
14
|
+
#ifndef _OPENMP
|
|
15
|
+
#error "This file is for OpenMP compilation only."
|
|
16
|
+
#endif
|
|
17
|
+
|
|
18
|
+
#ifndef __cplusplus
|
|
19
|
+
#error "This file is for C++ compilation only."
|
|
20
|
+
#endif
|
|
21
|
+
|
|
22
|
+
#ifndef _LIBCPP_COMPLEX
|
|
23
|
+
#define _LIBCPP_COMPLEX
|
|
24
|
+
|
|
25
|
+
#include <cmath>
|
|
26
|
+
#include <type_traits>
|
|
27
|
+
|
|
28
|
+
#define __DEVICE__ static constexpr __attribute__((nothrow))
|
|
29
|
+
|
|
30
|
+
namespace std {
|
|
31
|
+
|
|
32
|
+
// abs
|
|
33
|
+
|
|
34
|
+
template <class _Tp> __DEVICE__ _Tp abs(const std::complex<_Tp> &__c) {
|
|
35
|
+
return hypot(__c.real(), __c.imag());
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
// arg
|
|
39
|
+
|
|
40
|
+
template <class _Tp> __DEVICE__ _Tp arg(const std::complex<_Tp> &__c) {
|
|
41
|
+
return atan2(__c.imag(), __c.real());
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
template <class _Tp>
|
|
45
|
+
typename enable_if<is_integral<_Tp>::value || is_same<_Tp, double>::value,
|
|
46
|
+
double>::type
|
|
47
|
+
arg(_Tp __re) {
|
|
48
|
+
return atan2(0., __re);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
template <class _Tp>
|
|
52
|
+
typename enable_if<is_same<_Tp, float>::value, float>::type arg(_Tp __re) {
|
|
53
|
+
return atan2f(0.F, __re);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
// norm
|
|
57
|
+
|
|
58
|
+
template <class _Tp> __DEVICE__ _Tp norm(const std::complex<_Tp> &__c) {
|
|
59
|
+
if (std::isinf(__c.real()))
|
|
60
|
+
return abs(__c.real());
|
|
61
|
+
if (std::isinf(__c.imag()))
|
|
62
|
+
return abs(__c.imag());
|
|
63
|
+
return __c.real() * __c.real() + __c.imag() * __c.imag();
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
// conj
|
|
67
|
+
|
|
68
|
+
template <class _Tp> std::complex<_Tp> conj(const std::complex<_Tp> &__c) {
|
|
69
|
+
return std::complex<_Tp>(__c.real(), -__c.imag());
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
// proj
|
|
73
|
+
|
|
74
|
+
template <class _Tp> std::complex<_Tp> proj(const std::complex<_Tp> &__c) {
|
|
75
|
+
std::complex<_Tp> __r = __c;
|
|
76
|
+
if (std::isinf(__c.real()) || std::isinf(__c.imag()))
|
|
77
|
+
__r = std::complex<_Tp>(INFINITY, copysign(_Tp(0), __c.imag()));
|
|
78
|
+
return __r;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
// polar
|
|
82
|
+
|
|
83
|
+
template <class _Tp>
|
|
84
|
+
complex<_Tp> polar(const _Tp &__rho, const _Tp &__theta = _Tp()) {
|
|
85
|
+
if (std::isnan(__rho) || signbit(__rho))
|
|
86
|
+
return std::complex<_Tp>(_Tp(NAN), _Tp(NAN));
|
|
87
|
+
if (std::isnan(__theta)) {
|
|
88
|
+
if (std::isinf(__rho))
|
|
89
|
+
return std::complex<_Tp>(__rho, __theta);
|
|
90
|
+
return std::complex<_Tp>(__theta, __theta);
|
|
91
|
+
}
|
|
92
|
+
if (std::isinf(__theta)) {
|
|
93
|
+
if (std::isinf(__rho))
|
|
94
|
+
return std::complex<_Tp>(__rho, _Tp(NAN));
|
|
95
|
+
return std::complex<_Tp>(_Tp(NAN), _Tp(NAN));
|
|
96
|
+
}
|
|
97
|
+
_Tp __x = __rho * cos(__theta);
|
|
98
|
+
if (std::isnan(__x))
|
|
99
|
+
__x = 0;
|
|
100
|
+
_Tp __y = __rho * sin(__theta);
|
|
101
|
+
if (std::isnan(__y))
|
|
102
|
+
__y = 0;
|
|
103
|
+
return std::complex<_Tp>(__x, __y);
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
// log
|
|
107
|
+
|
|
108
|
+
template <class _Tp> std::complex<_Tp> log(const std::complex<_Tp> &__x) {
|
|
109
|
+
return std::complex<_Tp>(log(abs(__x)), arg(__x));
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
// log10
|
|
113
|
+
|
|
114
|
+
template <class _Tp> std::complex<_Tp> log10(const std::complex<_Tp> &__x) {
|
|
115
|
+
return log(__x) / log(_Tp(10));
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
// sqrt
|
|
119
|
+
|
|
120
|
+
template <class _Tp>
|
|
121
|
+
__DEVICE__ std::complex<_Tp> sqrt(const std::complex<_Tp> &__x) {
|
|
122
|
+
if (std::isinf(__x.imag()))
|
|
123
|
+
return std::complex<_Tp>(_Tp(INFINITY), __x.imag());
|
|
124
|
+
if (std::isinf(__x.real())) {
|
|
125
|
+
if (__x.real() > _Tp(0))
|
|
126
|
+
return std::complex<_Tp>(__x.real(), std::isnan(__x.imag())
|
|
127
|
+
? __x.imag()
|
|
128
|
+
: copysign(_Tp(0), __x.imag()));
|
|
129
|
+
return std::complex<_Tp>(std::isnan(__x.imag()) ? __x.imag() : _Tp(0),
|
|
130
|
+
copysign(__x.real(), __x.imag()));
|
|
131
|
+
}
|
|
132
|
+
return polar(sqrt(abs(__x)), arg(__x) / _Tp(2));
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
// exp
|
|
136
|
+
|
|
137
|
+
template <class _Tp>
|
|
138
|
+
__DEVICE__ std::complex<_Tp> exp(const std::complex<_Tp> &__x) {
|
|
139
|
+
_Tp __i = __x.imag();
|
|
140
|
+
if (std::isinf(__x.real())) {
|
|
141
|
+
if (__x.real() < _Tp(0)) {
|
|
142
|
+
if (!std::isfinite(__i))
|
|
143
|
+
__i = _Tp(1);
|
|
144
|
+
} else if (__i == 0 || !std::isfinite(__i)) {
|
|
145
|
+
if (std::isinf(__i))
|
|
146
|
+
__i = _Tp(NAN);
|
|
147
|
+
return std::complex<_Tp>(__x.real(), __i);
|
|
148
|
+
}
|
|
149
|
+
} else if (std::isnan(__x.real()) && __x.imag() == 0)
|
|
150
|
+
return __x;
|
|
151
|
+
_Tp __e = exp(__x.real());
|
|
152
|
+
return std::complex<_Tp>(__e * cos(__i), __e * sin(__i));
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
// pow
|
|
156
|
+
|
|
157
|
+
template <class _Tp>
|
|
158
|
+
std::complex<_Tp> pow(const std::complex<_Tp> &__x,
|
|
159
|
+
const std::complex<_Tp> &__y) {
|
|
160
|
+
return exp(__y * log(__x));
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
// __sqr, computes pow(x, 2)
|
|
164
|
+
|
|
165
|
+
template <class _Tp> std::complex<_Tp> __sqr(const std::complex<_Tp> &__x) {
|
|
166
|
+
return std::complex<_Tp>((__x.real() - __x.imag()) *
|
|
167
|
+
(__x.real() + __x.imag()),
|
|
168
|
+
_Tp(2) * __x.real() * __x.imag());
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
// asinh
|
|
172
|
+
|
|
173
|
+
template <class _Tp>
|
|
174
|
+
__DEVICE__ std::complex<_Tp> asinh(const std::complex<_Tp> &__x) {
|
|
175
|
+
const _Tp __pi(atan2(+0., -0.));
|
|
176
|
+
if (std::isinf(__x.real())) {
|
|
177
|
+
if (std::isnan(__x.imag()))
|
|
178
|
+
return __x;
|
|
179
|
+
if (std::isinf(__x.imag()))
|
|
180
|
+
return std::complex<_Tp>(__x.real(),
|
|
181
|
+
copysign(__pi * _Tp(0.25), __x.imag()));
|
|
182
|
+
return std::complex<_Tp>(__x.real(), copysign(_Tp(0), __x.imag()));
|
|
183
|
+
}
|
|
184
|
+
if (std::isnan(__x.real())) {
|
|
185
|
+
if (std::isinf(__x.imag()))
|
|
186
|
+
return std::complex<_Tp>(__x.imag(), __x.real());
|
|
187
|
+
if (__x.imag() == 0)
|
|
188
|
+
return __x;
|
|
189
|
+
return std::complex<_Tp>(__x.real(), __x.real());
|
|
190
|
+
}
|
|
191
|
+
if (std::isinf(__x.imag()))
|
|
192
|
+
return std::complex<_Tp>(copysign(__x.imag(), __x.real()),
|
|
193
|
+
copysign(__pi / _Tp(2), __x.imag()));
|
|
194
|
+
std::complex<_Tp> __z = log(__x + sqrt(__sqr(__x) + _Tp(1)));
|
|
195
|
+
return std::complex<_Tp>(copysign(__z.real(), __x.real()),
|
|
196
|
+
copysign(__z.imag(), __x.imag()));
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
// acosh
|
|
200
|
+
|
|
201
|
+
template <class _Tp>
|
|
202
|
+
__DEVICE__ std::complex<_Tp> acosh(const std::complex<_Tp> &__x) {
|
|
203
|
+
const _Tp __pi(atan2(+0., -0.));
|
|
204
|
+
if (std::isinf(__x.real())) {
|
|
205
|
+
if (std::isnan(__x.imag()))
|
|
206
|
+
return std::complex<_Tp>(abs(__x.real()), __x.imag());
|
|
207
|
+
if (std::isinf(__x.imag())) {
|
|
208
|
+
if (__x.real() > 0)
|
|
209
|
+
return std::complex<_Tp>(__x.real(),
|
|
210
|
+
copysign(__pi * _Tp(0.25), __x.imag()));
|
|
211
|
+
else
|
|
212
|
+
return std::complex<_Tp>(-__x.real(),
|
|
213
|
+
copysign(__pi * _Tp(0.75), __x.imag()));
|
|
214
|
+
}
|
|
215
|
+
if (__x.real() < 0)
|
|
216
|
+
return std::complex<_Tp>(-__x.real(), copysign(__pi, __x.imag()));
|
|
217
|
+
return std::complex<_Tp>(__x.real(), copysign(_Tp(0), __x.imag()));
|
|
218
|
+
}
|
|
219
|
+
if (std::isnan(__x.real())) {
|
|
220
|
+
if (std::isinf(__x.imag()))
|
|
221
|
+
return std::complex<_Tp>(abs(__x.imag()), __x.real());
|
|
222
|
+
return std::complex<_Tp>(__x.real(), __x.real());
|
|
223
|
+
}
|
|
224
|
+
if (std::isinf(__x.imag()))
|
|
225
|
+
return std::complex<_Tp>(abs(__x.imag()),
|
|
226
|
+
copysign(__pi / _Tp(2), __x.imag()));
|
|
227
|
+
std::complex<_Tp> __z = log(__x + sqrt(__sqr(__x) - _Tp(1)));
|
|
228
|
+
return std::complex<_Tp>(copysign(__z.real(), _Tp(0)),
|
|
229
|
+
copysign(__z.imag(), __x.imag()));
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
// atanh
|
|
233
|
+
|
|
234
|
+
template <class _Tp>
|
|
235
|
+
__DEVICE__ std::complex<_Tp> atanh(const std::complex<_Tp> &__x) {
|
|
236
|
+
const _Tp __pi(atan2(+0., -0.));
|
|
237
|
+
if (std::isinf(__x.imag())) {
|
|
238
|
+
return std::complex<_Tp>(copysign(_Tp(0), __x.real()),
|
|
239
|
+
copysign(__pi / _Tp(2), __x.imag()));
|
|
240
|
+
}
|
|
241
|
+
if (std::isnan(__x.imag())) {
|
|
242
|
+
if (std::isinf(__x.real()) || __x.real() == 0)
|
|
243
|
+
return std::complex<_Tp>(copysign(_Tp(0), __x.real()), __x.imag());
|
|
244
|
+
return std::complex<_Tp>(__x.imag(), __x.imag());
|
|
245
|
+
}
|
|
246
|
+
if (std::isnan(__x.real())) {
|
|
247
|
+
return std::complex<_Tp>(__x.real(), __x.real());
|
|
248
|
+
}
|
|
249
|
+
if (std::isinf(__x.real())) {
|
|
250
|
+
return std::complex<_Tp>(copysign(_Tp(0), __x.real()),
|
|
251
|
+
copysign(__pi / _Tp(2), __x.imag()));
|
|
252
|
+
}
|
|
253
|
+
if (abs(__x.real()) == _Tp(1) && __x.imag() == _Tp(0)) {
|
|
254
|
+
return std::complex<_Tp>(copysign(_Tp(INFINITY), __x.real()),
|
|
255
|
+
copysign(_Tp(0), __x.imag()));
|
|
256
|
+
}
|
|
257
|
+
std::complex<_Tp> __z = log((_Tp(1) + __x) / (_Tp(1) - __x)) / _Tp(2);
|
|
258
|
+
return std::complex<_Tp>(copysign(__z.real(), __x.real()),
|
|
259
|
+
copysign(__z.imag(), __x.imag()));
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
// sinh
|
|
263
|
+
|
|
264
|
+
template <class _Tp>
|
|
265
|
+
__DEVICE__ std::complex<_Tp> sinh(const std::complex<_Tp> &__x) {
|
|
266
|
+
if (std::isinf(__x.real()) && !std::isfinite(__x.imag()))
|
|
267
|
+
return std::complex<_Tp>(__x.real(), _Tp(NAN));
|
|
268
|
+
if (__x.real() == 0 && !std::isfinite(__x.imag()))
|
|
269
|
+
return std::complex<_Tp>(__x.real(), _Tp(NAN));
|
|
270
|
+
if (__x.imag() == 0 && !std::isfinite(__x.real()))
|
|
271
|
+
return __x;
|
|
272
|
+
return std::complex<_Tp>(sinh(__x.real()) * cos(__x.imag()),
|
|
273
|
+
cosh(__x.real()) * sin(__x.imag()));
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
// cosh
|
|
277
|
+
|
|
278
|
+
template <class _Tp>
|
|
279
|
+
__DEVICE__ std::complex<_Tp> cosh(const std::complex<_Tp> &__x) {
|
|
280
|
+
if (std::isinf(__x.real()) && !std::isfinite(__x.imag()))
|
|
281
|
+
return std::complex<_Tp>(abs(__x.real()), _Tp(NAN));
|
|
282
|
+
if (__x.real() == 0 && !std::isfinite(__x.imag()))
|
|
283
|
+
return std::complex<_Tp>(_Tp(NAN), __x.real());
|
|
284
|
+
if (__x.real() == 0 && __x.imag() == 0)
|
|
285
|
+
return std::complex<_Tp>(_Tp(1), __x.imag());
|
|
286
|
+
if (__x.imag() == 0 && !std::isfinite(__x.real()))
|
|
287
|
+
return std::complex<_Tp>(abs(__x.real()), __x.imag());
|
|
288
|
+
return std::complex<_Tp>(cosh(__x.real()) * cos(__x.imag()),
|
|
289
|
+
sinh(__x.real()) * sin(__x.imag()));
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
// tanh
|
|
293
|
+
|
|
294
|
+
template <class _Tp>
|
|
295
|
+
__DEVICE__ std::complex<_Tp> tanh(const std::complex<_Tp> &__x) {
|
|
296
|
+
if (std::isinf(__x.real())) {
|
|
297
|
+
if (!std::isfinite(__x.imag()))
|
|
298
|
+
return std::complex<_Tp>(_Tp(1), _Tp(0));
|
|
299
|
+
return std::complex<_Tp>(_Tp(1),
|
|
300
|
+
copysign(_Tp(0), sin(_Tp(2) * __x.imag())));
|
|
301
|
+
}
|
|
302
|
+
if (std::isnan(__x.real()) && __x.imag() == 0)
|
|
303
|
+
return __x;
|
|
304
|
+
_Tp __2r(_Tp(2) * __x.real());
|
|
305
|
+
_Tp __2i(_Tp(2) * __x.imag());
|
|
306
|
+
_Tp __d(cosh(__2r) + cos(__2i));
|
|
307
|
+
_Tp __2rsh(sinh(__2r));
|
|
308
|
+
if (std::isinf(__2rsh) && std::isinf(__d))
|
|
309
|
+
return std::complex<_Tp>(__2rsh > _Tp(0) ? _Tp(1) : _Tp(-1),
|
|
310
|
+
__2i > _Tp(0) ? _Tp(0) : _Tp(-0.));
|
|
311
|
+
return std::complex<_Tp>(__2rsh / __d, sin(__2i) / __d);
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
// asin
|
|
315
|
+
|
|
316
|
+
template <class _Tp>
|
|
317
|
+
__DEVICE__ std::complex<_Tp> asin(const std::complex<_Tp> &__x) {
|
|
318
|
+
std::complex<_Tp> __z = asinh(complex<_Tp>(-__x.imag(), __x.real()));
|
|
319
|
+
return std::complex<_Tp>(__z.imag(), -__z.real());
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
// acos
|
|
323
|
+
|
|
324
|
+
template <class _Tp>
|
|
325
|
+
__DEVICE__ std::complex<_Tp> acos(const std::complex<_Tp> &__x) {
|
|
326
|
+
const _Tp __pi(atan2(+0., -0.));
|
|
327
|
+
if (std::isinf(__x.real())) {
|
|
328
|
+
if (std::isnan(__x.imag()))
|
|
329
|
+
return std::complex<_Tp>(__x.imag(), __x.real());
|
|
330
|
+
if (std::isinf(__x.imag())) {
|
|
331
|
+
if (__x.real() < _Tp(0))
|
|
332
|
+
return std::complex<_Tp>(_Tp(0.75) * __pi, -__x.imag());
|
|
333
|
+
return std::complex<_Tp>(_Tp(0.25) * __pi, -__x.imag());
|
|
334
|
+
}
|
|
335
|
+
if (__x.real() < _Tp(0))
|
|
336
|
+
return std::complex<_Tp>(__pi,
|
|
337
|
+
signbit(__x.imag()) ? -__x.real() : __x.real());
|
|
338
|
+
return std::complex<_Tp>(_Tp(0),
|
|
339
|
+
signbit(__x.imag()) ? __x.real() : -__x.real());
|
|
340
|
+
}
|
|
341
|
+
if (std::isnan(__x.real())) {
|
|
342
|
+
if (std::isinf(__x.imag()))
|
|
343
|
+
return std::complex<_Tp>(__x.real(), -__x.imag());
|
|
344
|
+
return std::complex<_Tp>(__x.real(), __x.real());
|
|
345
|
+
}
|
|
346
|
+
if (std::isinf(__x.imag()))
|
|
347
|
+
return std::complex<_Tp>(__pi / _Tp(2), -__x.imag());
|
|
348
|
+
if (__x.real() == 0 && (__x.imag() == 0 || isnan(__x.imag())))
|
|
349
|
+
return std::complex<_Tp>(__pi / _Tp(2), -__x.imag());
|
|
350
|
+
std::complex<_Tp> __z = log(__x + sqrt(__sqr(__x) - _Tp(1)));
|
|
351
|
+
if (signbit(__x.imag()))
|
|
352
|
+
return std::complex<_Tp>(abs(__z.imag()), abs(__z.real()));
|
|
353
|
+
return std::complex<_Tp>(abs(__z.imag()), -abs(__z.real()));
|
|
354
|
+
}
|
|
355
|
+
|
|
356
|
+
// atan
|
|
357
|
+
|
|
358
|
+
template <class _Tp>
|
|
359
|
+
__DEVICE__ std::complex<_Tp> atan(const std::complex<_Tp> &__x) {
|
|
360
|
+
std::complex<_Tp> __z = atanh(complex<_Tp>(-__x.imag(), __x.real()));
|
|
361
|
+
return std::complex<_Tp>(__z.imag(), -__z.real());
|
|
362
|
+
}
|
|
363
|
+
|
|
364
|
+
// sin
|
|
365
|
+
|
|
366
|
+
template <class _Tp>
|
|
367
|
+
__DEVICE__ std::complex<_Tp> sin(const std::complex<_Tp> &__x) {
|
|
368
|
+
std::complex<_Tp> __z = sinh(complex<_Tp>(-__x.imag(), __x.real()));
|
|
369
|
+
return std::complex<_Tp>(__z.imag(), -__z.real());
|
|
370
|
+
}
|
|
371
|
+
|
|
372
|
+
// cos
|
|
373
|
+
|
|
374
|
+
template <class _Tp> std::complex<_Tp> cos(const std::complex<_Tp> &__x) {
|
|
375
|
+
return cosh(complex<_Tp>(-__x.imag(), __x.real()));
|
|
376
|
+
}
|
|
377
|
+
|
|
378
|
+
// tan
|
|
379
|
+
|
|
380
|
+
template <class _Tp>
|
|
381
|
+
__DEVICE__ std::complex<_Tp> tan(const std::complex<_Tp> &__x) {
|
|
382
|
+
std::complex<_Tp> __z = tanh(complex<_Tp>(-__x.imag(), __x.real()));
|
|
383
|
+
return std::complex<_Tp>(__z.imag(), -__z.real());
|
|
384
|
+
}
|
|
385
|
+
|
|
386
|
+
} // namespace std
|
|
387
|
+
|
|
388
|
+
#endif
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/*===---- openmp_wrapper/math.h -------- OpenMP math.h intercept ------ c++ -===
|
|
2
|
+
*
|
|
3
|
+
* Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
|
4
|
+
* See https://llvm.org/LICENSE.txt for license information.
|
|
5
|
+
* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
|
6
|
+
*
|
|
7
|
+
*===-----------------------------------------------------------------------===
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
// If we are in C++ mode and include <math.h> (not <cmath>) first, we still need
|
|
11
|
+
// to make sure <cmath> is read first. The problem otherwise is that we haven't
|
|
12
|
+
// seen the declarations of the math.h functions when the system math.h includes
|
|
13
|
+
// our cmath overlay. However, our cmath overlay, or better the underlying
|
|
14
|
+
// overlay, e.g. CUDA, uses the math.h functions. Since we haven't declared them
|
|
15
|
+
// yet we get errors. CUDA avoids this by eagerly declaring all math functions
|
|
16
|
+
// (in the __device__ space) but we cannot do this. Instead we break the
|
|
17
|
+
// dependence by forcing cmath to go first. While our cmath will in turn include
|
|
18
|
+
// this file, the cmath guards will prevent recursion.
|
|
19
|
+
#ifdef __cplusplus
|
|
20
|
+
#include <cmath>
|
|
21
|
+
#endif
|
|
22
|
+
|
|
23
|
+
#ifndef __CLANG_OPENMP_MATH_H__
|
|
24
|
+
#define __CLANG_OPENMP_MATH_H__
|
|
25
|
+
|
|
26
|
+
#ifndef _OPENMP
|
|
27
|
+
#error "This file is for OpenMP compilation only."
|
|
28
|
+
#endif
|
|
29
|
+
|
|
30
|
+
#include_next <math.h>
|
|
31
|
+
|
|
32
|
+
// We need limits.h for __clang_cuda_math.h below and because it should not hurt
|
|
33
|
+
// we include it eagerly here.
|
|
34
|
+
#include <limits.h>
|
|
35
|
+
|
|
36
|
+
// We need stdlib.h because (for now) __clang_cuda_math.h below declares `abs`
|
|
37
|
+
// which should live in stdlib.h.
|
|
38
|
+
#include <stdlib.h>
|
|
39
|
+
|
|
40
|
+
#pragma omp begin declare variant match( \
|
|
41
|
+
device = {arch(nvptx, nvptx64)}, implementation = {extension(match_any)})
|
|
42
|
+
|
|
43
|
+
#define __CUDA__
|
|
44
|
+
#define __OPENMP_NVPTX__
|
|
45
|
+
#include <__clang_cuda_math.h>
|
|
46
|
+
#undef __OPENMP_NVPTX__
|
|
47
|
+
#undef __CUDA__
|
|
48
|
+
|
|
49
|
+
#pragma omp end declare variant
|
|
50
|
+
|
|
51
|
+
#endif
|