diff options
author | Viet-Hoa Do <viet-hoa.do@arm.com> | 2023-07-31 17:13:34 +0100 |
---|---|---|
committer | Viet-Hoa Do <viet-hoa.do@arm.com> | 2023-08-22 08:42:23 +0000 |
commit | e1c3b466960d5e3fd5a54871287f5eb6102bfb8c (patch) | |
tree | ca7b46273f564cd96bbb6832fbcd743ce4642301 /compute_kernel_writer/src/cl/CLHelpers.h | |
parent | 47a396e3aae96f2dcad44f4e0d6cb6b87b368395 (diff) | |
download | ComputeLibrary-e1c3b466960d5e3fd5a54871287f5eb6102bfb8c.tar.gz |
Add CKW writing methods for CL unary ops
* Add writing methods for:
- Assignment.
- Cast.
- Unary expression.
* Add corresponding tests.
Partially resolves: COMPMID-6388.
Signed-off-by: Viet-Hoa Do <viet-hoa.do@arm.com>
Change-Id: Ia654173e2e1ee9cddb7819980251e0591934439f
Reviewed-on: https://review.mlplatform.org/c/ml/ComputeLibrary/+/10155
Tested-by: Arm Jenkins <bsgcomp@arm.com>
Reviewed-by: Gunes Bayir <gunes.bayir@arm.com>
Reviewed-by: Jakub Sujak <jakub.sujak@arm.com>
Comments-Addressed: Arm Jenkins <bsgcomp@arm.com>
Benchmark: Arm Jenkins <bsgcomp@arm.com>
Diffstat (limited to 'compute_kernel_writer/src/cl/CLHelpers.h')
-rw-r--r-- | compute_kernel_writer/src/cl/CLHelpers.h | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/compute_kernel_writer/src/cl/CLHelpers.h b/compute_kernel_writer/src/cl/CLHelpers.h index 669424088e..3c1a7724e2 100644 --- a/compute_kernel_writer/src/cl/CLHelpers.h +++ b/compute_kernel_writer/src/cl/CLHelpers.h @@ -24,8 +24,11 @@ #ifndef CKW_SRC_CL_CLHELPERS_H #define CKW_SRC_CL_CLHELPERS_H +#include "ckw/types/Operators.h" + #include <cstdint> #include <string> +#include <tuple> #include <vector> /** OpenCL specific helper functions */ @@ -52,6 +55,24 @@ bool cl_validate_vector_length(int32_t len); */ std::string cl_get_variable_datatype_as_string(DataType dt, int32_t len); +/** Return the assignment operator in OpenCL language. + * + * @param[in] op The assignment operator. + * + * @return The operator in OpenCL language as a string. + */ +std::string cl_get_assignment_op_as_string(AssignmentOp op); + +/** Return the information about the unary operation. + * + * The result contains: + * - is_func: true if it's a function and false if it's an unary operator in OpenCL language. + * - str: the function name or the operator in OpenCL language. + * + * @param[in] op The unary operator. + */ +std::tuple<bool, std::string> cl_get_unary_op(UnaryOp op); + /** Helper function to return the OpenCL vector size that accommodate the the desired width * * @param[in] width The desired width |