aboutsummaryrefslogtreecommitdiff
path: root/compute_kernel_writer/src/cl/CLKernelWriter.cpp
diff options
context:
space:
mode:
authorViet-Hoa Do <viet-hoa.do@arm.com>2023-07-20 17:31:47 +0100
committerViet-Hoa Do <viet-hoa.do@arm.com>2023-07-21 13:33:12 +0000
commit25d26f4d86042e0ca52ac1bef4039b187f77b5b3 (patch)
tree9a4ee7d5173883a2c67a68689d591efd746f2b5f /compute_kernel_writer/src/cl/CLKernelWriter.cpp
parent8dfb8820d5fe0f72a923eccc3bb73ee0b87d5511 (diff)
downloadComputeLibrary-25d26f4d86042e0ca52ac1bef4039b187f77b5b3.tar.gz
Change TileOperand to a view of a tile object
* TileOperand instead of being the tile object now is only a view of a tile object. - declare_tile now returns a TileOperand object, not a reference to a TileOperand object. - This is to prepare for the posibility that the users need to perform operations on part of a tile (e.g. a scalar value, a vector, a sub-tile). Partially resolves: COMPMID-6391 Signed-off-by: Viet-Hoa Do <viet-hoa.do@arm.com> Change-Id: I35c08b22a384a756d99dcd04cbe66fc57bd548d2 Reviewed-on: https://review.mlplatform.org/c/ml/ComputeLibrary/+/9958 Reviewed-by: Gunes Bayir <gunes.bayir@arm.com> Comments-Addressed: Arm Jenkins <bsgcomp@arm.com> Tested-by: Arm Jenkins <bsgcomp@arm.com> Benchmark: Arm Jenkins <bsgcomp@arm.com>
Diffstat (limited to 'compute_kernel_writer/src/cl/CLKernelWriter.cpp')
-rw-r--r--compute_kernel_writer/src/cl/CLKernelWriter.cpp22
1 files changed, 11 insertions, 11 deletions
diff --git a/compute_kernel_writer/src/cl/CLKernelWriter.cpp b/compute_kernel_writer/src/cl/CLKernelWriter.cpp
index 2f8b1c95ce..bc056c67a2 100644
--- a/compute_kernel_writer/src/cl/CLKernelWriter.cpp
+++ b/compute_kernel_writer/src/cl/CLKernelWriter.cpp
@@ -24,14 +24,15 @@
#include "src/cl/CLKernelWriter.h"
#include "ckw/Error.h"
-#include "src/cl/CLTile.h"
+#include "ckw/TileOperand.h"
#include "src/cl/CLHelpers.h"
+#include "src/cl/CLTile.h"
#include <cstdint>
namespace ckw
{
-CLKernelWriter::CLKernelWriter() = default;
+CLKernelWriter::CLKernelWriter() = default;
CLKernelWriter::~CLKernelWriter() = default;
std::unique_ptr<Kernel> CLKernelWriter::emit_kernel(const std::string &name)
@@ -61,12 +62,12 @@ const std::string &CLKernelWriter::body_source_code() const
return _body_source_code;
}
-TileOperand &CLKernelWriter::declare_tile(const std::string &name, const TileInfo &tile_info)
+TileOperand CLKernelWriter::declare_tile(const std::string &name, const TileInfo &tile_info)
{
const std::string fullname = generate_full_name(name);
- const int32_t height = tile_info.height();
- const int32_t width = tile_info.width();
+ const int32_t height = tile_info.height();
+ const int32_t width = tile_info.width();
const DataType data_type = tile_info.data_type();
for(int32_t row = 0; row < height; ++row)
@@ -75,13 +76,12 @@ TileOperand &CLKernelWriter::declare_tile(const std::string &name, const TileInf
append_code(cl_type, " ", fullname, std::to_string(row), ";\n");
}
- return add_operand(fullname, tile_info);
-}
+ auto tile = std::make_unique<CLTile>(name, tile_info);
+ const auto operand = create_tile_operand(*tile);
-TileOperand &CLKernelWriter::add_operand(const std::string &name, const TileInfo &tile_info)
-{
- std::unique_ptr<TileOperand> operand = std::make_unique<CLTile>(name, tile_info);
- return KernelWriter::add_operand(operand);
+ _tiles.insert(std::move(tile));
+
+ return operand;
}
} // namespace ckw