Rename ITileOperand and introduce vector/scalar interfaces in CKW

Partially Resolves: COMPMID-5788

This patch
  - renames ITileOperand to TileOperand, which seems to be a more intuitive name for the prospective users of Compute Kernel Writer
  - provides IScalarAccess and IVectorAccess interfaces to be used by Tile classes. It replaces the current IScalarTile and IVectorTile, and forms a more intuitive inheritance hierarchy where each subclass "is a" member of the parent class semantically.

Signed-off-by: Gunes Bayir <gunes.bayir@arm.com>
Change-Id: I2b5253b0595e63f8ff3047c608d593b3b364634d
Reviewed-on: https://review.mlplatform.org/c/ml/ComputeLibrary/+/9910
Reviewed-by: Jakub Sujak <jakub.sujak@arm.com>
Reviewed-by: Viet-Hoa Do <viet-hoa.do@arm.com>
Comments-Addressed: Arm Jenkins <bsgcomp@arm.com>
Benchmark: Arm Jenkins <bsgcomp@arm.com>
Tested-by: Arm Jenkins <bsgcomp@arm.com>
diff --git a/compute_kernel_writer/src/ITile.h b/compute_kernel_writer/src/ITile.h
index c036907..bed4996 100644
--- a/compute_kernel_writer/src/ITile.h
+++ b/compute_kernel_writer/src/ITile.h
@@ -92,12 +92,12 @@
     std::string _basename{ "" };            // Tile name
 };
 
-/** Tile base class to store scalar variables.
+/** Interface to provide support for scalar access for a Tile.
  */
-class IScalarTile : public ITile
+class IScalarAccess
 {
 public:
-    virtual ~IScalarTile() = default;
+    virtual ~IScalarAccess() = default;
 
     /** Method to get the scalar variable from a tile as a string
      * @param[in] row Tile row. If out-of-bound, the row is clamped to the nearest valid edge
@@ -108,12 +108,12 @@
     virtual TileVariable scalar(int32_t row, int32_t col) const = 0;
 };
 
-/** Tile base class to store vector variables. It derives from IScalarTile since we can still access the scalar variable
+/** Interface to provide support for vector access for a tile.
  */
-class IVectorTile : public IScalarTile
+class IVectorAccess
 {
 public:
-    virtual ~IVectorTile() = default;
+    virtual ~IVectorAccess() = default;
 
     /** Method to get the vector variable from a tile.
      *  The user can query the list of supported vector lengths through the supported_vector_lengths() method.
@@ -124,11 +124,11 @@
      */
     virtual TileVariable vector(int32_t row) const = 0;
 
-    /** Method to get a sub-vector variable. The length of the sub-vector must be supported by the derived IVectorTile class
+    /** Method to get a sub-vector variable. The length of the sub-vector must be supported by the derived IVectorAccess class
      *
      * @param[in] row       Tile row. If out-of-bound, the row is clamped to the nearest valid edge
-     * @param[in] col_start Tile starting column to get the sub-vector. If out-of-bound, the derived IVectorTile class may throw an assert.
-     * @param[in] width     The width of the sub-vector. The width must be supported by the derived IVectorTile class and the last element must be in-bound.
+     * @param[in] col_start Tile starting column to get the sub-vector. If out-of-bound, the derived IVectorAccess class may throw an assert.
+     * @param[in] width     The width of the sub-vector. The width must be supported by the derived IVectorAccess class and the last element must be in-bound.
      *
      * @return the vector variable as a @ref TileVariable
      */
diff --git a/compute_kernel_writer/src/KernelWriter.cpp b/compute_kernel_writer/src/KernelWriter.cpp
index ab5ede8..347ae5b 100644
--- a/compute_kernel_writer/src/KernelWriter.cpp
+++ b/compute_kernel_writer/src/KernelWriter.cpp
@@ -23,7 +23,7 @@
  */
 
 #include "ckw/Error.h"
-#include "ckw/ITileOperand.h"
+#include "ckw/TileOperand.h"
 #include "ckw/KernelWriter.h"
 #include "ckw/types/TargetArchitecture.h"
 #include "ckw/types/TargetLanguage.h"
@@ -55,7 +55,7 @@
     return _id_space;
 }
 
-ITileOperand &KernelWriter::add_operand(std::unique_ptr<ITileOperand> &operand_ptr)
+TileOperand &KernelWriter::add_operand(std::unique_ptr<TileOperand> &operand_ptr)
 {
     auto it = _operands.insert(std::move(operand_ptr));
     return *it.first->get();
diff --git a/compute_kernel_writer/src/ITileOperand.cpp b/compute_kernel_writer/src/TileOperand.cpp
similarity index 94%
rename from compute_kernel_writer/src/ITileOperand.cpp
rename to compute_kernel_writer/src/TileOperand.cpp
index 2da7b7a..83914b3 100644
--- a/compute_kernel_writer/src/ITileOperand.cpp
+++ b/compute_kernel_writer/src/TileOperand.cpp
@@ -22,9 +22,9 @@
  * SOFTWARE.
  */
 
-#include "ckw/ITileOperand.h"
+#include "ckw/TileOperand.h"
 
 namespace ckw
 {
-    ITileOperand::~ITileOperand() = default;
+    TileOperand::~TileOperand() = default;
 }
\ No newline at end of file
diff --git a/compute_kernel_writer/src/cl/CLKernelWriter.cpp b/compute_kernel_writer/src/cl/CLKernelWriter.cpp
index 7faf2e6..2f8b1c9 100644
--- a/compute_kernel_writer/src/cl/CLKernelWriter.cpp
+++ b/compute_kernel_writer/src/cl/CLKernelWriter.cpp
@@ -61,7 +61,7 @@
     return _body_source_code;
 }
 
-ITileOperand &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);
 
@@ -78,9 +78,9 @@
     return add_operand(fullname, tile_info);
 }
 
-ITileOperand &CLKernelWriter::add_operand(const std::string &name, const TileInfo &tile_info)
+TileOperand &CLKernelWriter::add_operand(const std::string &name, const TileInfo &tile_info)
 {
-    std::unique_ptr<ITileOperand> operand = std::make_unique<CLTile>(name, tile_info);
+    std::unique_ptr<TileOperand> operand = std::make_unique<CLTile>(name, tile_info);
     return KernelWriter::add_operand(operand);
 }
 
diff --git a/compute_kernel_writer/src/cl/CLKernelWriter.h b/compute_kernel_writer/src/cl/CLKernelWriter.h
index d0c4b7c..5bf7293 100644
--- a/compute_kernel_writer/src/cl/CLKernelWriter.h
+++ b/compute_kernel_writer/src/cl/CLKernelWriter.h
@@ -26,6 +26,7 @@
 #define CKW_SRC_CL_CLKERNELWRITER_H
 
 #include "ckw/KernelWriter.h"
+
 #include <utility>
 
 namespace ckw
@@ -61,7 +62,7 @@
      *
      * Similar to @ref KernelWriter::declare_tile()
     */
-    ITileOperand &declare_tile(const ::std::string &name, const TileInfo &tile_info) override;
+    TileOperand &declare_tile(const ::std::string &name, const TileInfo &tile_info) override;
 
 
 protected:
@@ -84,7 +85,7 @@
     const std::string &body_source_code() const;
 
     /** Add a tile operand to the kernel and return it */
-    ITileOperand &add_operand(const std::string &code, const TileInfo &tile_info) override;
+    TileOperand &add_operand(const std::string &code, const TileInfo &tile_info) override;
 
 private:
     /** This string contains the kernel body source code, not the full CL source code.
diff --git a/compute_kernel_writer/src/cl/CLTile.h b/compute_kernel_writer/src/cl/CLTile.h
index 7e69de8..b9d4bba 100644
--- a/compute_kernel_writer/src/cl/CLTile.h
+++ b/compute_kernel_writer/src/cl/CLTile.h
@@ -26,7 +26,7 @@
 
 #include "src/ITile.h"
 #include "src/cl/ICLTile.h"
-#include "ckw/ITileOperand.h"
+#include "ckw/TileOperand.h"
 
 #include <string>
 
@@ -36,7 +36,7 @@
 class TileInfo;
 
 /** OpenCL specific tile */
-class CLTile : public ICLTile, public ITileOperand
+class CLTile : public ICLTile, public TileOperand
 {
 public:
     /** Constructor
diff --git a/compute_kernel_writer/src/cl/ICLTile.h b/compute_kernel_writer/src/cl/ICLTile.h
index b02bc03..17c44d1 100644
--- a/compute_kernel_writer/src/cl/ICLTile.h
+++ b/compute_kernel_writer/src/cl/ICLTile.h
@@ -32,7 +32,8 @@
 class TileInfo;
 
 /** Interface for the OpenCL specific tile */
-class ICLTile : public IVectorTile
+class ICLTile : public ITile,                              // classes inherited
+                public IVectorAccess, public IScalarAccess // interfaces implemented
 {
 public:
     // Inherited method overridden