From 98901e44d15864cb0c7ccd5febb60491569915f0 Mon Sep 17 00:00:00 2001 From: Viet-Hoa Do Date: Wed, 30 Aug 2023 10:12:22 +0100 Subject: Minor fixes in CKW * Address some outstanding issues from previous commits. Resolves: COMPMID-6387 Signed-off-by: Viet-Hoa Do Change-Id: Iab504c20e9b30601b8745c092259a74ccfedf804 Reviewed-on: https://review.mlplatform.org/c/ml/ComputeLibrary/+/10215 Benchmark: Arm Jenkins Tested-by: Arm Jenkins Reviewed-by: Gunes Bayir Comments-Addressed: Arm Jenkins --- compute_kernel_writer/src/cl/CLKernelWriter.cpp | 18 +++++++++--------- compute_kernel_writer/src/cl/CLKernelWriter.h | 12 ++++++------ 2 files changed, 15 insertions(+), 15 deletions(-) (limited to 'compute_kernel_writer') diff --git a/compute_kernel_writer/src/cl/CLKernelWriter.cpp b/compute_kernel_writer/src/cl/CLKernelWriter.cpp index c64b7415ff..4284388c0b 100644 --- a/compute_kernel_writer/src/cl/CLKernelWriter.cpp +++ b/compute_kernel_writer/src/cl/CLKernelWriter.cpp @@ -314,7 +314,7 @@ void CLKernelWriter::op_ternary(const TileOperand &dst, TernaryOp op, const Tile } } -void CLKernelWriter::op_if_generic(bool is_else, const TileOperand &lhs, BinaryOp op, const TileOperand &rhs, const std::function &body) +void CLKernelWriter::op_if_generic(const TileOperand &lhs, BinaryOp op, const TileOperand &rhs, const std::function &body, bool is_else_if) { const auto &lhs_tile = to_cl_tile(lhs); const auto &rhs_tile = to_cl_tile(rhs); @@ -325,7 +325,7 @@ void CLKernelWriter::op_if_generic(bool is_else, const TileOperand &lhs, BinaryO CKW_ASSERT(lhs_tile.is_scalar()); CKW_ASSERT(rhs_tile.is_scalar()); - if(is_else) + if(is_else_if) { append_code("else "); } @@ -337,12 +337,12 @@ void CLKernelWriter::op_if_generic(bool is_else, const TileOperand &lhs, BinaryO void CLKernelWriter::op_if(const TileOperand &lhs, BinaryOp op, const TileOperand &rhs, const std::function &body) { - op_if_generic(false, lhs, op, rhs, body); + op_if_generic(lhs, op, rhs, body, false /* is_else_if */); } void CLKernelWriter::op_else_if(const TileOperand &lhs, BinaryOp op, const TileOperand &rhs, const std::function &body) { - op_if_generic(true, lhs, op, rhs, body); + op_if_generic(lhs, op, rhs, body, true /* is_else_if */); } void CLKernelWriter::op_else(const std::function &body) @@ -453,7 +453,7 @@ TileOperand CLKernelWriter::declare_tile(const std::string &name, const TileInfo TileOperand CLKernelWriter::declare_constant_tile(const ConstantData &data) { - auto tile = std::make_unique(get_values(data), get_data_type(data)); + auto tile = std::make_unique(get_values(data), get_data_type(data)); const TileOperand operand = create_tile_operand(*tile); _constant_tiles.insert(std::move(tile)); @@ -525,8 +525,8 @@ const CLTile &CLKernelWriter::to_cl_tile(const TileOperand &operand) const void CLKernelWriter::op_load(const TileOperand &tile_op, const TensorOperand &tensor_op, TensorSampler &sampler, const TileOperand &x, const TileOperand &y, const TileOperand &z, const TileOperand &batch) { - const CLTile dilation_x({{"1"}}, DataType::Int32); - const CLTile dilation_y({{"1"}}, DataType::Int32); + const CLTile dilation_x({ { "1" } }, DataType::Int32); + const CLTile dilation_y({ { "1" } }, DataType::Int32); op_load_store(MemoryOperation::Load, tile_op, tensor_op, sampler, x, y, z, batch, dilation_x, dilation_y); } @@ -544,8 +544,8 @@ void CLKernelWriter::op_load_dilated(const TileOperand &tile_op, const TensorOpe void CLKernelWriter::op_store(const TensorOperand &tensor_op, const TileOperand &tile_op, TensorSampler &sampler, const TileOperand &x, const TileOperand &y, const TileOperand &z, const TileOperand &batch) { - const CLTile dilation_x({{"1"}}, DataType::Int32); - const CLTile dilation_y({{"1"}}, DataType::Int32); + const CLTile dilation_x({ { "1" } }, DataType::Int32); + const CLTile dilation_y({ { "1" } }, DataType::Int32); op_load_store(MemoryOperation::Store, tile_op, tensor_op, sampler, x, y, z, batch, dilation_x, dilation_y); } diff --git a/compute_kernel_writer/src/cl/CLKernelWriter.h b/compute_kernel_writer/src/cl/CLKernelWriter.h index 9fc7e550a7..9458ced916 100644 --- a/compute_kernel_writer/src/cl/CLKernelWriter.h +++ b/compute_kernel_writer/src/cl/CLKernelWriter.h @@ -198,13 +198,13 @@ private: * * It is used for both @ref CLKernelWriter::op_if and @ref CLKernelWriter::op_else_if. * - * @param[in] is_else True if this is an `else if` block, otherwise this is an `if` block. - * @param[in] lhs The LHS tile of the condition. - * @param[in] op The relational binary operator. - * @param[in] rhs The RHS tile of the condition. - * @param[in] body The function that writes the body of the else-if block. + * @param[in] lhs The LHS tile of the condition. + * @param[in] op The relational binary operator. + * @param[in] rhs The RHS tile of the condition. + * @param[in] body The function that writes the body of the else-if block. + * @param[in] is_else_if True if this is an `else if` block, otherwise this is an `if` block. */ - void op_if_generic(bool is_else, const TileOperand &lhs, BinaryOp op, const TileOperand &rhs, const std::function &body); + void op_if_generic(const TileOperand &lhs, BinaryOp op, const TileOperand &rhs, const std::function &body, bool is_else_if); // For attributes private: -- cgit v1.2.1