aboutsummaryrefslogtreecommitdiff
path: root/arm_compute/core/CL
diff options
context:
space:
mode:
authorGian Marco Iodice <gianmarco.iodice@arm.com>2021-07-06 13:19:41 +0100
committerGeorgios Pinitas <georgios.pinitas@arm.com>2021-07-06 16:38:19 +0000
commit5e281814c5110724d99fe8ee64bdf42ef2c31bce (patch)
tree008a57c80f5b846265b0339f6e3a9f7876fa8922 /arm_compute/core/CL
parent900289936c458eff95499e0a0eaba989a27aaa4d (diff)
downloadComputeLibrary-5e281814c5110724d99fe8ee64bdf42ef2c31bce.tar.gz
Fix manual LOOP_UNROLLING
The issue is caused by the number of iterations passed to LOOP_UNROLLING. When we use the manual LOOP_UNROLLING, the number of iterations must be less than or equal to 128. To overcome this problem, we create a utility function to check if any of the critical iterations (kernel dimensions) are beyond that limit. If so, the utility function, disable the manual loop unrolling. Resolves COMPMID-4609 Change-Id: I7221c967609e462a5abd1cbb74e2a120f344fcb3 Signed-off-by: Gian Marco Iodice <gianmarco.iodice@arm.com> Reviewed-on: https://review.mlplatform.org/c/ml/ComputeLibrary/+/5913 Reviewed-by: Georgios Pinitas <georgios.pinitas@arm.com> Tested-by: Arm Jenkins <bsgcomp@arm.com> Comments-Addressed: Arm Jenkins <bsgcomp@arm.com>
Diffstat (limited to 'arm_compute/core/CL')
-rw-r--r--arm_compute/core/CL/CLHelpers.h13
1 files changed, 13 insertions, 0 deletions
diff --git a/arm_compute/core/CL/CLHelpers.h b/arm_compute/core/CL/CLHelpers.h
index 180211c558..ce7e675b56 100644
--- a/arm_compute/core/CL/CLHelpers.h
+++ b/arm_compute/core/CL/CLHelpers.h
@@ -46,6 +46,9 @@ enum class DataType;
/** Max vector width of an OpenCL vector */
static constexpr unsigned int max_cl_vector_width = 16;
+/** Max number of manual loop unrolling */
+static constexpr int max_manual_loop_unrolling = 128;
+
/** Translates a tensor data type to the appropriate OpenCL type.
*
* @param[in] dt @ref DataType to be translated to OpenCL type.
@@ -244,5 +247,15 @@ void set_wbsm(cl::Kernel &kernel, cl_int wbsm_hint);
*/
bool export_weights_to_cl_image(const ITensorInfo *tensor);
+/* Helper function to force unroll with pragma when any of the input values (iterations) are greater than @ref max_manual_loop_unrolling
+ *
+ * This function passes UNROLL_WITH_PRAGMA at compile time when any of the input values are greater than @ref max_manual_loop_unrolling
+ *
+ * @param[in] built_opts OpenCL kernel build options
+ * @param[in] values Input values (iterations)
+ *
+ */
+void set_unroll_with_pragma(CLBuildOptions &built_opts, std::initializer_list<int> values);
+
} // namespace arm_compute
#endif /* ARM_COMPUTE_CLHELPERS_H */