aboutsummaryrefslogtreecommitdiff
path: root/compute_kernel_writer/src
diff options
context:
space:
mode:
authorNikolaj Jensen <nikolaj.jensen@arm.com>2023-07-03 09:44:42 +0100
committerNikolaj Jensen <nikolaj.jensen@arm.com>2023-07-07 08:51:11 +0000
commitacea4071a7f457bab696dc3c895ba47d60345541 (patch)
tree66a5f659f995ea110bcb8e217dc6a94e1f7ac47d /compute_kernel_writer/src
parente86f992d26a79cad76244c4444d113e45afa9b88 (diff)
downloadComputeLibrary-acea4071a7f457bab696dc3c895ba47d60345541.tar.gz
Fix code formatting in CKW
Signed-off-by: Nikolaj Jensen <nikolaj.jensen@arm.com> Change-Id: I8064b345c1efd243f8bded12ed5d561afe7c339a Reviewed-on: https://review.mlplatform.org/c/ml/ComputeLibrary/+/9854 Benchmark: Arm Jenkins <bsgcomp@arm.com> Tested-by: Arm Jenkins <bsgcomp@arm.com> Reviewed-by: Jakub Sujak <jakub.sujak@arm.com> Comments-Addressed: Arm Jenkins <bsgcomp@arm.com>
Diffstat (limited to 'compute_kernel_writer/src')
-rw-r--r--compute_kernel_writer/src/Error.cpp3
-rw-r--r--compute_kernel_writer/src/Helpers.h4
-rw-r--r--compute_kernel_writer/src/ITile.h20
-rw-r--r--compute_kernel_writer/src/TensorUtils.h2
-rw-r--r--compute_kernel_writer/src/TileInfo.cpp6
-rw-r--r--compute_kernel_writer/src/cl/CLConstantTile.cpp2
-rw-r--r--compute_kernel_writer/src/cl/CLConstantTile.h6
-rw-r--r--compute_kernel_writer/src/cl/CLTile.cpp5
-rw-r--r--compute_kernel_writer/src/cl/CLTile.h6
-rw-r--r--compute_kernel_writer/src/cl/ICLTile.cpp2
10 files changed, 36 insertions, 20 deletions
diff --git a/compute_kernel_writer/src/Error.cpp b/compute_kernel_writer/src/Error.cpp
index 7f2fb41187..c5dae2eb75 100644
--- a/compute_kernel_writer/src/Error.cpp
+++ b/compute_kernel_writer/src/Error.cpp
@@ -28,7 +28,8 @@
namespace ckw
{
-std::string create_error_msg(const std::string &file, const std::string &func, const std::string &line, const std::string &msg)
+std::string create_error_msg(const std::string &file, const std::string &func, const std::string &line,
+ const std::string &msg)
{
std::string err;
err += "[COMPUTE_KERNEL_WRITER][ERROR]:";
diff --git a/compute_kernel_writer/src/Helpers.h b/compute_kernel_writer/src/Helpers.h
index f7ba7cec1c..16c06d60e7 100644
--- a/compute_kernel_writer/src/Helpers.h
+++ b/compute_kernel_writer/src/Helpers.h
@@ -48,9 +48,9 @@ std::string dec_to_hex_as_string(int32_t dec);
* @return the clamped value
*/
template <typename T>
-T clamp(const T& val, const T& min_val, const T& max_val)
+T clamp(const T &val, const T &min_val, const T &max_val)
{
return std::max(min_val, std::min(val, max_val));
}
-}
+} // namespace ckw
#endif /* COMPUTE_KERNEL_WRITER_SRC_HELPERS_H */
diff --git a/compute_kernel_writer/src/ITile.h b/compute_kernel_writer/src/ITile.h
index ef0df2116a..c036907561 100644
--- a/compute_kernel_writer/src/ITile.h
+++ b/compute_kernel_writer/src/ITile.h
@@ -37,15 +37,15 @@ using TileContainer = std::vector<std::vector<std::string>>;
/** Tile descriptor which reports the underlying datatype and vector length */
struct TileVariableDescriptor
{
- DataType dt { DataType::Unknown }; /** Data type */
- int32_t len { 1 }; /** Number of elements in a single variable. For example, 1 for scalar */
+ DataType dt{ DataType::Unknown }; /** Data type */
+ int32_t len{ 1 }; /** Number of elements in a single variable. For example, 1 for scalar */
};
/** Tile variable */
struct TileVariable
{
- std::string str {""}; /** Tile variable as a string */
- TileVariableDescriptor desc {}; /** Tile value descriptor which reports the datatype and vector length */
+ std::string str{ "" }; /** Tile variable as a string */
+ TileVariableDescriptor desc{}; /** Tile value descriptor which reports the datatype and vector length */
};
/** Tile base class.
@@ -55,11 +55,13 @@ class ITile
{
public:
virtual ~ITile() = default;
+
/** Method to get all TileVariable objects
*
* @return a vector containing all @ref TileVariable objects
*/
virtual std::vector<TileVariable> all() const = 0;
+
/** Method to get the name of the tile.
*
* @return the name of the tile
@@ -68,6 +70,7 @@ public:
{
return _basename;
}
+
/** Method to get the tile info
*
* @return the @ref TileInfo
@@ -76,6 +79,7 @@ public:
{
return _info;
}
+
/** Method to know whether the tile is assignable or not.
* For example, a constant tile is not assignable.
*
@@ -84,8 +88,8 @@ public:
virtual bool is_assignable() const = 0;
protected:
- TileInfo _info { DataType::Unknown }; // Tile info
- std::string _basename { "" }; // Tile name
+ TileInfo _info{ DataType::Unknown }; // Tile info
+ std::string _basename{ "" }; // Tile name
};
/** Tile base class to store scalar variables.
@@ -94,6 +98,7 @@ class IScalarTile : public ITile
{
public:
virtual ~IScalarTile() = 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
* @param[in] col Tile column. If out-of-bound, the column is clamped to the nearest valid edge
@@ -109,6 +114,7 @@ class IVectorTile : public IScalarTile
{
public:
virtual ~IVectorTile() = 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.
*
@@ -117,6 +123,7 @@ public:
* @return the vector variable as a @ref TileVariable
*/
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
*
* @param[in] row Tile row. If out-of-bound, the row is clamped to the nearest valid edge
@@ -126,6 +133,7 @@ public:
* @return the vector variable as a @ref TileVariable
*/
virtual TileVariable vector(int32_t row, int32_t col_start, int32_t width) const = 0;
+
/** Method to get the supported vector length.
*
* @return a vector containing the supported vector lengths
diff --git a/compute_kernel_writer/src/TensorUtils.h b/compute_kernel_writer/src/TensorUtils.h
index 4be0395435..84eca084bb 100644
--- a/compute_kernel_writer/src/TensorUtils.h
+++ b/compute_kernel_writer/src/TensorUtils.h
@@ -52,5 +52,5 @@ TensorComponent get_tensor_dimension(TensorDataLayout layout, TensorDataLayoutCo
* @return the @ref TensorComponent
*/
TensorComponent get_tensor_stride(TensorDataLayout layout, TensorDataLayoutComponent component);
-}
+} // namespace ckw
#endif /* COMPUTE_KERNEL_WRITER_SRC_TENSORUTILS_H */
diff --git a/compute_kernel_writer/src/TileInfo.cpp b/compute_kernel_writer/src/TileInfo.cpp
index 7d8b2654ef..66d8cb1620 100644
--- a/compute_kernel_writer/src/TileInfo.cpp
+++ b/compute_kernel_writer/src/TileInfo.cpp
@@ -27,17 +27,17 @@
namespace ckw
{
TileInfo::TileInfo(DataType dt)
- : _dt(dt), _shape({{1, 1}})
+ : _dt(dt), _shape({ { 1, 1 } })
{
}
TileInfo::TileInfo(DataType dt, int32_t w)
- : _dt(dt), _shape({{w, 1}})
+ : _dt(dt), _shape({ { w, 1 } })
{
}
TileInfo::TileInfo(DataType dt, int32_t h, int32_t w)
- : _dt(dt), _shape({{w, h}})
+ : _dt(dt), _shape({ { w, h } })
{
}
diff --git a/compute_kernel_writer/src/cl/CLConstantTile.cpp b/compute_kernel_writer/src/cl/CLConstantTile.cpp
index 1477a683e6..e2acffb99b 100644
--- a/compute_kernel_writer/src/cl/CLConstantTile.cpp
+++ b/compute_kernel_writer/src/cl/CLConstantTile.cpp
@@ -25,8 +25,8 @@
#include "ckw/TileInfo.h"
#include "src/Helpers.h"
-#include "src/cl/CLHelpers.h"
#include "src/cl/CLConstantTile.h"
+#include "src/cl/CLHelpers.h"
namespace ckw
{
diff --git a/compute_kernel_writer/src/cl/CLConstantTile.h b/compute_kernel_writer/src/cl/CLConstantTile.h
index ebd0f04659..c8318487e6 100644
--- a/compute_kernel_writer/src/cl/CLConstantTile.h
+++ b/compute_kernel_writer/src/cl/CLConstantTile.h
@@ -48,13 +48,17 @@ public:
// Inherited method overridden
TileVariable scalar(int32_t row, int32_t col) const override;
+
TileVariable vector(int32_t row) const override;
+
TileVariable vector(int32_t row, int32_t col_start, int32_t width) const override;
+
std::vector<TileVariable> all() const override;
+
bool is_assignable() const override;
private:
- TileContainer _vals {};
+ TileContainer _vals{};
};
} // namespace ckw
diff --git a/compute_kernel_writer/src/cl/CLTile.cpp b/compute_kernel_writer/src/cl/CLTile.cpp
index bc544ecedf..cb0b22a23b 100644
--- a/compute_kernel_writer/src/cl/CLTile.cpp
+++ b/compute_kernel_writer/src/cl/CLTile.cpp
@@ -68,7 +68,7 @@ TileVariable CLTile::vector(int32_t row) const
row = clamp(row, static_cast<int32_t>(0), _info.height() - 1);
TileVariable t;
- t.str = create_var_name(row);
+ t.str = create_var_name(row);
t.desc.dt = _info.data_type();
t.desc.len = _info.width();
return t;
@@ -104,7 +104,7 @@ std::vector<TileVariable> CLTile::all() const
for(int32_t y = 0; y < _info.height(); ++y)
{
TileVariable t;
- t.str = create_var_name(y);
+ t.str = create_var_name(y);
t.desc.dt = _info.data_type();
t.desc.len = _info.width();
vars.push_back(t);
@@ -125,7 +125,6 @@ std::string CLTile::create_var_name(int32_t row) const
if(_info.height() == 1)
{
return var_name;
-
}
else
{
diff --git a/compute_kernel_writer/src/cl/CLTile.h b/compute_kernel_writer/src/cl/CLTile.h
index 285f0b6e58..039bd5613f 100644
--- a/compute_kernel_writer/src/cl/CLTile.h
+++ b/compute_kernel_writer/src/cl/CLTile.h
@@ -44,13 +44,17 @@ public:
* @param[in] name Tile name
* @param[in] info Tile info
*/
- CLTile(const std::string& name, const TileInfo &info);
+ CLTile(const std::string &name, const TileInfo &info);
// Inherited method overridden
TileVariable scalar(int32_t row, int32_t col) const override;
+
TileVariable vector(int32_t row) const override;
+
TileVariable vector(int32_t row, int32_t col_start, int32_t width) const override;
+
std::vector<TileVariable> all() const override;
+
bool is_assignable() const override;
private:
diff --git a/compute_kernel_writer/src/cl/ICLTile.cpp b/compute_kernel_writer/src/cl/ICLTile.cpp
index f9c8827ef4..38418b5c2a 100644
--- a/compute_kernel_writer/src/cl/ICLTile.cpp
+++ b/compute_kernel_writer/src/cl/ICLTile.cpp
@@ -33,7 +33,7 @@ namespace ckw
{
std::vector<int32_t> ICLTile::supported_vector_lengths() const
{
- return std::vector<int32_t> {1, 2, 3, 4, 8, 16};
+ return std::vector<int32_t>{ 1, 2, 3, 4, 8, 16 };
}
void ICLTile::validate_tile_info(const TileInfo &info) const