diff --git a/libclc/clc/lib/amdgcn/SOURCES b/libclc/clc/lib/amdgcn/SOURCES index 76c3266e3af7b..74e01221004e1 100644 --- a/libclc/clc/lib/amdgcn/SOURCES +++ b/libclc/clc/lib/amdgcn/SOURCES @@ -1,4 +1,19 @@ +math/clc_cos.cl +math/clc_exp10.cl +math/clc_exp2.cl +math/clc_exp.cl +math/clc_fmax.cl +math/clc_fmin.cl math/clc_ldexp_override.cl +math/clc_lgamma.cl +math/clc_log10.cl +math/clc_log2.cl +math/clc_log.cl +math/clc_sin.cl +math/clc_sqrt.cl +math/clc_sqrt.cl +math/clc_sqrt_fp64.cl +math/clc_tan.cl mem_fence/clc_mem_fence.cl synchronization/clc_work_group_barrier.cl workitem/clc_get_global_offset.cl diff --git a/libclc/clc/lib/amdgcn/math/clc_cos.cl b/libclc/clc/lib/amdgcn/math/clc_cos.cl new file mode 100644 index 0000000000000..24c0d9a33b05a --- /dev/null +++ b/libclc/clc/lib/amdgcn/math/clc_cos.cl @@ -0,0 +1,29 @@ +//===----------------------------------------------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#include +#include + +float __ocml_cos_f32(float); +_CLC_OVERLOAD _CLC_DEF float __clc_cos(float x) { return __ocml_cos_f32(x); } + +#ifdef cl_khr_fp64 +#pragma OPENCL EXTENSION cl_khr_fp64 : enable +double __ocml_cos_f64(double); +_CLC_OVERLOAD _CLC_DEF double __clc_cos(double x) { return __ocml_cos_f64(x); } +#endif + +#ifdef cl_khr_fp16 +#pragma OPENCL EXTENSION cl_khr_fp16 : enable +half __ocml_cos_f16(half); +_CLC_OVERLOAD _CLC_DEF half __clc_cos(half x) { return __ocml_cos_f16(x); } +#endif + +#define FUNCTION __clc_cos +#define __CLC_BODY +#include diff --git a/libclc/clc/lib/amdgcn/math/clc_exp.cl b/libclc/clc/lib/amdgcn/math/clc_exp.cl new file mode 100644 index 0000000000000..aef9986b2dd7b --- /dev/null +++ b/libclc/clc/lib/amdgcn/math/clc_exp.cl @@ -0,0 +1,29 @@ +//===----------------------------------------------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#include +#include + +float __ocml_exp_f32(float); +_CLC_OVERLOAD _CLC_DEF float __clc_exp(float x) { return __ocml_exp_f32(x); } + +#ifdef cl_khr_fp64 +#pragma OPENCL EXTENSION cl_khr_fp64 : enable +double __ocml_exp_f64(double); +_CLC_OVERLOAD _CLC_DEF double __clc_exp(double x) { return __ocml_exp_f64(x); } +#endif + +#ifdef cl_khr_fp16 +#pragma OPENCL EXTENSION cl_khr_fp16 : enable +half __ocml_exp_f16(half); +_CLC_OVERLOAD _CLC_DEF half __clc_exp(half x) { return __ocml_exp_f16(x); } +#endif + +#define FUNCTION __clc_exp +#define __CLC_BODY +#include diff --git a/libclc/clc/lib/amdgcn/math/clc_exp10.cl b/libclc/clc/lib/amdgcn/math/clc_exp10.cl new file mode 100644 index 0000000000000..4d5ef17ee36f7 --- /dev/null +++ b/libclc/clc/lib/amdgcn/math/clc_exp10.cl @@ -0,0 +1,33 @@ +//===----------------------------------------------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#include +#include + +float __ocml_exp10_f32(float); +_CLC_OVERLOAD _CLC_DEF float __clc_exp10(float x) { + return __ocml_exp10_f32(x); +} + +#ifdef cl_khr_fp64 +#pragma OPENCL EXTENSION cl_khr_fp64 : enable +double __ocml_exp10_f64(double); +_CLC_OVERLOAD _CLC_DEF double __clc_exp10(double x) { + return __ocml_exp10_f64(x); +} +#endif + +#ifdef cl_khr_fp16 +#pragma OPENCL EXTENSION cl_khr_fp16 : enable +half __ocml_exp10_f16(half); +_CLC_OVERLOAD _CLC_DEF half __clc_exp10(half x) { return __ocml_exp10_f16(x); } +#endif + +#define FUNCTION __clc_exp10 +#define __CLC_BODY +#include diff --git a/libclc/clc/lib/amdgcn/math/clc_exp2.cl b/libclc/clc/lib/amdgcn/math/clc_exp2.cl new file mode 100644 index 0000000000000..32674c079e7c2 --- /dev/null +++ b/libclc/clc/lib/amdgcn/math/clc_exp2.cl @@ -0,0 +1,31 @@ +//===----------------------------------------------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#include +#include + +float __ocml_exp2_f32(float); +_CLC_OVERLOAD _CLC_DEF float __clc_exp2(float x) { return __ocml_exp2_f32(x); } + +#ifdef cl_khr_fp64 +#pragma OPENCL EXTENSION cl_khr_fp64 : enable +double __ocml_exp2_f64(double); +_CLC_OVERLOAD _CLC_DEF double __clc_exp2(double x) { + return __ocml_exp2_f64(x); +} +#endif + +#ifdef cl_khr_fp16 +#pragma OPENCL EXTENSION cl_khr_fp16 : enable +half __ocml_exp2_f16(half); +_CLC_OVERLOAD _CLC_DEF half __clc_exp2(half x) { return __ocml_exp2_f16(x); } +#endif + +#define FUNCTION __clc_exp2 +#define __CLC_BODY +#include diff --git a/libclc/clc/lib/amdgcn/math/clc_fmax.cl b/libclc/clc/lib/amdgcn/math/clc_fmax.cl new file mode 100644 index 0000000000000..6a3fb40ecd131 --- /dev/null +++ b/libclc/clc/lib/amdgcn/math/clc_fmax.cl @@ -0,0 +1,35 @@ +//===----------------------------------------------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#include +#include + +float __ocml_fmax_f32(float, float); +_CLC_OVERLOAD _CLC_DEF float __clc_fmax(float x, float y) { + return __ocml_fmax_f32(x, y); +} + +#ifdef cl_khr_fp64 +#pragma OPENCL EXTENSION cl_khr_fp64 : enable +double __ocml_fmax_f64(double, double); +_CLC_OVERLOAD _CLC_DEF double __clc_fmax(double x, double y) { + return __ocml_fmax_f64(x, y); +} +#endif + +#ifdef cl_khr_fp16 +#pragma OPENCL EXTENSION cl_khr_fp16 : enable +half __ocml_fmax_f16(half, half); +_CLC_OVERLOAD _CLC_DEF half __clc_fmax(half x, half y) { + return __ocml_fmax_f16(x, y); +} +#endif + +#define FUNCTION __clc_fmax +#define __CLC_BODY +#include diff --git a/libclc/clc/lib/amdgcn/math/clc_fmin.cl b/libclc/clc/lib/amdgcn/math/clc_fmin.cl new file mode 100644 index 0000000000000..bbec2b02a09d3 --- /dev/null +++ b/libclc/clc/lib/amdgcn/math/clc_fmin.cl @@ -0,0 +1,35 @@ +//===----------------------------------------------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#include +#include + +float __ocml_fmin_f32(float, float); +_CLC_OVERLOAD _CLC_DEF float __clc_fmin(float x, float y) { + return __ocml_fmin_f32(x, y); +} + +#ifdef cl_khr_fp64 +#pragma OPENCL EXTENSION cl_khr_fp64 : enable +double __ocml_fmin_f64(double, double); +_CLC_OVERLOAD _CLC_DEF double __clc_fmin(double x, double y) { + return __ocml_fmin_f64(x, y); +} +#endif + +#ifdef cl_khr_fp16 +#pragma OPENCL EXTENSION cl_khr_fp16 : enable +half __ocml_fmin_f16(half, half); +_CLC_OVERLOAD _CLC_DEF half __clc_fmin(half x, half y) { + return __ocml_fmin_f16(x, y); +} +#endif + +#define FUNCTION __clc_fmin +#define __CLC_BODY +#include diff --git a/libclc/clc/lib/amdgcn/math/clc_lgamma.cl b/libclc/clc/lib/amdgcn/math/clc_lgamma.cl new file mode 100644 index 0000000000000..7c8802107b4d6 --- /dev/null +++ b/libclc/clc/lib/amdgcn/math/clc_lgamma.cl @@ -0,0 +1,35 @@ +//===----------------------------------------------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#include +#include + +float __ocml_lgamma_f32(float); +_CLC_OVERLOAD _CLC_DEF float __clc_lgamma(float x) { + return __ocml_lgamma_f32(x); +} + +#ifdef cl_khr_fp64 +#pragma OPENCL EXTENSION cl_khr_fp64 : enable +double __ocml_lgamma_f64(double); +_CLC_OVERLOAD _CLC_DEF double __clc_lgamma(double x) { + return __ocml_lgamma_f64(x); +} +#endif + +#ifdef cl_khr_fp16 +#pragma OPENCL EXTENSION cl_khr_fp16 : enable +half __ocml_lgamma_f16(half); +_CLC_OVERLOAD _CLC_DEF half __clc_lgamma(half x) { + return __ocml_lgamma_f16(x); +} +#endif + +#define FUNCTION __clc_lgamma +#define __CLC_BODY +#include diff --git a/libclc/clc/lib/amdgcn/math/clc_log.cl b/libclc/clc/lib/amdgcn/math/clc_log.cl new file mode 100644 index 0000000000000..34b5a0e6db04d --- /dev/null +++ b/libclc/clc/lib/amdgcn/math/clc_log.cl @@ -0,0 +1,29 @@ +//===----------------------------------------------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#include +#include + +float __ocml_log_f32(float); +_CLC_OVERLOAD _CLC_DEF float __clc_log(float x) { return __ocml_log_f32(x); } + +#ifdef cl_khr_fp64 +#pragma OPENCL EXTENSION cl_khr_fp64 : enable +double __ocml_log_f64(double); +_CLC_OVERLOAD _CLC_DEF double __clc_log(double x) { return __ocml_log_f64(x); } +#endif + +#ifdef cl_khr_fp16 +#pragma OPENCL EXTENSION cl_khr_fp16 : enable +half __ocml_log_f16(half); +_CLC_OVERLOAD _CLC_DEF half __clc_log(half x) { return __ocml_log_f16(x); } +#endif + +#define FUNCTION __clc_log +#define __CLC_BODY +#include diff --git a/libclc/clc/lib/amdgcn/math/clc_log10.cl b/libclc/clc/lib/amdgcn/math/clc_log10.cl new file mode 100644 index 0000000000000..2c37e0fc2bf76 --- /dev/null +++ b/libclc/clc/lib/amdgcn/math/clc_log10.cl @@ -0,0 +1,33 @@ +//===----------------------------------------------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#include +#include + +float __ocml_log10_f32(float); +_CLC_OVERLOAD _CLC_DEF float __clc_log10(float x) { + return __ocml_log10_f32(x); +} + +#ifdef cl_khr_fp64 +#pragma OPENCL EXTENSION cl_khr_fp64 : enable +double __ocml_log10_f64(double); +_CLC_OVERLOAD _CLC_DEF double __clc_log10(double x) { + return __ocml_log10_f64(x); +} +#endif + +#ifdef cl_khr_fp16 +#pragma OPENCL EXTENSION cl_khr_fp16 : enable +half __ocml_log10_f16(half); +_CLC_OVERLOAD _CLC_DEF half __clc_log10(half x) { return __ocml_log10_f16(x); } +#endif + +#define FUNCTION __clc_log10 +#define __CLC_BODY +#include diff --git a/libclc/clc/lib/amdgcn/math/clc_log2.cl b/libclc/clc/lib/amdgcn/math/clc_log2.cl new file mode 100644 index 0000000000000..ab3cd68ae8e42 --- /dev/null +++ b/libclc/clc/lib/amdgcn/math/clc_log2.cl @@ -0,0 +1,31 @@ +//===----------------------------------------------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#include +#include + +float __ocml_log2_f32(float); +_CLC_OVERLOAD _CLC_DEF float __clc_log2(float x) { return __ocml_log2_f32(x); } + +#ifdef cl_khr_fp64 +#pragma OPENCL EXTENSION cl_khr_fp64 : enable +double __ocml_log2_f64(double); +_CLC_OVERLOAD _CLC_DEF double __clc_log2(double x) { + return __ocml_log2_f64(x); +} +#endif + +#ifdef cl_khr_fp16 +#pragma OPENCL EXTENSION cl_khr_fp16 : enable +half __ocml_log2_f16(half); +_CLC_OVERLOAD _CLC_DEF half __clc_log2(half x) { return __ocml_log2_f16(x); } +#endif + +#define FUNCTION __clc_log2 +#define __CLC_BODY +#include diff --git a/libclc/clc/lib/amdgcn/math/clc_sin.cl b/libclc/clc/lib/amdgcn/math/clc_sin.cl new file mode 100644 index 0000000000000..c45c891a735fc --- /dev/null +++ b/libclc/clc/lib/amdgcn/math/clc_sin.cl @@ -0,0 +1,29 @@ +//===----------------------------------------------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#include +#include + +float __ocml_sin_f32(float); +_CLC_OVERLOAD _CLC_DEF float __clc_sin(float x) { return __ocml_sin_f32(x); } + +#ifdef cl_khr_fp64 +#pragma OPENCL EXTENSION cl_khr_fp64 : enable +double __ocml_sin_f64(double); +_CLC_OVERLOAD _CLC_DEF double __clc_sin(double x) { return __ocml_sin_f64(x); } +#endif + +#ifdef cl_khr_fp16 +#pragma OPENCL EXTENSION cl_khr_fp16 : enable +half __ocml_sin_f16(half); +_CLC_OVERLOAD _CLC_DEF half __clc_sin(half x) { return __ocml_sin_f16(x); } +#endif + +#define FUNCTION __clc_sin +#define __CLC_BODY +#include diff --git a/libclc/clc/lib/amdgcn/math/clc_sqrt.cl b/libclc/clc/lib/amdgcn/math/clc_sqrt.cl new file mode 100644 index 0000000000000..af624fc0d3c34 --- /dev/null +++ b/libclc/clc/lib/amdgcn/math/clc_sqrt.cl @@ -0,0 +1,28 @@ +//===----------------------------------------------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#include +#include + +float __ocml_sqrt_f32(float); +_CLC_OVERLOAD _CLC_DEF float __clc_sqrt(float x) { return __ocml_sqrt_f32(x); } + +#define __FLOAT_ONLY +#define FUNCTION __clc_sqrt +#define __CLC_BODY +#include + +#ifdef cl_khr_fp16 +#pragma OPENCL EXTENSION cl_khr_fp16 : enable +half __ocml_sqrt_f16(half); +_CLC_OVERLOAD _CLC_DEF half __clc_sqrt(half x) { return __ocml_sqrt_f16(x); } +#endif + +#define __HALF_ONLY +#define __CLC_BODY +#include diff --git a/libclc/clc/lib/amdgcn/math/clc_sqrt_fp64.cl b/libclc/clc/lib/amdgcn/math/clc_sqrt_fp64.cl new file mode 100644 index 0000000000000..9ff88fd0f0797 --- /dev/null +++ b/libclc/clc/lib/amdgcn/math/clc_sqrt_fp64.cl @@ -0,0 +1,23 @@ +//===----------------------------------------------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#include +#include + +#ifdef cl_khr_fp64 +#pragma OPENCL EXTENSION cl_khr_fp64 : enable +double __ocml_sqrt_f64(double); +_CLC_OVERLOAD _CLC_DEF double __clc_sqrt(double x) { + return __ocml_sqrt_f64(x); +} +#endif + +#define __DOUBLE_ONLY +#define FUNCTION __clc_sqrt +#define __CLC_BODY +#include diff --git a/libclc/clc/lib/amdgcn/math/clc_tan.cl b/libclc/clc/lib/amdgcn/math/clc_tan.cl new file mode 100644 index 0000000000000..eef49f0d6d5e8 --- /dev/null +++ b/libclc/clc/lib/amdgcn/math/clc_tan.cl @@ -0,0 +1,29 @@ +//===----------------------------------------------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#include +#include + +float __ocml_tan_f32(float); +_CLC_OVERLOAD _CLC_DEF float __clc_tan(float x) { return __ocml_tan_f32(x); } + +#ifdef cl_khr_fp64 +#pragma OPENCL EXTENSION cl_khr_fp64 : enable +double __ocml_tan_f64(double); +_CLC_OVERLOAD _CLC_DEF double __clc_tan(double x) { return __ocml_tan_f64(x); } +#endif + +#ifdef cl_khr_fp16 +#pragma OPENCL EXTENSION cl_khr_fp16 : enable +half __ocml_tan_f16(half); +_CLC_OVERLOAD _CLC_DEF half __clc_tan(half x) { return __ocml_tan_f16(x); } +#endif + +#define FUNCTION __clc_tan +#define __CLC_BODY +#include