aboutsummaryrefslogtreecommitdiff
path: root/compute_kernel_writer
diff options
context:
space:
mode:
authorAdnan AlSinan <adnan.alsinan@arm.com>2023-07-10 15:07:45 +0100
committerSiCong Li <sicong.li@arm.com>2023-07-14 15:06:16 +0000
commit66f3d380cacb154748fdb2ac827da2377a2d1910 (patch)
treef7156ab390cd6e8a7d15b4403cca04542f1da1d5 /compute_kernel_writer
parent4184e86508c3b1a744e9687d1112ba5f65f55eeb (diff)
downloadComputeLibrary-66f3d380cacb154748fdb2ac827da2377a2d1910.tar.gz
Port ClTemplateCast into Ckw
Resolves COMPMID-6257 Signed-off-by: Adnan AlSinan <adnan.alsinan@arm.com> Change-Id: I3e56ff1f1109924da02d0abd0354a3f1fa095ee7 Reviewed-on: https://review.mlplatform.org/c/ml/ComputeLibrary/+/9914 Tested-by: Arm Jenkins <bsgcomp@arm.com> Reviewed-by: Nikolaj Jensen <nikolaj.jensen@arm.com> Comments-Addressed: Arm Jenkins <bsgcomp@arm.com> Benchmark: Arm Jenkins <bsgcomp@arm.com>
Diffstat (limited to 'compute_kernel_writer')
-rw-r--r--compute_kernel_writer/prototype/include/ckw/types/Operators.h3
-rw-r--r--compute_kernel_writer/prototype/src/Prototype.h8
2 files changed, 9 insertions, 2 deletions
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)