diff options
author | Georgios Pinitas <georgios.pinitas@arm.com> | 2017-08-31 14:21:36 +0100 |
---|---|---|
committer | Anthony Barbier <anthony.barbier@arm.com> | 2018-11-02 16:35:24 +0000 |
commit | cdf51455df8835e9e3bfd3e31ed389146af9a573 (patch) | |
tree | 31b0bf9302decbf8b1063f46373e3d26a9ca1409 /src/core/CL/cl_kernels/fixed_point.h | |
parent | 29088d517a2a9f249fe5cc851e0c97de3d4cc917 (diff) | |
download | ComputeLibrary-cdf51455df8835e9e3bfd3e31ed389146af9a573.tar.gz |
COMPMID-515: L2 Pooling for FP32/FP16 in CL.
Change-Id: I43641fa672f5905ca62edd1f63fc93e0cf7ea382
Reviewed-on: http://mpd-gerrit.cambridge.arm.com/85963
Tested-by: Kaizen <jeremy.johnson+kaizengerrit@arm.com>
Reviewed-by: Gian Marco Iodice <gianmarco.iodice@arm.com>
Diffstat (limited to 'src/core/CL/cl_kernels/fixed_point.h')
-rw-r--r-- | src/core/CL/cl_kernels/fixed_point.h | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/src/core/CL/cl_kernels/fixed_point.h b/src/core/CL/cl_kernels/fixed_point.h index 478a414cad..5476a6e070 100644 --- a/src/core/CL/cl_kernels/fixed_point.h +++ b/src/core/CL/cl_kernels/fixed_point.h @@ -241,9 +241,17 @@ MULQ_IMPL(qs16x16, qs32x16) return CONVERT_SAT((res >> (itype)fixed_point_position), type); \ } +MULQ_SAT_IMPL(qs8x1, qs16x1) +MULQ_SAT_IMPL(qs8x2, qs16x2) +MULQ_SAT_IMPL(qs8x3, qs16x3) +MULQ_SAT_IMPL(qs8x4, qs16x4) MULQ_SAT_IMPL(qs8x8, qs16x8) -MULQ_SAT_IMPL(qs16x8, qs32x8) MULQ_SAT_IMPL(qs8x16, qs16x16) +MULQ_SAT_IMPL(qs16x1, qs32x1) +MULQ_SAT_IMPL(qs16x2, qs32x2) +MULQ_SAT_IMPL(qs16x3, qs32x3) +MULQ_SAT_IMPL(qs16x4, qs32x4) +MULQ_SAT_IMPL(qs16x8, qs32x8) MULQ_SAT_IMPL(qs16x16, qs32x16) #define MUL_SAT_OP_EXPAND_STR(a, b, type, size, position) mul_sat_##type##x##size((a), (b), (position)) @@ -411,7 +419,7 @@ LOGQ_IMPL(qs16, qs16x16, 16) { \ type const_three = (type)(3 << (fixed_point_position)); \ type shift_value = (type)(16 - stype##_SHIFT) - (clz(VopA) + (type)fixed_point_position); \ - type temp = select(VopA >> shift_value, select((type)stype##_MAX, VopA << (-shift_value), clz(VopA) > (-shift_value)), shift_value < (type)0); \ + type temp = select((type)(VopA >> shift_value), select((type)stype##_MAX, (type)(VopA << (-shift_value)), (type)(clz(VopA) > (-shift_value))), (type)(shift_value < (type)0)); \ type x = temp; \ x = MUL_SAT_OP_EXPAND(x, sub_sat(const_three, MUL_SAT_OP_EXPAND(MUL_SAT_OP_EXPAND(x, x, stype, size, fixed_point_position), temp, stype, size, fixed_point_position)), stype, size, fixed_point_position) >> 1; \ x = MUL_SAT_OP_EXPAND(x, sub_sat(const_three, MUL_SAT_OP_EXPAND(MUL_SAT_OP_EXPAND(x, x, stype, size, fixed_point_position), temp, stype, size, fixed_point_position)), stype, size, fixed_point_position) >> 1; \ @@ -422,9 +430,11 @@ LOGQ_IMPL(qs16, qs16x16, 16) x = MUL_SAT_OP_EXPAND(x, sub_sat(const_three, MUL_SAT_OP_EXPAND(MUL_SAT_OP_EXPAND(x, x, stype, size, fixed_point_position), temp, stype, size, fixed_point_position)), stype, size, fixed_point_position) >> 1; \ } \ type shift_value2 = select(shift_value >> 1, (-shift_value) >> 1, shift_value < (type)0); \ - return select(x >> shift_value2, select((type)stype##_MAX, x << shift_value2, clz(x) > shift_value2), shift_value < (type)0); /* Saturate result if needed */ \ + return select((type)(x >> shift_value2), select((type)stype##_MAX, (type)(x << shift_value2), (type)(clz(x) > shift_value2)), (type)(shift_value < (type)0)); /* Saturate result if needed */ \ } +INVSQRTQ_IMPL(qs8, qs8x1, 1) +INVSQRTQ_IMPL(qs16, qs16x1, 1) INVSQRTQ_IMPL(qs8, qs8x16, 16) INVSQRTQ_IMPL(qs16, qs16x8, 8) |