diff --git a/libclc/clc/lib/nvptx/CMakeLists.txt b/libclc/clc/lib/nvptx/CMakeLists.txt index 2345d5aeed77b..58b7387853c27 100644 --- a/libclc/clc/lib/nvptx/CMakeLists.txt +++ b/libclc/clc/lib/nvptx/CMakeLists.txt @@ -3,7 +3,6 @@ libclc_add_sources(${LIBCLC_CLC_TARGET} FILES math/clc_rsqrt.cl math/clc_sinpi.cl math/clc_sqrt.cl - relational/clc_isinf.cl synchronization/clc_work_group_barrier.cl workitem/clc_get_global_id.cl workitem/clc_get_global_size.cl diff --git a/libclc/clc/lib/nvptx/relational/clc_isinf.cl b/libclc/clc/lib/nvptx/relational/clc_isinf.cl deleted file mode 100644 index 3b0055e995aaf..0000000000000 --- a/libclc/clc/lib/nvptx/relational/clc_isinf.cl +++ /dev/null @@ -1,33 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 "clc/relational/clc_isinf.h" - -int __nv_isinff(float); -int __nv_isinfd(double); - -_CLC_OVERLOAD _CLC_DEF int __clc_isinf(float x) { return __nv_isinff(x); } - -#ifdef cl_khr_fp64 -#pragma OPENCL EXTENSION cl_khr_fp64 : enable - -_CLC_OVERLOAD _CLC_DEF int __clc_isinf(double x) { return __nv_isinfd(x); } - -#endif - -#ifdef cl_khr_fp16 -#pragma OPENCL EXTENSION cl_khr_fp16 : enable - -_CLC_OVERLOAD _CLC_DEF int __clc_isinf(half x) { return __clc_isinf((float)x); } - -#endif - -#define __CLC_FUNCTION __clc_isinf -#define __CLC_BODY "clc/shared/unary_def_scalarize.inc" -#define __CLC_RET_TYPE __CLC_BIT_INT -#include "clc/math/gentype.inc" diff --git a/libclc/libspirv/include/libspirv/relational.h b/libclc/libspirv/include/libspirv/relational.h deleted file mode 100644 index ea46e670fa3a0..0000000000000 --- a/libclc/libspirv/include/libspirv/relational.h +++ /dev/null @@ -1,158 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -#ifndef CLC_RELATIONAL -#define CLC_RELATIONAL - -#include - -/* - * Contains relational macros that have to return 1 for scalar and -1 for vector - * when the result is true. - */ - -#define _CLC_DEFINE_RELATIONAL_UNARY_SCALAR(RET_TYPE, FUNCTION, BUILTIN_NAME, \ - ARG_TYPE) \ - _CLC_DEF _CLC_OVERLOAD RET_TYPE FUNCTION(ARG_TYPE x) { \ - return BUILTIN_NAME(x); \ - } - -#define _CLC_DEFINE_RELATIONAL_UNARY_VEC2(RET_TYPE, FUNCTION, ARG_TYPE) \ - _CLC_DEF _CLC_OVERLOAD RET_TYPE FUNCTION(ARG_TYPE x) { \ - return __clc_as_##RET_TYPE( \ - ((RET_TYPE){FUNCTION(x.lo), FUNCTION(x.hi)} != (RET_TYPE)0)); \ - } - -#define _CLC_DEFINE_RELATIONAL_UNARY_VEC3(RET_TYPE, FUNCTION, ARG_TYPE) \ - _CLC_DEF _CLC_OVERLOAD RET_TYPE FUNCTION(ARG_TYPE x) { \ - return __clc_as_##RET_TYPE(((RET_TYPE){FUNCTION(x.s0), FUNCTION(x.s1), \ - FUNCTION(x.s2)} != (RET_TYPE)0)); \ - } - -#define _CLC_DEFINE_RELATIONAL_UNARY_VEC4(RET_TYPE, FUNCTION, ARG_TYPE) \ - _CLC_DEF _CLC_OVERLOAD RET_TYPE FUNCTION(ARG_TYPE x) { \ - return __clc_as_##RET_TYPE( \ - ((RET_TYPE){FUNCTION(x.s0), FUNCTION(x.s1), FUNCTION(x.s2), \ - FUNCTION(x.s3)} != (RET_TYPE)0)); \ - } - -#define _CLC_DEFINE_RELATIONAL_UNARY_VEC8(RET_TYPE, FUNCTION, ARG_TYPE) \ - _CLC_DEF _CLC_OVERLOAD RET_TYPE FUNCTION(ARG_TYPE x) { \ - return __clc_as_##RET_TYPE( \ - ((RET_TYPE){FUNCTION(x.s0), FUNCTION(x.s1), FUNCTION(x.s2), \ - FUNCTION(x.s3), FUNCTION(x.s4), FUNCTION(x.s5), \ - FUNCTION(x.s6), FUNCTION(x.s7)} != (RET_TYPE)0)); \ - } - -#define _CLC_DEFINE_RELATIONAL_UNARY_VEC16(RET_TYPE, FUNCTION, ARG_TYPE) \ - _CLC_DEF _CLC_OVERLOAD RET_TYPE FUNCTION(ARG_TYPE x) { \ - return __clc_as_##RET_TYPE( \ - ((RET_TYPE){FUNCTION(x.s0), FUNCTION(x.s1), FUNCTION(x.s2), \ - FUNCTION(x.s3), FUNCTION(x.s4), FUNCTION(x.s5), \ - FUNCTION(x.s6), FUNCTION(x.s7), FUNCTION(x.s8), \ - FUNCTION(x.s9), FUNCTION(x.sa), FUNCTION(x.sb), \ - FUNCTION(x.sc), FUNCTION(x.sd), FUNCTION(x.se), \ - FUNCTION(x.sf)} != (RET_TYPE)0)); \ - } - -#define _CLC_DEFINE_RELATIONAL_UNARY_VEC_ALL(RET_TYPE, FUNCTION, ARG_TYPE) \ - _CLC_DEFINE_RELATIONAL_UNARY_VEC2(RET_TYPE##2, FUNCTION, ARG_TYPE##2) \ - _CLC_DEFINE_RELATIONAL_UNARY_VEC3(RET_TYPE##3, FUNCTION, ARG_TYPE##3) \ - _CLC_DEFINE_RELATIONAL_UNARY_VEC4(RET_TYPE##4, FUNCTION, ARG_TYPE##4) \ - _CLC_DEFINE_RELATIONAL_UNARY_VEC8(RET_TYPE##8, FUNCTION, ARG_TYPE##8) \ - _CLC_DEFINE_RELATIONAL_UNARY_VEC16(RET_TYPE##16, FUNCTION, ARG_TYPE##16) - -#define _CLC_DEFINE_RELATIONAL_UNARY(RET_TYPE, FUNCTION, BUILTIN_FUNCTION, \ - ARG_TYPE) \ - _CLC_DEFINE_RELATIONAL_UNARY_SCALAR(RET_TYPE, FUNCTION, BUILTIN_FUNCTION, \ - ARG_TYPE) \ - _CLC_DEFINE_RELATIONAL_UNARY_VEC_ALL(RET_TYPE, FUNCTION, ARG_TYPE) - -#define _CLC_DEFINE_RELATIONAL_BINARY_SCALAR(RET_TYPE, FUNCTION, BUILTIN_NAME, \ - ARG0_TYPE, ARG1_TYPE) \ - _CLC_DEF _CLC_OVERLOAD RET_TYPE FUNCTION(ARG0_TYPE x, ARG1_TYPE y) { \ - return BUILTIN_NAME(x, y); \ - } - -#define _CLC_DEFINE_RELATIONAL_BINARY_VEC(RET_TYPE, FUNCTION, ARG0_TYPE, \ - ARG1_TYPE) \ - _CLC_DEF _CLC_OVERLOAD RET_TYPE FUNCTION(ARG0_TYPE x, ARG1_TYPE y) { \ - return __clc_as_##RET_TYPE( \ - (RET_TYPE)((RET_TYPE){FUNCTION(x.lo, y.lo), FUNCTION(x.hi, y.hi)} != \ - (RET_TYPE)0)); \ - } - -#define _CLC_DEFINE_RELATIONAL_BINARY_VEC2(RET_TYPE, FUNCTION, ARG0_TYPE, \ - ARG1_TYPE) \ - _CLC_DEF _CLC_OVERLOAD RET_TYPE FUNCTION(ARG0_TYPE x, ARG1_TYPE y) { \ - return __clc_as_##RET_TYPE( \ - ((RET_TYPE){FUNCTION(x.lo, y.lo), FUNCTION(x.hi, y.hi)} != \ - (RET_TYPE)0)); \ - } - -#define _CLC_DEFINE_RELATIONAL_BINARY_VEC3(RET_TYPE, FUNCTION, ARG0_TYPE, \ - ARG1_TYPE) \ - _CLC_DEF _CLC_OVERLOAD RET_TYPE FUNCTION(ARG0_TYPE x, ARG1_TYPE y) { \ - return __clc_as_##RET_TYPE( \ - ((RET_TYPE){FUNCTION(x.s0, y.s0), FUNCTION(x.s1, y.s1), \ - FUNCTION(x.s2, y.s2)} != (RET_TYPE)0)); \ - } - -#define _CLC_DEFINE_RELATIONAL_BINARY_VEC4(RET_TYPE, FUNCTION, ARG0_TYPE, \ - ARG1_TYPE) \ - _CLC_DEF _CLC_OVERLOAD RET_TYPE FUNCTION(ARG0_TYPE x, ARG1_TYPE y) { \ - return __clc_as_##RET_TYPE( \ - ((RET_TYPE){FUNCTION(x.s0, y.s0), FUNCTION(x.s1, y.s1), \ - FUNCTION(x.s2, y.s2), \ - FUNCTION(x.s3, y.s3)} != (RET_TYPE)0)); \ - } - -#define _CLC_DEFINE_RELATIONAL_BINARY_VEC8(RET_TYPE, FUNCTION, ARG0_TYPE, \ - ARG1_TYPE) \ - _CLC_DEF _CLC_OVERLOAD RET_TYPE FUNCTION(ARG0_TYPE x, ARG1_TYPE y) { \ - return __clc_as_##RET_TYPE( \ - ((RET_TYPE){ \ - FUNCTION(x.s0, y.s0), FUNCTION(x.s1, y.s1), FUNCTION(x.s2, y.s2), \ - FUNCTION(x.s3, y.s3), FUNCTION(x.s4, y.s4), FUNCTION(x.s5, y.s5), \ - FUNCTION(x.s6, y.s6), FUNCTION(x.s7, y.s7)} != (RET_TYPE)0)); \ - } - -#define _CLC_DEFINE_RELATIONAL_BINARY_VEC16(RET_TYPE, FUNCTION, ARG0_TYPE, \ - ARG1_TYPE) \ - _CLC_DEF _CLC_OVERLOAD RET_TYPE FUNCTION(ARG0_TYPE x, ARG1_TYPE y) { \ - return __clc_as_##RET_TYPE( \ - ((RET_TYPE){ \ - FUNCTION(x.s0, y.s0), FUNCTION(x.s1, y.s1), FUNCTION(x.s2, y.s2), \ - FUNCTION(x.s3, y.s3), FUNCTION(x.s4, y.s4), FUNCTION(x.s5, y.s5), \ - FUNCTION(x.s6, y.s6), FUNCTION(x.s7, y.s7), FUNCTION(x.s8, y.s8), \ - FUNCTION(x.s9, y.s9), FUNCTION(x.sa, y.sa), FUNCTION(x.sb, y.sb), \ - FUNCTION(x.sc, y.sc), FUNCTION(x.sd, y.sd), FUNCTION(x.se, y.se), \ - FUNCTION(x.sf, y.sf)} != (RET_TYPE)0)); \ - } - -#define _CLC_DEFINE_RELATIONAL_BINARY_VEC_ALL(RET_TYPE, FUNCTION, ARG0_TYPE, \ - ARG1_TYPE) \ - _CLC_DEFINE_RELATIONAL_BINARY_VEC2(RET_TYPE##2, FUNCTION, ARG0_TYPE##2, \ - ARG1_TYPE##2) \ - _CLC_DEFINE_RELATIONAL_BINARY_VEC3(RET_TYPE##3, FUNCTION, ARG0_TYPE##3, \ - ARG1_TYPE##3) \ - _CLC_DEFINE_RELATIONAL_BINARY_VEC4(RET_TYPE##4, FUNCTION, ARG0_TYPE##4, \ - ARG1_TYPE##4) \ - _CLC_DEFINE_RELATIONAL_BINARY_VEC8(RET_TYPE##8, FUNCTION, ARG0_TYPE##8, \ - ARG1_TYPE##8) \ - _CLC_DEFINE_RELATIONAL_BINARY_VEC16(RET_TYPE##16, FUNCTION, ARG0_TYPE##16, \ - ARG1_TYPE##16) - -#define _CLC_DEFINE_RELATIONAL_BINARY(RET_TYPE, FUNCTION, BUILTIN_FUNCTION, \ - ARG0_TYPE, ARG1_TYPE) \ - _CLC_DEFINE_RELATIONAL_BINARY_SCALAR(RET_TYPE, FUNCTION, BUILTIN_FUNCTION, \ - ARG0_TYPE, ARG1_TYPE) \ - _CLC_DEFINE_RELATIONAL_BINARY_VEC_ALL(RET_TYPE, FUNCTION, ARG0_TYPE, \ - ARG1_TYPE) - -#endif // CLC_RELATIONAL diff --git a/libclc/libspirv/lib/nvptx/CMakeLists.txt b/libclc/libspirv/lib/nvptx/CMakeLists.txt index ed751a075dd83..486a2634c0769 100644 --- a/libclc/libspirv/lib/nvptx/CMakeLists.txt +++ b/libclc/libspirv/lib/nvptx/CMakeLists.txt @@ -63,9 +63,6 @@ libclc_add_sources(${LIBCLC_LIBSPIRV_TARGET} FILES math/tan.cl math/tanh.cl math/tgamma.cl - relational/isfinite.cl - relational/isinf.cl - relational/isnan.cl synchronization/barrier.cl synchronization/aw_barrier.cl async/async_work_group_strided_copy.cl diff --git a/libclc/libspirv/lib/nvptx/relational/isfinite.cl b/libclc/libspirv/lib/nvptx/relational/isfinite.cl deleted file mode 100644 index 05fbd70e6195c..0000000000000 --- a/libclc/libspirv/lib/nvptx/relational/isfinite.cl +++ /dev/null @@ -1,42 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -#include - -#ifdef cl_khr_fp64 - -#pragma OPENCL EXTENSION cl_khr_fp64 : enable - -_CLC_DEF _CLC_OVERLOAD bool __spirv_IsFinite(double x) { - return __nv_isfinited(x); -} - -_CLC_DEFINE_RELATIONAL_UNARY_VEC_ALL(char, __spirv_IsFinite, double) - -#endif - -_CLC_DEF _CLC_OVERLOAD bool __spirv_IsFinite(float x) { - return __nv_isfinited(x); -} - -_CLC_DEFINE_RELATIONAL_UNARY_VEC_ALL(char, __spirv_IsFinite, float) - -#ifdef cl_khr_fp16 - -#pragma OPENCL EXTENSION cl_khr_fp16 : enable - -_CLC_DEF _CLC_OVERLOAD bool __spirv_IsFinite(half x) { - return __nv_isfinited(x); -} - -_CLC_DEFINE_RELATIONAL_UNARY_VEC_ALL(char, __spirv_IsFinite, half) - -#endif diff --git a/libclc/libspirv/lib/nvptx/relational/isinf.cl b/libclc/libspirv/lib/nvptx/relational/isinf.cl deleted file mode 100644 index a0d6dfd89aebe..0000000000000 --- a/libclc/libspirv/lib/nvptx/relational/isinf.cl +++ /dev/null @@ -1,37 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -#include - -_CLC_DEF _CLC_OVERLOAD bool __spirv_IsInf(float x) { return __nv_isinff(x); } - -_CLC_DEFINE_RELATIONAL_UNARY_VEC_ALL(char, __spirv_IsInf, float) - -#ifdef cl_khr_fp64 - -#pragma OPENCL EXTENSION cl_khr_fp64 : enable - -_CLC_DEF _CLC_OVERLOAD bool __spirv_IsInf(double x) { return __nv_isinfd(x); } - -_CLC_DEFINE_RELATIONAL_UNARY_VEC_ALL(char, __spirv_IsInf, double) -#endif - -#ifdef cl_khr_fp16 - -#pragma OPENCL EXTENSION cl_khr_fp16 : enable - -_CLC_DEF _CLC_OVERLOAD bool __spirv_IsInf(half x) { - float f = x; - return __spirv_IsInf(f); -} - -_CLC_DEFINE_RELATIONAL_UNARY_VEC_ALL(char, __spirv_IsInf, half) -#endif diff --git a/libclc/libspirv/lib/nvptx/relational/isnan.cl b/libclc/libspirv/lib/nvptx/relational/isnan.cl deleted file mode 100644 index 1a391fbfdcf2e..0000000000000 --- a/libclc/libspirv/lib/nvptx/relational/isnan.cl +++ /dev/null @@ -1,37 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -#include - -_CLC_DEF _CLC_OVERLOAD bool __spirv_IsNan(float x) { return __nv_isnanf(x); } - -_CLC_DEFINE_RELATIONAL_UNARY_VEC_ALL(char, __spirv_IsNan, float) - -#ifdef cl_khr_fp64 - -#pragma OPENCL EXTENSION cl_khr_fp64 : enable - -_CLC_DEF _CLC_OVERLOAD bool __spirv_IsNan(double x) { return __nv_isnand(x); } - -_CLC_DEFINE_RELATIONAL_UNARY_VEC_ALL(char, __spirv_IsNan, double) -#endif - -#ifdef cl_khr_fp16 - -#pragma OPENCL EXTENSION cl_khr_fp16 : enable - -_CLC_DEF _CLC_OVERLOAD bool __spirv_IsNan(half x) { - float f = x; - return __spirv_IsNan(f); -} - -_CLC_DEFINE_RELATIONAL_UNARY_VEC_ALL(char, __spirv_IsNan, half) -#endif