diff options
author | rander <rander.wang@intel.com> | 2017-03-07 16:19:52 +0800 |
---|---|---|
committer | Yang Rong <rong.r.yang@intel.com> | 2017-04-17 16:08:47 +0800 |
commit | a5519ff782bc4145c468f07ded6e4784e0422d4d (patch) | |
tree | 793039150f624ec6f6879a2bf21aa0d8afcca0ae /backend | |
parent | fe91d2d4ec8ad7587007f864774f40a227465585 (diff) |
Backend:add double support to max min min step
Signed-off-by: rander <rander.wang@intel.com>
Tested-by: Yang Rong <rong.r.yang@intel.com>
Diffstat (limited to 'backend')
-rw-r--r-- | backend/src/libocl/tmpl/ocl_common.tmpl.cl | 24 | ||||
-rw-r--r-- | backend/src/libocl/tmpl/ocl_common.tmpl.h | 11 |
2 files changed, 35 insertions, 0 deletions
diff --git a/backend/src/libocl/tmpl/ocl_common.tmpl.cl b/backend/src/libocl/tmpl/ocl_common.tmpl.cl index 0b6a8fb6..af516dec 100644 --- a/backend/src/libocl/tmpl/ocl_common.tmpl.cl +++ b/backend/src/libocl/tmpl/ocl_common.tmpl.cl @@ -26,6 +26,9 @@ PURE CONST OVERLOADABLE float __gen_ocl_fmax(float a, float b); PURE CONST OVERLOADABLE float __gen_ocl_fmin(float a, float b); PURE CONST OVERLOADABLE float __gen_ocl_lrp(float a, float b, float c); +PURE CONST OVERLOADABLE double __gen_ocl_fmax(double a, double b); +PURE CONST OVERLOADABLE double __gen_ocl_fmin(double a, double b); + OVERLOADABLE float step(float edge, float x) { return x < edge ? 0.0 : 1.0; } @@ -118,3 +121,24 @@ OVERLOADABLE half sign(half x) { s = (x == (half)0.0) ? s : r; return isnan(x) ? 0.0 : s; } + +OVERLOADABLE double step(double edge, double x) +{ + return x < edge ? 0.0 : 1.0; +} + +OVERLOADABLE double max(double a, double b) +{ + return __gen_ocl_fmax(a, b); +} + +OVERLOADABLE double min(double a, double b) +{ + return __gen_ocl_fmin(a, b); +} + +OVERLOADABLE double mix(double x, double y, double a) +{ + return x + (y-x)*a; +} + diff --git a/backend/src/libocl/tmpl/ocl_common.tmpl.h b/backend/src/libocl/tmpl/ocl_common.tmpl.h index 8e9cec09..5ea0b40f 100644 --- a/backend/src/libocl/tmpl/ocl_common.tmpl.h +++ b/backend/src/libocl/tmpl/ocl_common.tmpl.h @@ -47,3 +47,14 @@ OVERLOADABLE half radians(half degrees); OVERLOADABLE half smoothstep(half e0, half e1, half x); OVERLOADABLE half sign(half x); + +OVERLOADABLE double step(double edge, double x); +OVERLOADABLE double max(double a, double b); +OVERLOADABLE double min(double a, double b); +OVERLOADABLE double mix(double x, double y, double a); +OVERLOADABLE double clamp(double v, double l, double u); +OVERLOADABLE double degrees(double radians); +OVERLOADABLE double radians(double degrees); +OVERLOADABLE double smoothstep(double e0, double e1, double x); +OVERLOADABLE double sign(double x); + |