aboutsummaryrefslogtreecommitdiff
path: root/src/core/CL/cl_kernels/fft.cl
diff options
context:
space:
mode:
authorGiorgio Arena <giorgio.arena@arm.com>2020-12-10 16:49:39 +0000
committerGiorgio Arena <giorgio.arena@arm.com>2020-12-14 13:58:17 +0000
commitea7de7babc319e2fa31c5e1c986e48d6c5370689 (patch)
tree2303791668c67eda76dfb14d07b912af1cb54a17 /src/core/CL/cl_kernels/fft.cl
parentec241b48ea7481e797285788fd68e5e1d42382bb (diff)
downloadComputeLibrary-ea7de7babc319e2fa31c5e1c986e48d6c5370689.tar.gz
Enable FFT for FP16
Resolves: COMPMID-4051 Change-Id: I0c0bf97212dd281c19d5081e6247e7dc0c23cd6b Signed-off-by: Giorgio Arena <giorgio.arena@arm.com> Reviewed-on: https://review.mlplatform.org/c/ml/ComputeLibrary/+/4687 Tested-by: Arm Jenkins <bsgcomp@arm.com> Reviewed-by: Gian Marco Iodice <gianmarco.iodice@arm.com> Comments-Addressed: Arm Jenkins <bsgcomp@arm.com>
Diffstat (limited to 'src/core/CL/cl_kernels/fft.cl')
-rw-r--r--src/core/CL/cl_kernels/fft.cl815
1 files changed, 462 insertions, 353 deletions
diff --git a/src/core/CL/cl_kernels/fft.cl b/src/core/CL/cl_kernels/fft.cl
index eb1eec56e7..b257451652 100644
--- a/src/core/CL/cl_kernels/fft.cl
+++ b/src/core/CL/cl_kernels/fft.cl
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2019 Arm Limited.
+ * Copyright (c) 2019-2020 Arm Limited.
*
* SPDX-License-Identifier: MIT
*
@@ -23,6 +23,7 @@
*/
#include "helpers.h"
+#if defined(DATA_TYPE)
/** Calculates and applies the twiddle factor to a given input.
*
* @param[in] phi The angle.
@@ -30,7 +31,8 @@
*/
#define TWIDDLE_FACTOR_MULTIPLICATION(phi, input) \
{ \
- float2 w, tmp; \
+ VEC_DATA_TYPE(DATA_TYPE, 2) \
+ w, tmp; \
w.x = native_cos(phi); \
w.y = native_sin(phi); \
tmp.x = (w.x * input.x) - (w.y * input.y); \
@@ -43,12 +45,13 @@
* @param[in,out] c0 Complex input 0.
* @param[in,out] c1 Complex input 1.
*/
-#define DFT_2(c0, c1) \
- { \
- float2 v0; \
- v0 = c0; \
- c0 = v0 + c1; \
- c1 = v0 - c1; \
+#define DFT_2(c0, c1) \
+ { \
+ VEC_DATA_TYPE(DATA_TYPE, 2) \
+ v0; \
+ v0 = c0; \
+ c0 = v0 + c1; \
+ c1 = v0 - c1; \
}
// radix-3 butterfly unit factors
@@ -60,15 +63,17 @@
* @param[in,out] c1 Complex input 1.
* @param[in,out] c2 Complex input 2.
*/
-#define DFT_3(c0, c1, c2) \
- { \
- float2 v0 = c1 + c2; \
- float2 v1 = c1 - c2; \
- c1.x = c0.x - 0.5f * v0.x + v1.y * SQRT3DIV2; \
- c1.y = c0.y - 0.5f * v0.y - v1.x * SQRT3DIV2; \
- c2.x = c0.x - 0.5f * v0.x - v1.y * SQRT3DIV2; \
- c2.y = c0.y - 0.5f * v0.y + v1.x * SQRT3DIV2; \
- c0 = c0 + v0; \
+#define DFT_3(c0, c1, c2) \
+ { \
+ VEC_DATA_TYPE(DATA_TYPE, 2) \
+ v0 = c1 + c2; \
+ VEC_DATA_TYPE(DATA_TYPE, 2) \
+ v1 = c1 - c2; \
+ c1.x = c0.x - 0.5f * v0.x + v1.y * SQRT3DIV2; \
+ c1.y = c0.y - 0.5f * v0.y - v1.x * SQRT3DIV2; \
+ c2.x = c0.x - 0.5f * v0.x - v1.y * SQRT3DIV2; \
+ c2.y = c0.y - 0.5f * v0.y + v1.x * SQRT3DIV2; \
+ c0 = c0 + v0; \
}
/**Computes radix-4 butterfly unit.
@@ -78,25 +83,26 @@
* @param[in,out] c2 Complex input 2.
* @param[in,out] c3 Complex input 3.
*/
-#define DFT_4(c0, c1, c2, c3) \
- { \
- float2 v0, v1, v2, v3; \
- v0 = c0 + c2; \
- v1 = c1 + c3; \
- v2 = c0 - c2; \
- v3.x = c1.y - c3.y; \
- v3.y = c3.x - c1.x; \
- c0 = v0 + v1; \
- c2 = v0 - v1; \
- c1 = v2 + v3; \
- c3 = v2 - v3; \
+#define DFT_4(c0, c1, c2, c3) \
+ { \
+ VEC_DATA_TYPE(DATA_TYPE, 2) \
+ v0, v1, v2, v3; \
+ v0 = c0 + c2; \
+ v1 = c1 + c3; \
+ v2 = c0 - c2; \
+ v3.x = c1.y - c3.y; \
+ v3.y = c3.x - c1.x; \
+ c0 = v0 + v1; \
+ c2 = v0 - v1; \
+ c1 = v2 + v3; \
+ c3 = v2 - v3; \
}
// radix-5 butterfly unit factors
-#define W5_A 0.30901699437494f
-#define W5_B 0.95105651629515f
-#define W5_C 0.80901699437494f
-#define W5_D 0.58778525229247f
+#define W5_A (DATA_TYPE)0.30901699437494f
+#define W5_B (DATA_TYPE)0.95105651629515f
+#define W5_C (DATA_TYPE)0.80901699437494f
+#define W5_D (DATA_TYPE)0.58778525229247f
/** Computes radix-5 butterfly unit.
*
@@ -106,28 +112,29 @@
* @param[in,out] c3 Complex input 3.
* @param[in,out] c4 Complex input 4.
*/
-#define DFT_5(c0, c1, c2, c3, c4) \
- { \
- float2 v0, v1, v2, v3, v4; \
- v0 = c0; \
- v1 = W5_A * (c1 + c4) - W5_C * (c2 + c3); \
- v2 = W5_C * (c1 + c4) - W5_A * (c2 + c3); \
- v3 = W5_D * (c1 - c4) - W5_B * (c2 - c3); \
- v4 = W5_B * (c1 - c4) + W5_D * (c2 - c3); \
- c0 = v0 + c1 + c2 + c3 + c4; \
- c1 = v0 + v1 + (float2)(v4.y, -v4.x); \
- c2 = v0 - v2 + (float2)(v3.y, -v3.x); \
- c3 = v0 - v2 + (float2)(-v3.y, v3.x); \
- c4 = v0 + v1 + (float2)(-v4.y, v4.x); \
+#define DFT_5(c0, c1, c2, c3, c4) \
+ { \
+ VEC_DATA_TYPE(DATA_TYPE, 2) \
+ v0, v1, v2, v3, v4; \
+ v0 = c0; \
+ v1 = W5_A * (c1 + c4) - W5_C * (c2 + c3); \
+ v2 = W5_C * (c1 + c4) - W5_A * (c2 + c3); \
+ v3 = W5_D * (c1 - c4) - W5_B * (c2 - c3); \
+ v4 = W5_B * (c1 - c4) + W5_D * (c2 - c3); \
+ c0 = v0 + c1 + c2 + c3 + c4; \
+ c1 = v0 + v1 + (VEC_DATA_TYPE(DATA_TYPE, 2))(v4.y, -v4.x); \
+ c2 = v0 - v2 + (VEC_DATA_TYPE(DATA_TYPE, 2))(v3.y, -v3.x); \
+ c3 = v0 - v2 + (VEC_DATA_TYPE(DATA_TYPE, 2))(-v3.y, v3.x); \
+ c4 = v0 + v1 + (VEC_DATA_TYPE(DATA_TYPE, 2))(-v4.y, v4.x); \
}
// radix-7 butterfly unit factors
-#define W7_A 0.62348980185873f
-#define W7_B 0.78183148246802f
-#define W7_C 0.22252093395631f
-#define W7_D 0.97492791218182f
-#define W7_E 0.90096886790241f
-#define W7_F 0.43388373911755f
+#define W7_A (DATA_TYPE)0.62348980185873f
+#define W7_B (DATA_TYPE)0.78183148246802f
+#define W7_C (DATA_TYPE)0.22252093395631f
+#define W7_D (DATA_TYPE)0.97492791218182f
+#define W7_E (DATA_TYPE)0.90096886790241f
+#define W7_F (DATA_TYPE)0.43388373911755f
/** Computes radix-7 butterfly unit.
*
@@ -141,7 +148,8 @@
*/
#define DFT_7(c0, c1, c2, c3, c4, c5, c6) \
{ \
- float2 v0, v1, v2, v3, v4, v5, v6; \
+ VEC_DATA_TYPE(DATA_TYPE, 2) \
+ v0, v1, v2, v3, v4, v5, v6; \
v0 = c0; \
v1 = W7_A * (c1 + c6) - W7_C * (c2 + c5) - W7_E * (c3 + c4); \
v2 = W7_C * (c1 + c6) + W7_E * (c2 + c5) - W7_A * (c3 + c4); \
@@ -150,12 +158,12 @@
v5 = W7_D * (c1 - c6) - W7_F * (c2 - c5) - W7_B * (c3 - c4); \
v6 = W7_F * (c1 - c6) - W7_B * (c2 - c5) + W7_D * (c3 - c4); \
c0 = v0 + c1 + c2 + c3 + c4 + c5 + c6; \
- c1 = v0 + v1 + (float2)(v4.y, -v4.x); \
- c2 = v0 - v2 + (float2)(v5.y, -v5.x); \
- c3 = v0 - v3 + (float2)(v6.y, -v6.x); \
- c4 = v0 - v3 + (float2)(-v6.y, v6.x); \
- c5 = v0 - v2 + (float2)(-v5.y, v5.x); \
- c6 = v0 + v1 + (float2)(-v4.y, v4.x); \
+ c1 = v0 + v1 + (VEC_DATA_TYPE(DATA_TYPE, 2))(v4.y, -v4.x); \
+ c2 = v0 - v2 + (VEC_DATA_TYPE(DATA_TYPE, 2))(v5.y, -v5.x); \
+ c3 = v0 - v3 + (VEC_DATA_TYPE(DATA_TYPE, 2))(v6.y, -v6.x); \
+ c4 = v0 - v3 + (VEC_DATA_TYPE(DATA_TYPE, 2))(-v6.y, v6.x); \
+ c5 = v0 - v2 + (VEC_DATA_TYPE(DATA_TYPE, 2))(-v5.y, v5.x); \
+ c6 = v0 + v1 + (VEC_DATA_TYPE(DATA_TYPE, 2))(-v4.y, v4.x); \
}
/** Computes radix-8 butterfly unit.
@@ -169,52 +177,55 @@
* @param[in,out] c6 Complex input 6.
* @param[in,out] c7 Complex input 7.
*/
-#define DFT_8(c0, c1, c2, c3, c4, c5, c6, c7) \
- { \
- float2 v0, v1, v2, v3, v4, v5, v6, v7; \
- float2 s0, s1, s2, s3, s4, s5, s6, s7; \
- float2 t0, t1, t2; \
- v0 = c0 + c4; \
- v1 = c1 + c5; \
- v2 = c2 + c6; \
- v3 = c3 + c7; \
- v4 = c0 - c4; \
- v5 = c1 - c5; \
- v6 = c2 - c6; \
- v7 = c3 - c7; \
- s0 = v0 + v2; \
- s1 = v1 + v3; \
- s2 = v0 - v2; \
- s3 = v1 - v3; \
- s4.x = v4.x - v6.y; \
- s4.y = v4.y + v6.x; \
- s5.x = v5.x - v7.y; \
- s5.y = v5.y + v7.x; \
- s6.x = v4.x + v6.y; \
- s6.y = v4.y - v6.x; \
- s7.x = v5.x + v7.y; \
- s7.y = v5.y - v7.x; \
- t0.x = -s3.y; \
- t0.y = s3.x; \
- t1.x = M_SQRT1_2_F * (s5.x - s5.y); \
- t1.y = M_SQRT1_2_F * (s5.x + s5.y); \
- t2.x = -M_SQRT1_2_F * (s7.x + s7.y); \
- t2.y = M_SQRT1_2_F * (s7.x - s7.y); \
- c0 = s0 + s1; \
- c1 = s6 - t2; \
- c2 = s2 - t0; \
- c3 = s4 - t1; \
- c4 = s0 - s1; \
- c5 = s6 + t2; \
- c6 = s2 + t0; \
- c7 = s4 + t1; \
+#define DFT_8(c0, c1, c2, c3, c4, c5, c6, c7) \
+ { \
+ VEC_DATA_TYPE(DATA_TYPE, 2) \
+ v0, v1, v2, v3, v4, v5, v6, v7; \
+ VEC_DATA_TYPE(DATA_TYPE, 2) \
+ s0, s1, s2, s3, s4, s5, s6, s7; \
+ VEC_DATA_TYPE(DATA_TYPE, 2) \
+ t0, t1, t2; \
+ v0 = c0 + c4; \
+ v1 = c1 + c5; \
+ v2 = c2 + c6; \
+ v3 = c3 + c7; \
+ v4 = c0 - c4; \
+ v5 = c1 - c5; \
+ v6 = c2 - c6; \
+ v7 = c3 - c7; \
+ s0 = v0 + v2; \
+ s1 = v1 + v3; \
+ s2 = v0 - v2; \
+ s3 = v1 - v3; \
+ s4.x = v4.x - v6.y; \
+ s4.y = v4.y + v6.x; \
+ s5.x = v5.x - v7.y; \
+ s5.y = v5.y + v7.x; \
+ s6.x = v4.x + v6.y; \
+ s6.y = v4.y - v6.x; \
+ s7.x = v5.x + v7.y; \
+ s7.y = v5.y - v7.x; \
+ t0.x = -s3.y; \
+ t0.y = s3.x; \
+ t1.x = M_SQRT1_2_F * (s5.x - s5.y); \
+ t1.y = M_SQRT1_2_F * (s5.x + s5.y); \
+ t2.x = -M_SQRT1_2_F * (s7.x + s7.y); \
+ t2.y = M_SQRT1_2_F * (s7.x - s7.y); \
+ c0 = s0 + s1; \
+ c1 = s6 - t2; \
+ c2 = s2 - t0; \
+ c3 = s4 - t1; \
+ c4 = s0 - s1; \
+ c5 = s6 + t2; \
+ c6 = s2 + t0; \
+ c7 = s4 + t1; \
}
/** Computes the first stage of a radix-2 DFT on axis 0.
*
* @note In order to perform the FFT function "in-place", the pre-processor -DIN_PLACE must be passed at compile time
*
- * @param[in,out] input_ptr Pointer to the source tensor. Supported data types: F32
+ * @param[in,out] input_ptr Pointer to the source tensor. Supported data types: F16/f32
* @param[in,out] input_stride_x Stride of the source tensor in X dimension (in bytes)
* @param[in,out] input_step_x input_stride_x * number of elements along X processed per workitem(in bytes)
* @param[in,out] input_stride_y Stride of the source tensor in Y dimension (in bytes)
@@ -231,7 +242,7 @@
* @param[in] output_step_z (Optional) output_stride_z * number of elements along Z processed per workitem(in bytes)
* @param[in] output_offset_first_element_in_bytes (Optional) The offset of the first element in the destination image
*/
-kernel void fft_radix_2_first_stage_axis_0(
+__kernel void fft_radix_2_first_stage_axis_0(
TENSOR3D_DECLARATION(input)
#ifndef IN_PLACE
,
@@ -248,20 +259,21 @@ kernel void fft_radix_2_first_stage_axis_0(
#endif /* IN_PLACE */
// Load two complex input values
- float4 data = vload4(0, (__global float *)input.ptr);
+ VEC_DATA_TYPE(DATA_TYPE, 4)
+ data = vload4(0, (__global DATA_TYPE *)input.ptr);
// Compute DFT N = 2
DFT_2(data.s01, data.s23);
// Store two complex output values
- vstore4(data, 0, (__global float *)output.ptr);
+ vstore4(data, 0, (__global DATA_TYPE *)output.ptr);
}
/** Computes the first stage of a radix-2 DFT on axis 1.
*
* @note In order to perform the FFT function "in-place", the pre-processor -DIN_PLACE must be passed at compile time
*
- * @param[in,out] input_ptr Pointer to the source tensor. Supported data types: F32
+ * @param[in,out] input_ptr Pointer to the source tensor. Supported data types: F16/f32
* @param[in,out] input_stride_x Stride of the source tensor in X dimension (in bytes)
* @param[in,out] input_step_x input_stride_x * number of elements along X processed per workitem(in bytes)
* @param[in,out] input_stride_y Stride of the source tensor in Y dimension (in bytes)
@@ -278,7 +290,7 @@ kernel void fft_radix_2_first_stage_axis_0(
* @param[in] output_step_z (Optional) output_stride_z * number of elements along Z processed per workitem(in bytes)
* @param[in] output_offset_first_element_in_bytes (Optional) The offset of the first element in the destination image
*/
-kernel void fft_radix_2_first_stage_axis_1(
+__kernel void fft_radix_2_first_stage_axis_1(
TENSOR3D_DECLARATION(input)
#ifndef IN_PLACE
,
@@ -295,22 +307,24 @@ kernel void fft_radix_2_first_stage_axis_1(
#endif /* IN_PLACE */
// Load two complex input values
- float2 data1 = vload2(0, (__global float *)input.ptr);
- float2 data2 = vload2(0, (__global float *)tensor3D_offset(&input, 0, 1, 0));
+ VEC_DATA_TYPE(DATA_TYPE, 2)
+ data1 = vload2(0, (__global DATA_TYPE *)input.ptr);
+ VEC_DATA_TYPE(DATA_TYPE, 2)
+ data2 = vload2(0, (__global DATA_TYPE *)tensor3D_offset(&input, 0, 1, 0));
// Compute DFT N = 2
DFT_2(data1, data2);
// Store two complex output values
- vstore2(data1, 0, (__global float *)output.ptr);
- vstore2(data2, 0, (__global float *)tensor3D_offset(&output, 0, 1, 0));
+ vstore2(data1, 0, (__global DATA_TYPE *)output.ptr);
+ vstore2(data2, 0, (__global DATA_TYPE *)tensor3D_offset(&output, 0, 1, 0));
}
/** Computes the first stage of a radix-3 DFT on axis 0.
*
* @note In order to perform the FFT function "in-place", the pre-processor -DIN_PLACE must be passed at compile time
*
- * @param[in,out] input_ptr Pointer to the source tensor. Supported data types: F32
+ * @param[in,out] input_ptr Pointer to the source tensor. Supported data types: F16/f32
* @param[in,out] input_stride_x Stride of the source tensor in X dimension (in bytes)
* @param[in,out] input_step_x input_stride_x * number of elements along X processed per workitem(in bytes)
* @param[in,out] input_stride_y Stride of the source tensor in Y dimension (in bytes)
@@ -327,7 +341,7 @@ kernel void fft_radix_2_first_stage_axis_1(
* @param[in] output_step_z (Optional) output_stride_z * number of elements along Z processed per workitem(in bytes)
* @param[in] output_offset_first_element_in_bytes (Optional) The offset of the first element in the destination image
*/
-kernel void fft_radix_3_first_stage_axis_0(
+__kernel void fft_radix_3_first_stage_axis_0(
TENSOR3D_DECLARATION(input)
#ifndef IN_PLACE
,
@@ -344,22 +358,24 @@ kernel void fft_radix_3_first_stage_axis_0(
#endif /* IN_PLACE */
// Load three complex input values
- float4 data0 = vload4(0, (__global float *)input.ptr);
- float2 data1 = vload2(0, (__global float *)tensor3D_offset(&input, 2, 0, 0));
+ VEC_DATA_TYPE(DATA_TYPE, 4)
+ data0 = vload4(0, (__global DATA_TYPE *)input.ptr);
+ VEC_DATA_TYPE(DATA_TYPE, 2)
+ data1 = vload2(0, (__global DATA_TYPE *)tensor3D_offset(&input, 2, 0, 0));
// Compute DFT N = 3
DFT_3(data0.s01, data0.s23, data1.s01);
// Store three complex output values
- vstore4(data0, 0, (__global float *)output.ptr);
- vstore2(data1, 0, (__global float *)tensor3D_offset(&output, 2, 0, 0));
+ vstore4(data0, 0, (__global DATA_TYPE *)output.ptr);
+ vstore2(data1, 0, (__global DATA_TYPE *)tensor3D_offset(&output, 2, 0, 0));
}
/** Computes the first stage of a radix-3 DFT on axis 1.
*
* @note In order to perform the FFT function "in-place", the pre-processor -DIN_PLACE must be passed at compile time
*
- * @param[in,out] input_ptr Pointer to the source tensor. Supported data types: F32
+ * @param[in,out] input_ptr Pointer to the source tensor. Supported data types: F16/f32
* @param[in,out] input_stride_x Stride of the source tensor in X dimension (in bytes)
* @param[in,out] input_step_x input_stride_x * number of elements along X processed per workitem(in bytes)
* @param[in,out] input_stride_y Stride of the source tensor in Y dimension (in bytes)
@@ -376,7 +392,7 @@ kernel void fft_radix_3_first_stage_axis_0(
* @param[in] output_step_z (Optional) output_stride_z * number of elements along Z processed per workitem(in bytes)
* @param[in] output_offset_first_element_in_bytes (Optional) The offset of the first element in the destination image
*/
-kernel void fft_radix_3_first_stage_axis_1(
+__kernel void fft_radix_3_first_stage_axis_1(
TENSOR3D_DECLARATION(input)
#ifndef IN_PLACE
,
@@ -393,24 +409,27 @@ kernel void fft_radix_3_first_stage_axis_1(
#endif /* IN_PLACE */
// Load three complex input values
- float2 data0 = vload2(0, (__global float *)input.ptr);
- float2 data1 = vload2(0, (__global float *)tensor3D_offset(&input, 0, 1, 0));
- float2 data2 = vload2(0, (__global float *)tensor3D_offset(&input, 0, 2, 0));
+ VEC_DATA_TYPE(DATA_TYPE, 2)
+ data0 = vload2(0, (__global DATA_TYPE *)input.ptr);
+ VEC_DATA_TYPE(DATA_TYPE, 2)
+ data1 = vload2(0, (__global DATA_TYPE *)tensor3D_offset(&input, 0, 1, 0));
+ VEC_DATA_TYPE(DATA_TYPE, 2)
+ data2 = vload2(0, (__global DATA_TYPE *)tensor3D_offset(&input, 0, 2, 0));
// Compute DFT N = 3
DFT_3(data0, data1, data2);
// Store three complex output values
- vstore2(data0, 0, (__global float *)output.ptr);
- vstore2(data1, 0, (__global float *)tensor3D_offset(&output, 0, 1, 0));
- vstore2(data2, 0, (__global float *)tensor3D_offset(&output, 0, 2, 0));
+ vstore2(data0, 0, (__global DATA_TYPE *)output.ptr);
+ vstore2(data1, 0, (__global DATA_TYPE *)tensor3D_offset(&output, 0, 1, 0));
+ vstore2(data2, 0, (__global DATA_TYPE *)tensor3D_offset(&output, 0, 2, 0));
}
/** Computes the first stage of a radix-4 DFT on axis 0.
*
* @note In order to perform the FFT function "in-place", the pre-processor -DIN_PLACE must be passed at compile time
*
- * @param[in,out] input_ptr Pointer to the source tensor. Supported data types: F32
+ * @param[in,out] input_ptr Pointer to the source tensor. Supported data types: F16/f32
* @param[in,out] input_stride_x Stride of the source tensor in X dimension (in bytes)
* @param[in,out] input_step_x input_stride_x * number of elements along X processed per workitem(in bytes)
* @param[in,out] input_stride_y Stride of the source tensor in Y dimension (in bytes)
@@ -427,7 +446,7 @@ kernel void fft_radix_3_first_stage_axis_1(
* @param[in] output_step_z (Optional) output_stride_z * number of elements along Z processed per workitem(in bytes)
* @param[in] output_offset_first_element_in_bytes (Optional) The offset of the first element in the destination image
*/
-kernel void fft_radix_4_first_stage_axis_0(
+__kernel void fft_radix_4_first_stage_axis_0(
TENSOR3D_DECLARATION(input)
#ifndef IN_PLACE
,
@@ -444,20 +463,21 @@ kernel void fft_radix_4_first_stage_axis_0(
#endif /* IN_PLACE */
// Load four complex input values
- float8 data = vload8(0, (__global float *)input.ptr);
+ VEC_DATA_TYPE(DATA_TYPE, 8)
+ data = vload8(0, (__global DATA_TYPE *)input.ptr);
// Compute DFT N = 4
DFT_4(data.s01, data.s23, data.s45, data.s67);
// Store four complex output values
- vstore8(data, 0, (__global float *)output.ptr);
+ vstore8(data, 0, (__global DATA_TYPE *)output.ptr);
}
/** Computes the first stage of a radix-4 DFT on axis 1.
*
* @note In order to perform the FFT function "in-place", the pre-processor -DIN_PLACE must be passed at compile time
*
- * @param[in,out] input_ptr Pointer to the source tensor. Supported data types: F32
+ * @param[in,out] input_ptr Pointer to the source tensor. Supported data types: F16/f32
* @param[in,out] input_stride_x Stride of the source tensor in X dimension (in bytes)
* @param[in,out] input_step_x input_stride_x * number of elements along X processed per workitem(in bytes)
* @param[in,out] input_stride_y Stride of the source tensor in Y dimension (in bytes)
@@ -474,7 +494,7 @@ kernel void fft_radix_4_first_stage_axis_0(
* @param[in] output_step_z (Optional) output_stride_z * number of elements along Z processed per workitem(in bytes)
* @param[in] output_offset_first_element_in_bytes (Optional) The offset of the first element in the destination image
*/
-kernel void fft_radix_4_first_stage_axis_1(
+__kernel void fft_radix_4_first_stage_axis_1(
TENSOR3D_DECLARATION(input)
#ifndef IN_PLACE
,
@@ -491,26 +511,30 @@ kernel void fft_radix_4_first_stage_axis_1(
#endif /* IN_PLACE */
// Load four complex input values
- float2 data0 = vload2(0, (__global float *)input.ptr);
- float2 data1 = vload2(0, (__global float *)tensor3D_offset(&input, 0, 1, 0));
- float2 data2 = vload2(0, (__global float *)tensor3D_offset(&input, 0, 2, 0));
- float2 data3 = vload2(0, (__global float *)tensor3D_offset(&input, 0, 3, 0));
+ VEC_DATA_TYPE(DATA_TYPE, 2)
+ data0 = vload2(0, (__global DATA_TYPE *)input.ptr);
+ VEC_DATA_TYPE(DATA_TYPE, 2)
+ data1 = vload2(0, (__global DATA_TYPE *)tensor3D_offset(&input, 0, 1, 0));
+ VEC_DATA_TYPE(DATA_TYPE, 2)
+ data2 = vload2(0, (__global DATA_TYPE *)tensor3D_offset(&input, 0, 2, 0));
+ VEC_DATA_TYPE(DATA_TYPE, 2)
+ data3 = vload2(0, (__global DATA_TYPE *)tensor3D_offset(&input, 0, 3, 0));
// Compute DFT N = 4
DFT_4(data0, data1, data2, data3);
// Store four complex output values
- vstore2(data0, 0, (__global float *)output.ptr);
- vstore2(data1, 0, (__global float *)tensor3D_offset(&output, 0, 1, 0));
- vstore2(data2, 0, (__global float *)tensor3D_offset(&output, 0, 2, 0));
- vstore2(data3, 0, (__global float *)tensor3D_offset(&output, 0, 3, 0));
+ vstore2(data0, 0, (__global DATA_TYPE *)output.ptr);
+ vstore2(data1, 0, (__global DATA_TYPE *)tensor3D_offset(&output, 0, 1, 0));
+ vstore2(data2, 0, (__global DATA_TYPE *)tensor3D_offset(&output, 0, 2, 0));
+ vstore2(data3, 0, (__global DATA_TYPE *)tensor3D_offset(&output, 0, 3, 0));
}
/** Computes the first stage of a radix-5 DFT on axis 0.
*
* @note In order to perform the FFT function "in-place", the pre-processor -DIN_PLACE must be passed at compile time
*
- * @param[in,out] input_ptr Pointer to the source tensor. Supported data types: F32
+ * @param[in,out] input_ptr Pointer to the source tensor. Supported data types: F16/f32
* @param[in,out] input_stride_x Stride of the source tensor in X dimension (in bytes)
* @param[in,out] input_step_x input_stride_x * number of elements along X processed per workitem(in bytes)
* @param[in,out] input_stride_y Stride of the source tensor in Y dimension (in bytes)
@@ -527,7 +551,7 @@ kernel void fft_radix_4_first_stage_axis_1(
* @param[in] output_step_z (Optional) output_stride_z * number of elements along Z processed per workitem(in bytes)
* @param[in] output_offset_first_element_in_bytes (Optional) The offset of the first element in the destination image
*/
-kernel void fft_radix_5_first_stage_axis_0(
+__kernel void fft_radix_5_first_stage_axis_0(
TENSOR3D_DECLARATION(input)
#ifndef IN_PLACE
,
@@ -544,22 +568,24 @@ kernel void fft_radix_5_first_stage_axis_0(
#endif /* IN_PLACE */
// Load five complex input values
- float8 data0 = vload8(0, (__global float *)input.ptr);
- float2 data1 = vload2(0, (__global float *)tensor3D_offset(&input, 4, 0, 0));
+ VEC_DATA_TYPE(DATA_TYPE, 8)
+ data0 = vload8(0, (__global DATA_TYPE *)input.ptr);
+ VEC_DATA_TYPE(DATA_TYPE, 2)
+ data1 = vload2(0, (__global DATA_TYPE *)tensor3D_offset(&input, 4, 0, 0));
// Compute DFT N = 5
DFT_5(data0.s01, data0.s23, data0.s45, data0.s67, data1.s01);
// Store five complex output values
- vstore8(data0, 0, (__global float *)output.ptr);
- vstore2(data1, 0, (__global float *)tensor3D_offset(&output, 4, 0, 0));
+ vstore8(data0, 0, (__global DATA_TYPE *)output.ptr);
+ vstore2(data1, 0, (__global DATA_TYPE *)tensor3D_offset(&output, 4, 0, 0));
}
/** Computes the first stage of a radix-5 DFT on axis 1.
*
* @note In order to perform the FFT function "in-place", the pre-processor -DIN_PLACE must be passed at compile time
*
- * @param[in,out] input_ptr Pointer to the source tensor. Supported data types: F32
+ * @param[in,out] input_ptr Pointer to the source tensor. Supported data types: F16/f32
* @param[in,out] input_stride_x Stride of the source tensor in X dimension (in bytes)
* @param[in,out] input_step_x input_stride_x * number of elements along X processed per workitem(in bytes)
* @param[in,out] input_stride_y Stride of the source tensor in Y dimension (in bytes)
@@ -576,7 +602,7 @@ kernel void fft_radix_5_first_stage_axis_0(
* @param[in] output_step_z (Optional) output_stride_z * number of elements along Z processed per workitem(in bytes)
* @param[in] output_offset_first_element_in_bytes (Optional) The offset of the first element in the destination image
*/
-kernel void fft_radix_5_first_stage_axis_1(
+__kernel void fft_radix_5_first_stage_axis_1(
TENSOR3D_DECLARATION(input)
#ifndef IN_PLACE
,
@@ -593,28 +619,33 @@ kernel void fft_radix_5_first_stage_axis_1(
#endif /* IN_PLACE */
// Load five complex input values
- float2 data0 = vload2(0, (__global float *)input.ptr);
- float2 data1 = vload2(0, (__global float *)tensor3D_offset(&input, 0, 1, 0));
- float2 data2 = vload2(0, (__global float *)tensor3D_offset(&input, 0, 2, 0));
- float2 data3 = vload2(0, (__global float *)tensor3D_offset(&input, 0, 3, 0));
- float2 data4 = vload2(0, (__global float *)tensor3D_offset(&input, 0, 4, 0));
+ VEC_DATA_TYPE(DATA_TYPE, 2)
+ data0 = vload2(0, (__global DATA_TYPE *)input.ptr);
+ VEC_DATA_TYPE(DATA_TYPE, 2)
+ data1 = vload2(0, (__global DATA_TYPE *)tensor3D_offset(&input, 0, 1, 0));
+ VEC_DATA_TYPE(DATA_TYPE, 2)
+ data2 = vload2(0, (__global DATA_TYPE *)tensor3D_offset(&input, 0, 2, 0));
+ VEC_DATA_TYPE(DATA_TYPE, 2)
+ data3 = vload2(0, (__global DATA_TYPE *)tensor3D_offset(&input, 0, 3, 0));
+ VEC_DATA_TYPE(DATA_TYPE, 2)
+ data4 = vload2(0, (__global DATA_TYPE *)tensor3D_offset(&input, 0, 4, 0));
// Compute DFT N = 5
DFT_5(data0, data1, data2, data3, data4);
// Store five complex output values
- vstore2(data0, 0, (__global float *)output.ptr);
- vstore2(data1, 0, (__global float *)tensor3D_offset(&output, 0, 1, 0));
- vstore2(data2, 0, (__global float *)tensor3D_offset(&output, 0, 2, 0));
- vstore2(data3, 0, (__global float *)tensor3D_offset(&output, 0, 3, 0));
- vstore2(data4, 0, (__global float *)tensor3D_offset(&output, 0, 4, 0));
+ vstore2(data0, 0, (__global DATA_TYPE *)output.ptr);
+ vstore2(data1, 0, (__global DATA_TYPE *)tensor3D_offset(&output, 0, 1, 0));
+ vstore2(data2, 0, (__global DATA_TYPE *)tensor3D_offset(&output, 0, 2, 0));
+ vstore2(data3, 0, (__global DATA_TYPE *)tensor3D_offset(&output, 0, 3, 0));
+ vstore2(data4, 0, (__global DATA_TYPE *)tensor3D_offset(&output, 0, 4, 0));
}
/** Computes the first stage of a radix-7 DFT on axis 0.
*
* @note In order to perform the FFT function "in-place", the pre-processor -DIN_PLACE must be passed at compile time
*
- * @param[in,out] input_ptr Pointer to the source tensor. Supported data types: F32
+ * @param[in,out] input_ptr Pointer to the source tensor. Supported data types: F16/f32
* @param[in,out] input_stride_x Stride of the source tensor in X dimension (in bytes)
* @param[in,out] input_step_x input_stride_x * number of elements along X processed per workitem(in bytes)
* @param[in,out] input_stride_y Stride of the source tensor in Y dimension (in bytes)
@@ -631,7 +662,7 @@ kernel void fft_radix_5_first_stage_axis_1(
* @param[in] output_step_z (Optional) output_stride_z * number of elements along Z processed per workitem(in bytes)
* @param[in] output_offset_first_element_in_bytes (Optional) The offset of the first element in the destination image
*/
-kernel void fft_radix_7_first_stage_axis_0(
+__kernel void fft_radix_7_first_stage_axis_0(
TENSOR3D_DECLARATION(input)
#ifndef IN_PLACE
,
@@ -648,24 +679,27 @@ kernel void fft_radix_7_first_stage_axis_0(
#endif /* IN_PLACE */
// Load seven complex input values
- float8 data0 = vload8(0, (__global float *)input.ptr);
- float4 data1 = vload4(0, (__global float *)tensor3D_offset(&input, 4, 0, 0));
- float2 data2 = vload2(0, (__global float *)tensor3D_offset(&input, 6, 0, 0));
+ VEC_DATA_TYPE(DATA_TYPE, 8)
+ data0 = vload8(0, (__global DATA_TYPE *)input.ptr);
+ VEC_DATA_TYPE(DATA_TYPE, 4)
+ data1 = vload4(0, (__global DATA_TYPE *)tensor3D_offset(&input, 4, 0, 0));
+ VEC_DATA_TYPE(DATA_TYPE, 2)
+ data2 = vload2(0, (__global DATA_TYPE *)tensor3D_offset(&input, 6, 0, 0));
// Compute DFT N = 7
DFT_7(data0.s01, data0.s23, data0.s45, data0.s67, data1.s01, data1.s23, data2.s01);
// Store seven complex output values
- vstore8(data0, 0, (__global float *)output.ptr);
- vstore4(data1, 0, (__global float *)tensor3D_offset(&output, 4, 0, 0));
- vstore2(data2, 0, (__global float *)tensor3D_offset(&output, 6, 0, 0));
+ vstore8(data0, 0, (__global DATA_TYPE *)output.ptr);
+ vstore4(data1, 0, (__global DATA_TYPE *)tensor3D_offset(&output, 4, 0, 0));
+ vstore2(data2, 0, (__global DATA_TYPE *)tensor3D_offset(&output, 6, 0, 0));
}
/** Computes the first stage of a radix-7 DFT on axis 1.
*
* @note In order to perform the FFT function "in-place", the pre-processor -DIN_PLACE must be passed at compile time
*
- * @param[in,out] input_ptr Pointer to the source tensor. Supported data types: F32
+ * @param[in,out] input_ptr Pointer to the source tensor. Supported data types: F16/f32
* @param[in,out] input_stride_x Stride of the source tensor in X dimension (in bytes)
* @param[in,out] input_step_x input_stride_x * number of elements along X processed per workitem(in bytes)
* @param[in,out] input_stride_y Stride of the source tensor in Y dimension (in bytes)
@@ -682,7 +716,7 @@ kernel void fft_radix_7_first_stage_axis_0(
* @param[in] output_step_z (Optional) output_stride_z * number of elements along Z processed per workitem(in bytes)
* @param[in] output_offset_first_element_in_bytes (Optional) The offset of the first element in the destination image
*/
-kernel void fft_radix_7_first_stage_axis_1(
+__kernel void fft_radix_7_first_stage_axis_1(
TENSOR3D_DECLARATION(input)
#ifndef IN_PLACE
,
@@ -699,32 +733,39 @@ kernel void fft_radix_7_first_stage_axis_1(
#endif /* IN_PLACE */
// Load seven complex input values
- float2 data0 = vload2(0, (__global float *)input.ptr);
- float2 data1 = vload2(0, (__global float *)tensor3D_offset(&input, 0, 1, 0));
- float2 data2 = vload2(0, (__global float *)tensor3D_offset(&input, 0, 2, 0));
- float2 data3 = vload2(0, (__global float *)tensor3D_offset(&input, 0, 3, 0));
- float2 data4 = vload2(0, (__global float *)tensor3D_offset(&input, 0, 4, 0));
- float2 data5 = vload2(0, (__global float *)tensor3D_offset(&input, 0, 5, 0));
- float2 data6 = vload2(0, (__global float *)tensor3D_offset(&input, 0, 6, 0));
+ VEC_DATA_TYPE(DATA_TYPE, 2)
+ data0 = vload2(0, (__global DATA_TYPE *)input.ptr);
+ VEC_DATA_TYPE(DATA_TYPE, 2)
+ data1 = vload2(0, (__global DATA_TYPE *)tensor3D_offset(&input, 0, 1, 0));
+ VEC_DATA_TYPE(DATA_TYPE, 2)
+ data2 = vload2(0, (__global DATA_TYPE *)tensor3D_offset(&input, 0, 2, 0));
+ VEC_DATA_TYPE(DATA_TYPE, 2)
+ data3 = vload2(0, (__global DATA_TYPE *)tensor3D_offset(&input, 0, 3, 0));
+ VEC_DATA_TYPE(DATA_TYPE, 2)
+ data4 = vload2(0, (__global DATA_TYPE *)tensor3D_offset(&input, 0, 4, 0));
+ VEC_DATA_TYPE(DATA_TYPE, 2)
+ data5 = vload2(0, (__global DATA_TYPE *)tensor3D_offset(&input, 0, 5, 0));
+ VEC_DATA_TYPE(DATA_TYPE, 2)
+ data6 = vload2(0, (__global DATA_TYPE *)tensor3D_offset(&input, 0, 6, 0));
// Compute DFT N = 7
DFT_7(data0, data1, data2, data3, data4, data5, data6);
// Store seven complex output values
- vstore2(data0, 0, (__global float *)output.ptr);
- vstore2(data1, 0, (__global float *)tensor3D_offset(&output, 0, 1, 0));
- vstore2(data2, 0, (__global float *)tensor3D_offset(&output, 0, 2, 0));
- vstore2(data3, 0, (__global float *)tensor3D_offset(&output, 0, 3, 0));
- vstore2(data4, 0, (__global float *)tensor3D_offset(&output, 0, 4, 0));
- vstore2(data5, 0, (__global float *)tensor3D_offset(&output, 0, 5, 0));
- vstore2(data6, 0, (__global float *)tensor3D_offset(&output, 0, 6, 0));
+ vstore2(data0, 0, (__global DATA_TYPE *)output.ptr);
+ vstore2(data1, 0, (__global DATA_TYPE *)tensor3D_offset(&output, 0, 1, 0));
+ vstore2(data2, 0, (__global DATA_TYPE *)tensor3D_offset(&output, 0, 2, 0));
+ vstore2(data3, 0, (__global DATA_TYPE *)tensor3D_offset(&output, 0, 3, 0));
+ vstore2(data4, 0, (__global DATA_TYPE *)tensor3D_offset(&output, 0, 4, 0));
+ vstore2(data5, 0, (__global DATA_TYPE *)tensor3D_offset(&output, 0, 5, 0));
+ vstore2(data6, 0, (__global DATA_TYPE *)tensor3D_offset(&output, 0, 6, 0));
}
/** Computes the first stage of a radix-8 DFT on axis 0.
*
* @note In order to perform the FFT function "in-place", the pre-processor -DIN_PLACE must be passed at compile time
*
- * @param[in,out] input_ptr Pointer to the source tensor. Supported data types: F32
+ * @param[in,out] input_ptr Pointer to the source tensor. Supported data types: F16/f32
* @param[in,out] input_stride_x Stride of the source tensor in X dimension (in bytes)
* @param[in,out] input_step_x input_stride_x * number of elements along X processed per workitem(in bytes)
* @param[in,out] input_stride_y Stride of the source tensor in Y dimension (in bytes)
@@ -741,7 +782,7 @@ kernel void fft_radix_7_first_stage_axis_1(
* @param[in] output_step_z (Optional) output_stride_z * number of elements along Z processed per workitem(in bytes)
* @param[in] output_offset_first_element_in_bytes (Optional) The offset of the first element in the destination image
*/
-kernel void fft_radix_8_first_stage_axis_0(
+__kernel void fft_radix_8_first_stage_axis_0(
TENSOR3D_DECLARATION(input)
#ifndef IN_PLACE
,
@@ -758,20 +799,21 @@ kernel void fft_radix_8_first_stage_axis_0(
#endif /* IN_PLACE */
// Load eight complex input values
- float16 data = vload16(0, (__global float *)input.ptr);
+ VEC_DATA_TYPE(DATA_TYPE, 16)
+ data = vload16(0, (__global DATA_TYPE *)input.ptr);
// Compute DFT N = 8
DFT_8(data.s01, data.s23, data.s45, data.s67, data.s89, data.sAB, data.sCD, data.sEF);
// Store eight complex output values
- vstore16(data, 0, (__global float *)output.ptr);
+ vstore16(data, 0, (__global DATA_TYPE *)output.ptr);
}
/** Computes the first stage of a radix-8 DFT on axis 1.
*
* @note In order to perform the FFT function "in-place", the pre-processor -DIN_PLACE must be passed at compile time
*
- * @param[in,out] input_ptr Pointer to the source tensor. Supported data types: F32
+ * @param[in,out] input_ptr Pointer to the source tensor. Supported data types: F16/f32
* @param[in,out] input_stride_x Stride of the source tensor in X dimension (in bytes)
* @param[in,out] input_step_x input_stride_x * number of elements along X processed per workitem(in bytes)
* @param[in,out] input_stride_y Stride of the source tensor in Y dimension (in bytes)
@@ -788,7 +830,7 @@ kernel void fft_radix_8_first_stage_axis_0(
* @param[in] output_step_z (Optional) output_stride_z * number of elements along Z processed per workitem(in bytes)
* @param[in] output_offset_first_element_in_bytes (Optional) The offset of the first element in the destination image
*/
-kernel void fft_radix_8_first_stage_axis_1(
+__kernel void fft_radix_8_first_stage_axis_1(
TENSOR3D_DECLARATION(input)
#ifndef IN_PLACE
,
@@ -805,34 +847,42 @@ kernel void fft_radix_8_first_stage_axis_1(
#endif /* IN_PLACE */
// Load eight complex input values
- float2 data0 = vload2(0, (__global float *)input.ptr);
- float2 data1 = vload2(0, (__global float *)tensor3D_offset(&input, 0, 1, 0));
- float2 data2 = vload2(0, (__global float *)tensor3D_offset(&input, 0, 2, 0));
- float2 data3 = vload2(0, (__global float *)tensor3D_offset(&input, 0, 3, 0));
- float2 data4 = vload2(0, (__global float *)tensor3D_offset(&input, 0, 4, 0));
- float2 data5 = vload2(0, (__global float *)tensor3D_offset(&input, 0, 5, 0));
- float2 data6 = vload2(0, (__global float *)tensor3D_offset(&input, 0, 6, 0));
- float2 data7 = vload2(0, (__global float *)tensor3D_offset(&input, 0, 7, 0));
+ VEC_DATA_TYPE(DATA_TYPE, 2)
+ data0 = vload2(0, (__global DATA_TYPE *)input.ptr);
+ VEC_DATA_TYPE(DATA_TYPE, 2)
+ data1 = vload2(0, (__global DATA_TYPE *)tensor3D_offset(&input, 0, 1, 0));
+ VEC_DATA_TYPE(DATA_TYPE, 2)
+ data2 = vload2(0, (__global DATA_TYPE *)tensor3D_offset(&input, 0, 2, 0));
+ VEC_DATA_TYPE(DATA_TYPE, 2)
+ data3 = vload2(0, (__global DATA_TYPE *)tensor3D_offset(&input, 0, 3, 0));
+ VEC_DATA_TYPE(DATA_TYPE, 2)
+ data4 = vload2(0, (__global DATA_TYPE *)tensor3D_offset(&input, 0, 4, 0));
+ VEC_DATA_TYPE(DATA_TYPE, 2)
+ data5 = vload2(0, (__global DATA_TYPE *)tensor3D_offset(&input, 0, 5, 0));
+ VEC_DATA_TYPE(DATA_TYPE, 2)
+ data6 = vload2(0, (__global DATA_TYPE *)tensor3D_offset(&input, 0, 6, 0));
+ VEC_DATA_TYPE(DATA_TYPE, 2)
+ data7 = vload2(0, (__global DATA_TYPE *)tensor3D_offset(&input, 0, 7, 0));
// Compute DFT N = 8
DFT_8(data0, data1, data2, data3, data4, data5, data6, data7);
// Store eight complex output values
- vstore2(data0, 0, (__global float *)output.ptr);
- vstore2(data1, 0, (__global float *)tensor3D_offset(&output, 0, 1, 0));
- vstore2(data2, 0, (__global float *)tensor3D_offset(&output, 0, 2, 0));
- vstore2(data3, 0, (__global float *)tensor3D_offset(&output, 0, 3, 0));
- vstore2(data4, 0, (__global float *)tensor3D_offset(&output, 0, 4, 0));
- vstore2(data5, 0, (__global float *)tensor3D_offset(&output, 0, 5, 0));
- vstore2(data6, 0, (__global float *)tensor3D_offset(&output, 0, 6, 0));
- vstore2(data7, 0, (__global float *)tensor3D_offset(&output, 0, 7, 0));
+ vstore2(data0, 0, (__global DATA_TYPE *)output.ptr);
+ vstore2(data1, 0, (__global DATA_TYPE *)tensor3D_offset(&output, 0, 1, 0));
+ vstore2(data2, 0, (__global DATA_TYPE *)tensor3D_offset(&output, 0, 2, 0));
+ vstore2(data3, 0, (__global DATA_TYPE *)tensor3D_offset(&output, 0, 3, 0));
+ vstore2(data4, 0, (__global DATA_TYPE *)tensor3D_offset(&output, 0, 4, 0));
+ vstore2(data5, 0, (__global DATA_TYPE *)tensor3D_offset(&output, 0, 5, 0));
+ vstore2(data6, 0, (__global DATA_TYPE *)tensor3D_offset(&output, 0, 6, 0));
+ vstore2(data7, 0, (__global DATA_TYPE *)tensor3D_offset(&output, 0, 7, 0));
}
/** Computes a stage of a radix-2 FFT on axis 0.
*
* @note In order to perform the FFT function "in-place", the pre-processor -DIN_PLACE must be passed at compile time
*
- * @param[in,out] input_ptr Pointer to the source tensor. Supported data types: F32
+ * @param[in,out] input_ptr Pointer to the source tensor. Supported data types: F16/f32
* @param[in,out] input_stride_x Stride of the source tensor in X dimension (in bytes)
* @param[in,out] input_step_x input_stride_x * number of elements along X processed per workitem(in bytes)
* @param[in,out] input_stride_y Stride of the source tensor in Y dimension (in bytes)
@@ -852,7 +902,7 @@ kernel void fft_radix_8_first_stage_axis_1(
* @param[in] Ni Nx * Ny.
* @param[in] exp_const Exponent constant
*/
-kernel void fft_radix_2_axis_0(
+__kernel void fft_radix_2_axis_0(
TENSOR3D_DECLARATION(input)
#ifndef IN_PLACE
,
@@ -881,11 +931,13 @@ kernel void fft_radix_2_axis_0(
#endif /* IN_PLACE */
// Load two complex input values
- float2 c0 = vload2(0, (__global float *)input.ptr);
- float2 c1 = vload2(0, (__global float *)tensor3D_offset(&input, Nx, 0, 0));
+ VEC_DATA_TYPE(DATA_TYPE, 2)
+ c0 = vload2(0, (__global DATA_TYPE *)input.ptr);
+ VEC_DATA_TYPE(DATA_TYPE, 2)
+ c1 = vload2(0, (__global DATA_TYPE *)tensor3D_offset(&input, Nx, 0, 0));
// Compute phi
- float phi = (float)nx * exp_const;
+ DATA_TYPE phi = (DATA_TYPE)nx * (DATA_TYPE)exp_const;
// Multiply by twiddle factor
TWIDDLE_FACTOR_MULTIPLICATION(phi, c1);
@@ -894,15 +946,15 @@ kernel void fft_radix_2_axis_0(
DFT_2(c0, c1);
// Store two complex output values
- vstore2(c0, 0, (__global float *)output.ptr);
- vstore2(c1, 0, (__global float *)tensor3D_offset(&output, Nx, 0, 0));
+ vstore2(c0, 0, (__global DATA_TYPE *)output.ptr);
+ vstore2(c1, 0, (__global DATA_TYPE *)tensor3D_offset(&output, Nx, 0, 0));
}
/** Computes a stage of a radix-2 FFT on axis 1.
*
* @note In order to perform the FFT function "in-place", the pre-processor -DIN_PLACE must be passed at compile time
*
- * @param[in,out] input_ptr Pointer to the source tensor. Supported data types: F32
+ * @param[in,out] input_ptr Pointer to the source tensor. Supported data types: F16/f32
* @param[in,out] input_stride_x Stride of the source tensor in X dimension (in bytes)
* @param[in,out] input_step_x input_stride_x * number of elements along X processed per workitem(in bytes)
* @param[in,out] input_stride_y Stride of the source tensor in Y dimension (in bytes)
@@ -922,7 +974,7 @@ kernel void fft_radix_2_axis_0(
* @param[in] Ni Nx * Ny.
* @param[in] exp_const Exponent constant
*/
-kernel void fft_radix_2_axis_1(
+__kernel void fft_radix_2_axis_1(
TENSOR3D_DECLARATION(input)
#ifndef IN_PLACE
,
@@ -951,11 +1003,13 @@ kernel void fft_radix_2_axis_1(
#endif /* IN_PLACE */
// Load two complex input values
- float2 c0 = vload2(0, (__global float *)input.ptr);
- float2 c1 = vload2(0, (__global float *)tensor3D_offset(&input, 0, Nx, 0));
+ VEC_DATA_TYPE(DATA_TYPE, 2)
+ c0 = vload2(0, (__global DATA_TYPE *)input.ptr);
+ VEC_DATA_TYPE(DATA_TYPE, 2)
+ c1 = vload2(0, (__global DATA_TYPE *)tensor3D_offset(&input, 0, Nx, 0));
// Compute phi
- float phi = (float)nx * exp_const;
+ DATA_TYPE phi = (DATA_TYPE)nx * (DATA_TYPE)exp_const;
// Multiply by twiddle factor
TWIDDLE_FACTOR_MULTIPLICATION(phi, c1);
@@ -964,15 +1018,15 @@ kernel void fft_radix_2_axis_1(
DFT_2(c0, c1);
// Store two complex output values
- vstore2(c0, 0, (__global float *)output.ptr);
- vstore2(c1, 0, (__global float *)tensor3D_offset(&output, 0, Nx, 0));
+ vstore2(c0, 0, (__global DATA_TYPE *)output.ptr);
+ vstore2(c1, 0, (__global DATA_TYPE *)tensor3D_offset(&output, 0, Nx, 0));
}
/** Computes a stage of a radix-3 FFT on axis 0.
*
* @note In order to perform the FFT function "in-place", the pre-processor -DIN_PLACE must be passed at compile time
*
- * @param[in,out] input_ptr Pointer to the source tensor. Supported data types: F32
+ * @param[in,out] input_ptr Pointer to the source tensor. Supported data types: F16/f32
* @param[in,out] input_stride_x Stride of the source tensor in X dimension (in bytes)
* @param[in,out] input_step_x input_stride_x * number of elements along X processed per workitem(in bytes)
* @param[in,out] input_stride_y Stride of the source tensor in Y dimension (in bytes)
@@ -992,7 +1046,7 @@ kernel void fft_radix_2_axis_1(
* @param[in] Ni Nx * Ny.
* @param[in] exp_const Exponent constant
*/
-kernel void fft_radix_3_axis_0(
+__kernel void fft_radix_3_axis_0(
TENSOR3D_DECLARATION(input)
#ifndef IN_PLACE
,
@@ -1021,12 +1075,15 @@ kernel void fft_radix_3_axis_0(
#endif /* IN_PLACE */
// Load three complex input values
- float2 c0 = vload2(0, (__global float *)input.ptr);
- float2 c1 = vload2(0, (__global float *)tensor3D_offset(&input, Nx, 0, 0));
- float2 c2 = vload2(0, (__global float *)tensor3D_offset(&input, 2 * Nx, 0, 0));
+ VEC_DATA_TYPE(DATA_TYPE, 2)
+ c0 = vload2(0, (__global DATA_TYPE *)input.ptr);
+ VEC_DATA_TYPE(DATA_TYPE, 2)
+ c1 = vload2(0, (__global DATA_TYPE *)tensor3D_offset(&input, Nx, 0, 0));
+ VEC_DATA_TYPE(DATA_TYPE, 2)
+ c2 = vload2(0, (__global DATA_TYPE *)tensor3D_offset(&input, 2 * Nx, 0, 0));
// Compute phi
- float phi = (float)nx * exp_const;
+ DATA_TYPE phi = (DATA_TYPE)nx * (DATA_TYPE)exp_const;
// Multiply by twiddle factor
TWIDDLE_FACTOR_MULTIPLICATION(phi, c1);
@@ -1036,16 +1093,16 @@ kernel void fft_radix_3_axis_0(
DFT_3(c0, c1, c2);
// Store three complex output values
- vstore2(c0, 0, (__global float *)output.ptr);
- vstore2(c1, 0, (__global float *)tensor3D_offset(&output, Nx, 0, 0));
- vstore2(c2, 0, (__global float *)tensor3D_offset(&output, 2 * Nx, 0, 0));
+ vstore2(c0, 0, (__global DATA_TYPE *)output.ptr);
+ vstore2(c1, 0, (__global DATA_TYPE *)tensor3D_offset(&output, Nx, 0, 0));
+ vstore2(c2, 0, (__global DATA_TYPE *)tensor3D_offset(&output, 2 * Nx, 0, 0));
}
/** Computes a stage of a radix-3 FFT on axis 1.
*
* @note In order to perform the FFT function "in-place", the pre-processor -DIN_PLACE must be passed at compile time
*
- * @param[in,out] input_ptr Pointer to the source tensor. Supported data types: F32
+ * @param[in,out] input_ptr Pointer to the source tensor. Supported data types: F16/f32
* @param[in,out] input_stride_x Stride of the source tensor in X dimension (in bytes)
* @param[in,out] input_step_x input_stride_x * number of elements along X processed per workitem(in bytes)
* @param[in,out] input_stride_y Stride of the source tensor in Y dimension (in bytes)
@@ -1065,7 +1122,7 @@ kernel void fft_radix_3_axis_0(
* @param[in] Ni Nx * Ny.
* @param[in] exp_const Exponent constant
*/
-kernel void fft_radix_3_axis_1(
+__kernel void fft_radix_3_axis_1(
TENSOR3D_DECLARATION(input)
#ifndef IN_PLACE
,
@@ -1094,12 +1151,15 @@ kernel void fft_radix_3_axis_1(
#endif /* IN_PLACE */
// Load three complex input values
- float2 c0 = vload2(0, (__global float *)input.ptr);
- float2 c1 = vload2(0, (__global float *)tensor3D_offset(&input, 0, Nx, 0));
- float2 c2 = vload2(0, (__global float *)tensor3D_offset(&input, 0, 2 * Nx, 0));
+ VEC_DATA_TYPE(DATA_TYPE, 2)
+ c0 = vload2(0, (__global DATA_TYPE *)input.ptr);
+ VEC_DATA_TYPE(DATA_TYPE, 2)
+ c1 = vload2(0, (__global DATA_TYPE *)tensor3D_offset(&input, 0, Nx, 0));
+ VEC_DATA_TYPE(DATA_TYPE, 2)
+ c2 = vload2(0, (__global DATA_TYPE *)tensor3D_offset(&input, 0, 2 * Nx, 0));
// Compute phi
- float phi = (float)nx * exp_const;
+ DATA_TYPE phi = (DATA_TYPE)nx * (DATA_TYPE)exp_const;
// Multiply by twiddle factor
TWIDDLE_FACTOR_MULTIPLICATION(phi, c1);
@@ -1109,16 +1169,16 @@ kernel void fft_radix_3_axis_1(
DFT_3(c0, c1, c2);
// Store three complex output values
- vstore2(c0, 0, (__global float *)output.ptr);
- vstore2(c1, 0, (__global float *)tensor3D_offset(&output, 0, Nx, 0));
- vstore2(c2, 0, (__global float *)tensor3D_offset(&output, 0, 2 * Nx, 0));
+ vstore2(c0, 0, (__global DATA_TYPE *)output.ptr);
+ vstore2(c1, 0, (__global DATA_TYPE *)tensor3D_offset(&output, 0, Nx, 0));
+ vstore2(c2, 0, (__global DATA_TYPE *)tensor3D_offset(&output, 0, 2 * Nx, 0));
}
/** Computes a stage of a radix-4 FFT on axis 0.
*
* @note In order to perform the FFT function "in-place", the pre-processor -DIN_PLACE must be passed at compile time
*
- * @param[in,out] input_ptr Pointer to the source tensor. Supported data types: F32
+ * @param[in,out] input_ptr Pointer to the source tensor. Supported data types: F16/f32
* @param[in,out] input_stride_x Stride of the source tensor in X dimension (in bytes)
* @param[in,out] input_step_x input_stride_x * number of elements along X processed per workitem(in bytes)
* @param[in,out] input_stride_y Stride of the source tensor in Y dimension (in bytes)
@@ -1138,7 +1198,7 @@ kernel void fft_radix_3_axis_1(
* @param[in] Ni Nx * Ny.
* @param[in] exp_const Exponent constant
*/
-kernel void fft_radix_4_axis_0(
+__kernel void fft_radix_4_axis_0(
TENSOR3D_DECLARATION(input)
#ifndef IN_PLACE
,
@@ -1167,13 +1227,17 @@ kernel void fft_radix_4_axis_0(
#endif /* IN_PLACE */
// Load four complex input values
- float2 c0 = vload2(0, (__global float *)input.ptr);
- float2 c1 = vload2(0, (__global float *)tensor3D_offset(&input, Nx, 0, 0));
- float2 c2 = vload2(0, (__global float *)tensor3D_offset(&input, 2 * Nx, 0, 0));
- float2 c3 = vload2(0, (__global float *)tensor3D_offset(&input, 3 * Nx, 0, 0));
+ VEC_DATA_TYPE(DATA_TYPE, 2)
+ c0 = vload2(0, (__global DATA_TYPE *)input.ptr);
+ VEC_DATA_TYPE(DATA_TYPE, 2)
+ c1 = vload2(0, (__global DATA_TYPE *)tensor3D_offset(&input, Nx, 0, 0));
+ VEC_DATA_TYPE(DATA_TYPE, 2)
+ c2 = vload2(0, (__global DATA_TYPE *)tensor3D_offset(&input, 2 * Nx, 0, 0));
+ VEC_DATA_TYPE(DATA_TYPE, 2)
+ c3 = vload2(0, (__global DATA_TYPE *)tensor3D_offset(&input, 3 * Nx, 0, 0));
// Compute phi
- float phi = (float)nx * exp_const;
+ DATA_TYPE phi = (DATA_TYPE)nx * (DATA_TYPE)exp_const;
// Multiply by twiddle factor
TWIDDLE_FACTOR_MULTIPLICATION(phi, c1);
@@ -1184,17 +1248,17 @@ kernel void fft_radix_4_axis_0(
DFT_4(c0, c1, c2, c3);
// Store four complex output values
- vstore2(c0, 0, (__global float *)output.ptr);
- vstore2(c1, 0, (__global float *)tensor3D_offset(&output, Nx, 0, 0));
- vstore2(c2, 0, (__global float *)tensor3D_offset(&output, 2 * Nx, 0, 0));
- vstore2(c3, 0, (__global float *)tensor3D_offset(&output, 3 * Nx, 0, 0));
+ vstore2(c0, 0, (__global DATA_TYPE *)output.ptr);
+ vstore2(c1, 0, (__global DATA_TYPE *)tensor3D_offset(&output, Nx, 0, 0));
+ vstore2(c2, 0, (__global DATA_TYPE *)tensor3D_offset(&output, 2 * Nx, 0, 0));
+ vstore2(c3, 0, (__global DATA_TYPE *)tensor3D_offset(&output, 3 * Nx, 0, 0));
}
/** Computes a stage of a radix-4 FFT on axis 1.
*
* @note In order to perform the FFT function "in-place", the pre-processor -DIN_PLACE must be passed at compile time
*
- * @param[in,out] input_ptr Pointer to the source tensor. Supported data types: F32
+ * @param[in,out] input_ptr Pointer to the source tensor. Supported data types: F16/f32
* @param[in,out] input_stride_x Stride of the source tensor in X dimension (in bytes)
* @param[in,out] input_step_x input_stride_x * number of elements along X processed per workitem(in bytes)
* @param[in,out] input_stride_y Stride of the source tensor in Y dimension (in bytes)
@@ -1214,7 +1278,7 @@ kernel void fft_radix_4_axis_0(
* @param[in] Ni Nx * Ny.
* @param[in] exp_const Exponent constant
*/
-kernel void fft_radix_4_axis_1(
+__kernel void fft_radix_4_axis_1(
TENSOR3D_DECLARATION(input)
#ifndef IN_PLACE
,
@@ -1243,13 +1307,17 @@ kernel void fft_radix_4_axis_1(
#endif /* IN_PLACE */
// Load four complex input values
- float2 c0 = vload2(0, (__global float *)input.ptr);
- float2 c1 = vload2(0, (__global float *)tensor3D_offset(&input, 0, Nx, 0));
- float2 c2 = vload2(0, (__global float *)tensor3D_offset(&input, 0, 2 * Nx, 0));
- float2 c3 = vload2(0, (__global float *)tensor3D_offset(&input, 0, 3 * Nx, 0));
+ VEC_DATA_TYPE(DATA_TYPE, 2)
+ c0 = vload2(0, (__global DATA_TYPE *)input.ptr);
+ VEC_DATA_TYPE(DATA_TYPE, 2)
+ c1 = vload2(0, (__global DATA_TYPE *)tensor3D_offset(&input, 0, Nx, 0));
+ VEC_DATA_TYPE(DATA_TYPE, 2)
+ c2 = vload2(0, (__global DATA_TYPE *)tensor3D_offset(&input, 0, 2 * Nx, 0));
+ VEC_DATA_TYPE(DATA_TYPE, 2)
+ c3 = vload2(0, (__global DATA_TYPE *)tensor3D_offset(&input, 0, 3 * Nx, 0));
// Compute phi
- float phi = (float)nx * exp_const;
+ DATA_TYPE phi = (DATA_TYPE)nx * (DATA_TYPE)exp_const;
// Multiply by twiddle factor
TWIDDLE_FACTOR_MULTIPLICATION(phi, c1);
@@ -1260,17 +1328,17 @@ kernel void fft_radix_4_axis_1(
DFT_4(c0, c1, c2, c3);
// Store four complex output values
- vstore2(c0, 0, (__global float *)output.ptr);
- vstore2(c1, 0, (__global float *)tensor3D_offset(&output, 0, Nx, 0));
- vstore2(c2, 0, (__global float *)tensor3D_offset(&output, 0, 2 * Nx, 0));
- vstore2(c3, 0, (__global float *)tensor3D_offset(&output, 0, 3 * Nx, 0));
+ vstore2(c0, 0, (__global DATA_TYPE *)output.ptr);
+ vstore2(c1, 0, (__global DATA_TYPE *)tensor3D_offset(&output, 0, Nx, 0));
+ vstore2(c2, 0, (__global DATA_TYPE *)tensor3D_offset(&output, 0, 2 * Nx, 0));
+ vstore2(c3, 0, (__global DATA_TYPE *)tensor3D_offset(&output, 0, 3 * Nx, 0));
}
/** Computes a stage of a radix-5 FFT on axis 0.
*
* @note In order to perform the FFT function "in-place", the pre-processor -DIN_PLACE must be passed at compile time
*
- * @param[in,out] input_ptr Pointer to the source tensor. Supported data types: F32
+ * @param[in,out] input_ptr Pointer to the source tensor. Supported data types: F16/f32
* @param[in,out] input_stride_x Stride of the source tensor in X dimension (in bytes)
* @param[in,out] input_step_x input_stride_x * number of elements along X processed per workitem(in bytes)
* @param[in,out] input_stride_y Stride of the source tensor in Y dimension (in bytes)
@@ -1290,7 +1358,7 @@ kernel void fft_radix_4_axis_1(
* @param[in] Ni Nx * Ny.
* @param[in] exp_const Exponent constant
*/
-kernel void fft_radix_5_axis_0(
+__kernel void fft_radix_5_axis_0(
TENSOR3D_DECLARATION(input)
#ifndef IN_PLACE
,
@@ -1319,14 +1387,19 @@ kernel void fft_radix_5_axis_0(
#endif /* IN_PLACE */
// Load five complex input values
- float2 c0 = vload2(0, (__global float *)input.ptr);
- float2 c1 = vload2(0, (__global float *)tensor3D_offset(&input, Nx, 0, 0));
- float2 c2 = vload2(0, (__global float *)tensor3D_offset(&input, 2 * Nx, 0, 0));
- float2 c3 = vload2(0, (__global float *)tensor3D_offset(&input, 3 * Nx, 0, 0));
- float2 c4 = vload2(0, (__global float *)tensor3D_offset(&input, 4 * Nx, 0, 0));
+ VEC_DATA_TYPE(DATA_TYPE, 2)
+ c0 = vload2(0, (__global DATA_TYPE *)input.ptr);
+ VEC_DATA_TYPE(DATA_TYPE, 2)
+ c1 = vload2(0, (__global DATA_TYPE *)tensor3D_offset(&input, Nx, 0, 0));
+ VEC_DATA_TYPE(DATA_TYPE, 2)
+ c2 = vload2(0, (__global DATA_TYPE *)tensor3D_offset(&input, 2 * Nx, 0, 0));
+ VEC_DATA_TYPE(DATA_TYPE, 2)
+ c3 = vload2(0, (__global DATA_TYPE *)tensor3D_offset(&input, 3 * Nx, 0, 0));
+ VEC_DATA_TYPE(DATA_TYPE, 2)
+ c4 = vload2(0, (__global DATA_TYPE *)tensor3D_offset(&input, 4 * Nx, 0, 0));
// Compute phi
- float phi = (float)nx * exp_const;
+ DATA_TYPE phi = (DATA_TYPE)nx * (DATA_TYPE)exp_const;
// Multiply by twiddle factor
TWIDDLE_FACTOR_MULTIPLICATION(phi, c1);
@@ -1338,18 +1411,18 @@ kernel void fft_radix_5_axis_0(
DFT_5(c0, c1, c2, c3, c4);
// Store five complex output values
- vstore2(c0, 0, (__global float *)output.ptr);
- vstore2(c1, 0, (__global float *)tensor3D_offset(&output, Nx, 0, 0));
- vstore2(c2, 0, (__global float *)tensor3D_offset(&output, 2 * Nx, 0, 0));
- vstore2(c3, 0, (__global float *)tensor3D_offset(&output, 3 * Nx, 0, 0));
- vstore2(c4, 0, (__global float *)tensor3D_offset(&output, 4 * Nx, 0, 0));
+ vstore2(c0, 0, (__global DATA_TYPE *)output.ptr);
+ vstore2(c1, 0, (__global DATA_TYPE *)tensor3D_offset(&output, Nx, 0, 0));
+ vstore2(c2, 0, (__global DATA_TYPE *)tensor3D_offset(&output, 2 * Nx, 0, 0));
+ vstore2(c3, 0, (__global DATA_TYPE *)tensor3D_offset(&output, 3 * Nx, 0, 0));
+ vstore2(c4, 0, (__global DATA_TYPE *)tensor3D_offset(&output, 4 * Nx, 0, 0));
}
/** Computes a stage of a radix-5 FFT on axis 1.
*
* @note In order to perform the FFT function "in-place", the pre-processor -DIN_PLACE must be passed at compile time
*
- * @param[in,out] input_ptr Pointer to the source tensor. Supported data types: F32
+ * @param[in,out] input_ptr Pointer to the source tensor. Supported data types: F16/f32
* @param[in,out] input_stride_x Stride of the source tensor in X dimension (in bytes)
* @param[in,out] input_step_x input_stride_x * number of elements along X processed per workitem(in bytes)
* @param[in,out] input_stride_y Stride of the source tensor in Y dimension (in bytes)
@@ -1369,7 +1442,7 @@ kernel void fft_radix_5_axis_0(
* @param[in] Ni Nx * Ny.
* @param[in] exp_const Exponent constant
*/
-kernel void fft_radix_5_axis_1(
+__kernel void fft_radix_5_axis_1(
TENSOR3D_DECLARATION(input)
#ifndef IN_PLACE
,
@@ -1398,14 +1471,19 @@ kernel void fft_radix_5_axis_1(
#endif /* IN_PLACE */
// Load five complex input values
- float2 c0 = vload2(0, (__global float *)input.ptr);
- float2 c1 = vload2(0, (__global float *)tensor3D_offset(&input, 0, Nx, 0));
- float2 c2 = vload2(0, (__global float *)tensor3D_offset(&input, 0, 2 * Nx, 0));
- float2 c3 = vload2(0, (__global float *)tensor3D_offset(&input, 0, 3 * Nx, 0));
- float2 c4 = vload2(0, (__global float *)tensor3D_offset(&input, 0, 4 * Nx, 0));
+ VEC_DATA_TYPE(DATA_TYPE, 2)
+ c0 = vload2(0, (__global DATA_TYPE *)input.ptr);
+ VEC_DATA_TYPE(DATA_TYPE, 2)
+ c1 = vload2(0, (__global DATA_TYPE *)tensor3D_offset(&input, 0, Nx, 0));
+ VEC_DATA_TYPE(DATA_TYPE, 2)
+ c2 = vload2(0, (__global DATA_TYPE *)tensor3D_offset(&input, 0, 2 * Nx, 0));
+ VEC_DATA_TYPE(DATA_TYPE, 2)
+ c3 = vload2(0, (__global DATA_TYPE *)tensor3D_offset(&input, 0, 3 * Nx, 0));
+ VEC_DATA_TYPE(DATA_TYPE, 2)
+ c4 = vload2(0, (__global DATA_TYPE *)tensor3D_offset(&input, 0, 4 * Nx, 0));
// Compute phi
- float phi = (float)nx * exp_const;
+ DATA_TYPE phi = (DATA_TYPE)nx * (DATA_TYPE)exp_const;
// Multiply by twiddle factor
TWIDDLE_FACTOR_MULTIPLICATION(phi, c1);
@@ -1417,18 +1495,18 @@ kernel void fft_radix_5_axis_1(
DFT_5(c0, c1, c2, c3, c4);
// Store five complex output values
- vstore2(c0, 0, (__global float *)output.ptr);
- vstore2(c1, 0, (__global float *)tensor3D_offset(&output, 0, Nx, 0));
- vstore2(c2, 0, (__global float *)tensor3D_offset(&output, 0, 2 * Nx, 0));
- vstore2(c3, 0, (__global float *)tensor3D_offset(&output, 0, 3 * Nx, 0));
- vstore2(c4, 0, (__global float *)tensor3D_offset(&output, 0, 4 * Nx, 0));
+ vstore2(c0, 0, (__global DATA_TYPE *)output.ptr);
+ vstore2(c1, 0, (__global DATA_TYPE *)tensor3D_offset(&output, 0, Nx, 0));
+ vstore2(c2, 0, (__global DATA_TYPE *)tensor3D_offset(&output, 0, 2 * Nx, 0));
+ vstore2(c3, 0, (__global DATA_TYPE *)tensor3D_offset(&output, 0, 3 * Nx, 0));
+ vstore2(c4, 0, (__global DATA_TYPE *)tensor3D_offset(&output, 0, 4 * Nx, 0));
}
/** Computes a stage of a radix-7 FFT on axis 0.
*
* @note In order to perform the FFT function "in-place", the pre-processor -DIN_PLACE must be passed at compile time
*
- * @param[in,out] input_ptr Pointer to the source tensor. Supported data types: F32
+ * @param[in,out] input_ptr Pointer to the source tensor. Supported data types: F16/f32
* @param[in,out] input_stride_x Stride of the source tensor in X dimension (in bytes)
* @param[in,out] input_step_x input_stride_x * number of elements along X processed per workitem(in bytes)
* @param[in,out] input_stride_y Stride of the source tensor in Y dimension (in bytes)
@@ -1448,7 +1526,7 @@ kernel void fft_radix_5_axis_1(
* @param[in] Ni Nx * Ny.
* @param[in] exp_const Exponent constant
*/
-kernel void fft_radix_7_axis_0(
+__kernel void fft_radix_7_axis_0(
TENSOR3D_DECLARATION(input)
#ifndef IN_PLACE
,
@@ -1477,16 +1555,23 @@ kernel void fft_radix_7_axis_0(
#endif /* IN_PLACE */
// Load seven complex input values
- float2 c0 = vload2(0, (__global float *)input.ptr);
- float2 c1 = vload2(0, (__global float *)tensor3D_offset(&input, Nx, 0, 0));
- float2 c2 = vload2(0, (__global float *)tensor3D_offset(&input, 2 * Nx, 0, 0));
- float2 c3 = vload2(0, (__global float *)tensor3D_offset(&input, 3 * Nx, 0, 0));
- float2 c4 = vload2(0, (__global float *)tensor3D_offset(&input, 4 * Nx, 0, 0));
- float2 c5 = vload2(0, (__global float *)tensor3D_offset(&input, 5 * Nx, 0, 0));
- float2 c6 = vload2(0, (__global float *)tensor3D_offset(&input, 6 * Nx, 0, 0));
+ VEC_DATA_TYPE(DATA_TYPE, 2)
+ c0 = vload2(0, (__global DATA_TYPE *)input.ptr);
+ VEC_DATA_TYPE(DATA_TYPE, 2)
+ c1 = vload2(0, (__global DATA_TYPE *)tensor3D_offset(&input, Nx, 0, 0));
+ VEC_DATA_TYPE(DATA_TYPE, 2)
+ c2 = vload2(0, (__global DATA_TYPE *)tensor3D_offset(&input, 2 * Nx, 0, 0));
+ VEC_DATA_TYPE(DATA_TYPE, 2)
+ c3 = vload2(0, (__global DATA_TYPE *)tensor3D_offset(&input, 3 * Nx, 0, 0));
+ VEC_DATA_TYPE(DATA_TYPE, 2)
+ c4 = vload2(0, (__global DATA_TYPE *)tensor3D_offset(&input, 4 * Nx, 0, 0));
+ VEC_DATA_TYPE(DATA_TYPE, 2)
+ c5 = vload2(0, (__global DATA_TYPE *)tensor3D_offset(&input, 5 * Nx, 0, 0));
+ VEC_DATA_TYPE(DATA_TYPE, 2)
+ c6 = vload2(0, (__global DATA_TYPE *)tensor3D_offset(&input, 6 * Nx, 0, 0));
// Compute phi
- float phi = (float)nx * exp_const;
+ DATA_TYPE phi = (DATA_TYPE)nx * (DATA_TYPE)exp_const;
// Multiply by twiddle factor
TWIDDLE_FACTOR_MULTIPLICATION(phi, c1);
@@ -1500,20 +1585,20 @@ kernel void fft_radix_7_axis_0(
DFT_7(c0, c1, c2, c3, c4, c5, c6);
// Store seven complex output values
- vstore2(c0, 0, (__global float *)output.ptr);
- vstore2(c1, 0, (__global float *)tensor3D_offset(&output, Nx, 0, 0));
- vstore2(c2, 0, (__global float *)tensor3D_offset(&output, 2 * Nx, 0, 0));
- vstore2(c3, 0, (__global float *)tensor3D_offset(&output, 3 * Nx, 0, 0));
- vstore2(c4, 0, (__global float *)tensor3D_offset(&output, 4 * Nx, 0, 0));
- vstore2(c5, 0, (__global float *)tensor3D_offset(&output, 5 * Nx, 0, 0));
- vstore2(c6, 0, (__global float *)tensor3D_offset(&output, 6 * Nx, 0, 0));
+ vstore2(c0, 0, (__global DATA_TYPE *)output.ptr);
+ vstore2(c1, 0, (__global DATA_TYPE *)tensor3D_offset(&output, Nx, 0, 0));
+ vstore2(c2, 0, (__global DATA_TYPE *)tensor3D_offset(&output, 2 * Nx, 0, 0));
+ vstore2(c3, 0, (__global DATA_TYPE *)tensor3D_offset(&output, 3 * Nx, 0, 0));
+ vstore2(c4, 0, (__global DATA_TYPE *)tensor3D_offset(&output, 4 * Nx, 0, 0));
+ vstore2(c5, 0, (__global DATA_TYPE *)tensor3D_offset(&output, 5 * Nx, 0, 0));
+ vstore2(c6, 0, (__global DATA_TYPE *)tensor3D_offset(&output, 6 * Nx, 0, 0));
}
/** Computes a stage of a radix-7 FFT on axis 1.
*
* @note In order to perform the FFT function "in-place", the pre-processor -DIN_PLACE must be passed at compile time
*
- * @param[in,out] input_ptr Pointer to the source tensor. Supported data types: F32
+ * @param[in,out] input_ptr Pointer to the source tensor. Supported data types: F16/f32
* @param[in,out] input_stride_x Stride of the source tensor in X dimension (in bytes)
* @param[in,out] input_step_x input_stride_x * number of elements along X processed per workitem(in bytes)
* @param[in,out] input_stride_y Stride of the source tensor in Y dimension (in bytes)
@@ -1533,7 +1618,7 @@ kernel void fft_radix_7_axis_0(
* @param[in] Ni Nx * Ny.
* @param[in] exp_const Exponent constant
*/
-kernel void fft_radix_7_axis_1(
+__kernel void fft_radix_7_axis_1(
TENSOR3D_DECLARATION(input)
#ifndef IN_PLACE
,
@@ -1562,16 +1647,23 @@ kernel void fft_radix_7_axis_1(
#endif /* IN_PLACE */
// Load seven complex input values
- float2 c0 = vload2(0, (__global float *)input.ptr);
- float2 c1 = vload2(0, (__global float *)tensor3D_offset(&input, 0, Nx, 0));
- float2 c2 = vload2(0, (__global float *)tensor3D_offset(&input, 0, 2 * Nx, 0));
- float2 c3 = vload2(0, (__global float *)tensor3D_offset(&input, 0, 3 * Nx, 0));
- float2 c4 = vload2(0, (__global float *)tensor3D_offset(&input, 0, 4 * Nx, 0));
- float2 c5 = vload2(0, (__global float *)tensor3D_offset(&input, 0, 5 * Nx, 0));
- float2 c6 = vload2(0, (__global float *)tensor3D_offset(&input, 0, 6 * Nx, 0));
+ VEC_DATA_TYPE(DATA_TYPE, 2)
+ c0 = vload2(0, (__global DATA_TYPE *)input.ptr);
+ VEC_DATA_TYPE(DATA_TYPE, 2)
+ c1 = vload2(0, (__global DATA_TYPE *)tensor3D_offset(&input, 0, Nx, 0));
+ VEC_DATA_TYPE(DATA_TYPE, 2)
+ c2 = vload2(0, (__global DATA_TYPE *)tensor3D_offset(&input, 0, 2 * Nx, 0));
+ VEC_DATA_TYPE(DATA_TYPE, 2)
+ c3 = vload2(0, (__global DATA_TYPE *)tensor3D_offset(&input, 0, 3 * Nx, 0));
+ VEC_DATA_TYPE(DATA_TYPE, 2)
+ c4 = vload2(0, (__global DATA_TYPE *)tensor3D_offset(&input, 0, 4 * Nx, 0));
+ VEC_DATA_TYPE(DATA_TYPE, 2)
+ c5 = vload2(0, (__global DATA_TYPE *)tensor3D_offset(&input, 0, 5 * Nx, 0));
+ VEC_DATA_TYPE(DATA_TYPE, 2)
+ c6 = vload2(0, (__global DATA_TYPE *)tensor3D_offset(&input, 0, 6 * Nx, 0));
// Compute phi
- float phi = (float)nx * exp_const;
+ DATA_TYPE phi = (DATA_TYPE)nx * (DATA_TYPE)exp_const;
// Multiply by twiddle factor
TWIDDLE_FACTOR_MULTIPLICATION(phi, c1);
@@ -1585,20 +1677,20 @@ kernel void fft_radix_7_axis_1(
DFT_7(c0, c1, c2, c3, c4, c5, c6);
// Store seven complex output values
- vstore2(c0, 0, (__global float *)output.ptr);
- vstore2(c1, 0, (__global float *)tensor3D_offset(&output, 0, Nx, 0));
- vstore2(c2, 0, (__global float *)tensor3D_offset(&output, 0, 2 * Nx, 0));
- vstore2(c3, 0, (__global float *)tensor3D_offset(&output, 0, 3 * Nx, 0));
- vstore2(c4, 0, (__global float *)tensor3D_offset(&output, 0, 4 * Nx, 0));
- vstore2(c5, 0, (__global float *)tensor3D_offset(&output, 0, 5 * Nx, 0));
- vstore2(c6, 0, (__global float *)tensor3D_offset(&output, 0, 6 * Nx, 0));
+ vstore2(c0, 0, (__global DATA_TYPE *)output.ptr);
+ vstore2(c1, 0, (__global DATA_TYPE *)tensor3D_offset(&output, 0, Nx, 0));
+ vstore2(c2, 0, (__global DATA_TYPE *)tensor3D_offset(&output, 0, 2 * Nx, 0));
+ vstore2(c3, 0, (__global DATA_TYPE *)tensor3D_offset(&output, 0, 3 * Nx, 0));
+ vstore2(c4, 0, (__global DATA_TYPE *)tensor3D_offset(&output, 0, 4 * Nx, 0));
+ vstore2(c5, 0, (__global DATA_TYPE *)tensor3D_offset(&output, 0, 5 * Nx, 0));
+ vstore2(c6, 0, (__global DATA_TYPE *)tensor3D_offset(&output, 0, 6 * Nx, 0));
}
/** Computes a stage of a radix-8 FFT on axis 0.
*
* @note In order to perform the FFT function "in-place", the pre-processor -DIN_PLACE must be passed at compile time
*
- * @param[in,out] input_ptr Pointer to the source tensor. Supported data types: F32
+ * @param[in,out] input_ptr Pointer to the source tensor. Supported data types: F16/f32
* @param[in,out] input_stride_x Stride of the source tensor in X dimension (in bytes)
* @param[in,out] input_step_x input_stride_x * number of elements along X processed per workitem(in bytes)
* @param[in,out] input_stride_y Stride of the source tensor in Y dimension (in bytes)
@@ -1618,7 +1710,7 @@ kernel void fft_radix_7_axis_1(
* @param[in] Ni Nx * Ny.
* @param[in] exp_const Exponent constant
*/
-kernel void fft_radix_8_axis_0(
+__kernel void fft_radix_8_axis_0(
TENSOR3D_DECLARATION(input)
#ifndef IN_PLACE
,
@@ -1647,17 +1739,25 @@ kernel void fft_radix_8_axis_0(
#endif /* IN_PLACE */
// Load eight complex input values
- float2 c0 = vload2(0, (__global float *)input.ptr);
- float2 c1 = vload2(0, (__global float *)tensor3D_offset(&input, Nx, 0, 0));
- float2 c2 = vload2(0, (__global float *)tensor3D_offset(&input, 2 * Nx, 0, 0));
- float2 c3 = vload2(0, (__global float *)tensor3D_offset(&input, 3 * Nx, 0, 0));
- float2 c4 = vload2(0, (__global float *)tensor3D_offset(&input, 4 * Nx, 0, 0));
- float2 c5 = vload2(0, (__global float *)tensor3D_offset(&input, 5 * Nx, 0, 0));
- float2 c6 = vload2(0, (__global float *)tensor3D_offset(&input, 6 * Nx, 0, 0));
- float2 c7 = vload2(0, (__global float *)tensor3D_offset(&input, 7 * Nx, 0, 0));
+ VEC_DATA_TYPE(DATA_TYPE, 2)
+ c0 = vload2(0, (__global DATA_TYPE *)input.ptr);
+ VEC_DATA_TYPE(DATA_TYPE, 2)
+ c1 = vload2(0, (__global DATA_TYPE *)tensor3D_offset(&input, Nx, 0, 0));
+ VEC_DATA_TYPE(DATA_TYPE, 2)
+ c2 = vload2(0, (__global DATA_TYPE *)tensor3D_offset(&input, 2 * Nx, 0, 0));
+ VEC_DATA_TYPE(DATA_TYPE, 2)
+ c3 = vload2(0, (__global DATA_TYPE *)tensor3D_offset(&input, 3 * Nx, 0, 0));
+ VEC_DATA_TYPE(DATA_TYPE, 2)
+ c4 = vload2(0, (__global DATA_TYPE *)tensor3D_offset(&input, 4 * Nx, 0, 0));
+ VEC_DATA_TYPE(DATA_TYPE, 2)
+ c5 = vload2(0, (__global DATA_TYPE *)tensor3D_offset(&input, 5 * Nx, 0, 0));
+ VEC_DATA_TYPE(DATA_TYPE, 2)
+ c6 = vload2(0, (__global DATA_TYPE *)tensor3D_offset(&input, 6 * Nx, 0, 0));
+ VEC_DATA_TYPE(DATA_TYPE, 2)
+ c7 = vload2(0, (__global DATA_TYPE *)tensor3D_offset(&input, 7 * Nx, 0, 0));
// Compute phi
- float phi = (float)nx * exp_const;
+ DATA_TYPE phi = (DATA_TYPE)nx * (DATA_TYPE)exp_const;
// Multiply by twiddle factor
TWIDDLE_FACTOR_MULTIPLICATION(phi, c1);
@@ -1672,21 +1772,21 @@ kernel void fft_radix_8_axis_0(
DFT_8(c0, c1, c2, c3, c4, c5, c6, c7);
// Store eight complex output values
- vstore2(c0, 0, (__global float *)output.ptr);
- vstore2(c1, 0, (__global float *)tensor3D_offset(&output, Nx, 0, 0));
- vstore2(c2, 0, (__global float *)tensor3D_offset(&output, 2 * Nx, 0, 0));
- vstore2(c3, 0, (__global float *)tensor3D_offset(&output, 3 * Nx, 0, 0));
- vstore2(c4, 0, (__global float *)tensor3D_offset(&output, 4 * Nx, 0, 0));
- vstore2(c5, 0, (__global float *)tensor3D_offset(&output, 5 * Nx, 0, 0));
- vstore2(c6, 0, (__global float *)tensor3D_offset(&output, 6 * Nx, 0, 0));
- vstore2(c7, 0, (__global float *)tensor3D_offset(&output, 7 * Nx, 0, 0));
+ vstore2(c0, 0, (__global DATA_TYPE *)output.ptr);
+ vstore2(c1, 0, (__global DATA_TYPE *)tensor3D_offset(&output, Nx, 0, 0));
+ vstore2(c2, 0, (__global DATA_TYPE *)tensor3D_offset(&output, 2 * Nx, 0, 0));
+ vstore2(c3, 0, (__global DATA_TYPE *)tensor3D_offset(&output, 3 * Nx, 0, 0));
+ vstore2(c4, 0, (__global DATA_TYPE *)tensor3D_offset(&output, 4 * Nx, 0, 0));
+ vstore2(c5, 0, (__global DATA_TYPE *)tensor3D_offset(&output, 5 * Nx, 0, 0));
+ vstore2(c6, 0, (__global DATA_TYPE *)tensor3D_offset(&output, 6 * Nx, 0, 0));
+ vstore2(c7, 0, (__global DATA_TYPE *)tensor3D_offset(&output, 7 * Nx, 0, 0));
}
/** Computes a stage of a radix-8 FFT on axis 1.
*
* @note In order to perform the FFT function "in-place", the pre-processor -DIN_PLACE must be passed at compile time
*
- * @param[in,out] input_ptr Pointer to the source tensor. Supported data types: F32
+ * @param[in,out] input_ptr Pointer to the source tensor. Supported data types: F16/f32
* @param[in,out] input_stride_x Stride of the source tensor in X dimension (in bytes)
* @param[in,out] input_step_x input_stride_x * number of elements along X processed per workitem(in bytes)
* @param[in,out] input_stride_y Stride of the source tensor in Y dimension (in bytes)
@@ -1706,7 +1806,7 @@ kernel void fft_radix_8_axis_0(
* @param[in] Ni Nx * Ny.
* @param[in] exp_const Exponent constant
*/
-kernel void fft_radix_8_axis_1(
+__kernel void fft_radix_8_axis_1(
TENSOR3D_DECLARATION(input)
#ifndef IN_PLACE
,
@@ -1735,17 +1835,25 @@ kernel void fft_radix_8_axis_1(
#endif /* IN_PLACE */
// Load eight complex input values
- float2 c0 = vload2(0, (__global float *)input.ptr);
- float2 c1 = vload2(0, (__global float *)tensor3D_offset(&input, 0, Nx, 0));
- float2 c2 = vload2(0, (__global float *)tensor3D_offset(&input, 0, 2 * Nx, 0));
- float2 c3 = vload2(0, (__global float *)tensor3D_offset(&input, 0, 3 * Nx, 0));
- float2 c4 = vload2(0, (__global float *)tensor3D_offset(&input, 0, 4 * Nx, 0));
- float2 c5 = vload2(0, (__global float *)tensor3D_offset(&input, 0, 5 * Nx, 0));
- float2 c6 = vload2(0, (__global float *)tensor3D_offset(&input, 0, 6 * Nx, 0));
- float2 c7 = vload2(0, (__global float *)tensor3D_offset(&input, 0, 7 * Nx, 0));
+ VEC_DATA_TYPE(DATA_TYPE, 2)
+ c0 = vload2(0, (__global DATA_TYPE *)input.ptr);
+ VEC_DATA_TYPE(DATA_TYPE, 2)
+ c1 = vload2(0, (__global DATA_TYPE *)tensor3D_offset(&input, 0, Nx, 0));
+ VEC_DATA_TYPE(DATA_TYPE, 2)
+ c2 = vload2(0, (__global DATA_TYPE *)tensor3D_offset(&input, 0, 2 * Nx, 0));
+ VEC_DATA_TYPE(DATA_TYPE, 2)
+ c3 = vload2(0, (__global DATA_TYPE *)tensor3D_offset(&input, 0, 3 * Nx, 0));
+ VEC_DATA_TYPE(DATA_TYPE, 2)
+ c4 = vload2(0, (__global DATA_TYPE *)tensor3D_offset(&input, 0, 4 * Nx, 0));
+ VEC_DATA_TYPE(DATA_TYPE, 2)
+ c5 = vload2(0, (__global DATA_TYPE *)tensor3D_offset(&input, 0, 5 * Nx, 0));
+ VEC_DATA_TYPE(DATA_TYPE, 2)
+ c6 = vload2(0, (__global DATA_TYPE *)tensor3D_offset(&input, 0, 6 * Nx, 0));
+ VEC_DATA_TYPE(DATA_TYPE, 2)
+ c7 = vload2(0, (__global DATA_TYPE *)tensor3D_offset(&input, 0, 7 * Nx, 0));
// Compute phi
- float phi = (float)nx * exp_const;
+ DATA_TYPE phi = (DATA_TYPE)nx * (DATA_TYPE)exp_const;
// Multiply by twiddle factor
TWIDDLE_FACTOR_MULTIPLICATION(phi, c1);
@@ -1760,12 +1868,13 @@ kernel void fft_radix_8_axis_1(
DFT_8(c0, c1, c2, c3, c4, c5, c6, c7);
// Store eight complex output values
- vstore2(c0, 0, (__global float *)output.ptr);
- vstore2(c1, 0, (__global float *)tensor3D_offset(&output, 0, Nx, 0));
- vstore2(c2, 0, (__global float *)tensor3D_offset(&output, 0, 2 * Nx, 0));
- vstore2(c3, 0, (__global float *)tensor3D_offset(&output, 0, 3 * Nx, 0));
- vstore2(c4, 0, (__global float *)tensor3D_offset(&output, 0, 4 * Nx, 0));
- vstore2(c5, 0, (__global float *)tensor3D_offset(&output, 0, 5 * Nx, 0));
- vstore2(c6, 0, (__global float *)tensor3D_offset(&output, 0, 6 * Nx, 0));
- vstore2(c7, 0, (__global float *)tensor3D_offset(&output, 0, 7 * Nx, 0));
-} \ No newline at end of file
+ vstore2(c0, 0, (__global DATA_TYPE *)output.ptr);
+ vstore2(c1, 0, (__global DATA_TYPE *)tensor3D_offset(&output, 0, Nx, 0));
+ vstore2(c2, 0, (__global DATA_TYPE *)tensor3D_offset(&output, 0, 2 * Nx, 0));
+ vstore2(c3, 0, (__global DATA_TYPE *)tensor3D_offset(&output, 0, 3 * Nx, 0));
+ vstore2(c4, 0, (__global DATA_TYPE *)tensor3D_offset(&output, 0, 4 * Nx, 0));
+ vstore2(c5, 0, (__global DATA_TYPE *)tensor3D_offset(&output, 0, 5 * Nx, 0));
+ vstore2(c6, 0, (__global DATA_TYPE *)tensor3D_offset(&output, 0, 6 * Nx, 0));
+ vstore2(c7, 0, (__global DATA_TYPE *)tensor3D_offset(&output, 0, 7 * Nx, 0));
+}
+#endif // defined(DATA_TYPE) \ No newline at end of file