-
Notifications
You must be signed in to change notification settings - Fork 755
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'frasercrmck/cherry-pick-libclc' into HEAD
Closes: #16249
- Loading branch information
Showing
28 changed files
with
112 additions
and
136 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
#ifndef __CLC_INTEGER_CLC_ABS_H__ | ||
#define __CLC_INTEGER_CLC_ABS_H__ | ||
|
||
#if defined(CLC_CLSPV) || defined(CLC_SPIRV) | ||
// clspv and spir-v targets provide their own OpenCL-compatible abs | ||
#define __clc_abs abs | ||
#else | ||
|
||
#define __CLC_BODY <clc/integer/clc_abs.inc> | ||
#include <clc/integer/gentype.inc> | ||
|
||
#endif | ||
|
||
#endif // __CLC_INTEGER_CLC_ABS_H__ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
_CLC_OVERLOAD _CLC_DECL __CLC_U_GENTYPE __clc_abs(__CLC_GENTYPE x); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
#ifndef __CLC_INTEGER_CLC_ABS_DIFF_H__ | ||
#define __CLC_INTEGER_CLC_ABS_DIFF_H__ | ||
|
||
#if defined(CLC_CLSPV) || defined(CLC_SPIRV) | ||
// clspv and spir-v targets provide their own OpenCL-compatible abs_diff | ||
#define __clc_abs_diff abs_diff | ||
#else | ||
|
||
#define __CLC_BODY <clc/integer/clc_abs_diff.inc> | ||
#include <clc/integer/gentype.inc> | ||
|
||
#endif | ||
|
||
#endif // __CLC_INTEGER_CLC_ABS_DIFF_H__ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
_CLC_OVERLOAD _CLC_DECL __CLC_U_GENTYPE __clc_abs_diff(__CLC_GENTYPE x, | ||
__CLC_GENTYPE y); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,24 @@ | ||
geometric/clc_dot.cl | ||
integer/clc_abs.cl | ||
integer/clc_abs_diff.cl | ||
relational/clc_all.cl | ||
relational/clc_any.cl | ||
relational/clc_bitselect.cl | ||
relational/clc_isequal.cl | ||
relational/clc_isfinite.cl | ||
relational/clc_isgreater.cl | ||
relational/clc_isgreaterequal.cl | ||
relational/clc_isinf.cl | ||
relational/clc_isless.cl | ||
relational/clc_islessequal.cl | ||
relational/clc_islessgreater.cl | ||
relational/clc_isnan.cl | ||
relational/clc_isnormal.cl | ||
relational/clc_isnotequal.cl | ||
relational/clc_isordered.cl | ||
relational/clc_isunordered.cl | ||
relational/clc_select.cl | ||
relational/clc_signbit.cl | ||
shared/clc_clamp.cl | ||
shared/clc_max.cl | ||
shared/clc_min.cl |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
#include <clc/internal/clc.h> | ||
|
||
#define __CLC_BODY <clc_abs.inc> | ||
#include <clc/integer/gentype.inc> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
_CLC_OVERLOAD _CLC_DEF __CLC_U_GENTYPE __clc_abs(__CLC_GENTYPE x) { | ||
return __builtin_astype((__CLC_GENTYPE)(x > (__CLC_GENTYPE)(0) ? x : -x), | ||
__CLC_U_GENTYPE); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
#include <clc/internal/clc.h> | ||
|
||
#define __CLC_BODY <clc_abs_diff.inc> | ||
#include <clc/integer/gentype.inc> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
_CLC_OVERLOAD _CLC_DEF __CLC_U_GENTYPE __clc_abs_diff(__CLC_GENTYPE x, | ||
__CLC_GENTYPE y) { | ||
__CLC_U_GENTYPE ux = __builtin_astype(x, __CLC_U_GENTYPE); | ||
__CLC_U_GENTYPE uy = __builtin_astype(y, __CLC_U_GENTYPE); | ||
return x > y ? ux - uy : uy - ux; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,5 @@ | ||
#include <clc/clc.h> | ||
#include <core/clc_core.h> | ||
#include <spirv/spirv.h> | ||
#include <clc/integer/clc_abs.h> | ||
|
||
#define __CLC_BODY <abs.inc> | ||
#include <clc/integer/gentype.inc> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
_CLC_OVERLOAD _CLC_DEF __CLC_U_GENTYPE abs(__CLC_GENTYPE x) { | ||
return __builtin_astype((__CLC_GENTYPE)(x > (__CLC_GENTYPE)(0) ? x : -x), __CLC_U_GENTYPE); | ||
return __clc_abs(x); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,5 @@ | ||
#include <clc/clc.h> | ||
#include <core/clc_core.h> | ||
#include <spirv/spirv.h> | ||
#include <clc/integer/clc_abs_diff.h> | ||
|
||
#define __CLC_BODY <abs_diff.inc> | ||
#include <clc/integer/gentype.inc> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,3 @@ | ||
_CLC_OVERLOAD _CLC_DEF __CLC_U_GENTYPE abs_diff(__CLC_GENTYPE x, __CLC_GENTYPE y) { | ||
__CLC_U_GENTYPE ux = __builtin_astype(x, __CLC_U_GENTYPE); | ||
__CLC_U_GENTYPE uy = __builtin_astype(y, __CLC_U_GENTYPE); | ||
return x > y ? ux - uy : uy - ux; | ||
return __clc_abs_diff(x, y); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,7 @@ | ||
#include <clc/clc.h> | ||
#include <spirv/spirv.h> | ||
#include "relational.h" | ||
#include <clc/relational/clc_isinf.h> | ||
|
||
_CLC_DEFINE_RELATIONAL_UNARY(int, isinf, __spirv_IsInf, float) | ||
#define FUNCTION isinf | ||
#define __CLC_BODY "unary_def.inc" | ||
|
||
#ifdef cl_khr_fp64 | ||
|
||
#pragma OPENCL EXTENSION cl_khr_fp64 : enable | ||
|
||
// The scalar version of isinf(double) returns an int, but the vector versions | ||
// return long. | ||
_CLC_DEF _CLC_OVERLOAD int isinf(double x) { | ||
return __spirv_IsInf(x); | ||
} | ||
|
||
_CLC_DEFINE_RELATIONAL_UNARY_VEC_ALL(long, isinf, double) | ||
#endif | ||
|
||
#ifdef cl_khr_fp16 | ||
|
||
#pragma OPENCL EXTENSION cl_khr_fp16 : enable | ||
|
||
// The scalar version of isinf(half) returns an int, but the vector versions | ||
// return short. | ||
_CLC_DEF _CLC_OVERLOAD int isinf(half x) { | ||
return __spirv_IsInf(x); | ||
} | ||
|
||
_CLC_DEFINE_RELATIONAL_UNARY_VEC_ALL(short, isinf, half) | ||
#endif | ||
#include <clc/relational/floatn.inc> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,7 @@ | ||
#include <clc/clc.h> | ||
#include <spirv/spirv.h> | ||
#include "relational.h" | ||
#include <clc/relational/clc_isnan.h> | ||
|
||
_CLC_DEFINE_RELATIONAL_UNARY(int, isnan, __spirv_IsNan, float) | ||
#define FUNCTION isnan | ||
#define __CLC_BODY "unary_def.inc" | ||
|
||
#ifdef cl_khr_fp64 | ||
|
||
#pragma OPENCL EXTENSION cl_khr_fp64 : enable | ||
|
||
// The scalar version of isnan(double) returns an int, but the vector versions | ||
// return long. | ||
_CLC_DEF _CLC_OVERLOAD int isnan(double x) { | ||
return __spirv_IsNan(x); | ||
} | ||
|
||
_CLC_DEFINE_RELATIONAL_UNARY_VEC_ALL(long, isnan, double) | ||
|
||
#endif | ||
|
||
#ifdef cl_khr_fp16 | ||
|
||
#pragma OPENCL EXTENSION cl_khr_fp16 : enable | ||
|
||
// The scalar version of isnan(half) returns an int, but the vector versions | ||
// return short. | ||
_CLC_DEF _CLC_OVERLOAD int isnan(half x) { | ||
return __spirv_IsNan(x); | ||
} | ||
|
||
_CLC_DEFINE_RELATIONAL_UNARY_VEC_ALL(short, isnan, half) | ||
|
||
#endif | ||
#include <clc/relational/floatn.inc> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.