From 66f3d380cacb154748fdb2ac827da2377a2d1910 Mon Sep 17 00:00:00 2001 From: Adnan AlSinan Date: Mon, 10 Jul 2023 15:07:45 +0100 Subject: Port ClTemplateCast into Ckw Resolves COMPMID-6257 Signed-off-by: Adnan AlSinan Change-Id: I3e56ff1f1109924da02d0abd0354a3f1fa095ee7 Reviewed-on: https://review.mlplatform.org/c/ml/ComputeLibrary/+/9914 Tested-by: Arm Jenkins Reviewed-by: Nikolaj Jensen Comments-Addressed: Arm Jenkins Benchmark: Arm Jenkins --- compute_kernel_writer/prototype/include/ckw/types/Operators.h | 3 +++ compute_kernel_writer/prototype/src/Prototype.h | 8 ++++++-- 2 files changed, 9 insertions(+), 2 deletions(-) (limited to 'compute_kernel_writer') diff --git a/compute_kernel_writer/prototype/include/ckw/types/Operators.h b/compute_kernel_writer/prototype/include/ckw/types/Operators.h index 78027f1ed5..172650d5ae 100644 --- a/compute_kernel_writer/prototype/include/ckw/types/Operators.h +++ b/compute_kernel_writer/prototype/include/ckw/types/Operators.h @@ -33,6 +33,7 @@ namespace ckw enum class UnaryOp : int32_t { LogicalNot = 0x0000, // ! + BitwiseNot = 0x0001, // ~ }; /* Binary operations @@ -60,6 +61,8 @@ enum class BinaryOp : int32_t // Logical LogicalAnd = 0x3000, // && LogicalOr = 0x3001, // || + // Bitwise + BitwiseXOR = 0x4000, // ^ }; enum class AssignmentOp : int32_t diff --git a/compute_kernel_writer/prototype/src/Prototype.h b/compute_kernel_writer/prototype/src/Prototype.h index b9f1efa542..72fa419fc2 100644 --- a/compute_kernel_writer/prototype/src/Prototype.h +++ b/compute_kernel_writer/prototype/src/Prototype.h @@ -1581,6 +1581,8 @@ inline std::string to_string(UnaryOp op) { case UnaryOp::LogicalNot: return "!"; + case UnaryOp::BitwiseNot: + return "~"; default: assert(false); return ""; @@ -1615,6 +1617,8 @@ inline std::string to_string(BinaryOp op) return "&&"; case BinaryOp::LogicalOr: return "||"; + case BinaryOp::BitwiseXOR: + return "^"; default: assert(false); return ""; @@ -3570,11 +3574,11 @@ public: OperandUnpacker operands(_data->tiles, _data->arguments); const IVectorTile *src = operands.unpack(o_src); const IVectorTile *dst = operands.unpack(o_dst); - // const int32_t dst_w = dst->format().w; const int32_t dst_h = dst->format().h; const std::string dt = dst->underlying_source_variables()[0].type.str; - const std::string sat = (policy == ConvertPolicy::Saturate ? "_sat" : ""); + const bool is_float = (dst->format().dt == DataType::Fp32) || (dst->format().dt == DataType::Fp16); + const std::string sat = ((policy == ConvertPolicy::Saturate && !is_float) ? "_sat" : ""); // Broadcasting on Y is automatic for(int32_t y = 0; y < dst_h; ++y) -- cgit v1.2.1