diff options
Diffstat (limited to 'compute_kernel_writer/include/ckw')
-rw-r--r-- | compute_kernel_writer/include/ckw/Error.h | 19 | ||||
-rw-r--r-- | compute_kernel_writer/include/ckw/TensorInfo.h | 10 | ||||
-rw-r--r-- | compute_kernel_writer/include/ckw/TileInfo.h | 8 |
3 files changed, 27 insertions, 10 deletions
diff --git a/compute_kernel_writer/include/ckw/Error.h b/compute_kernel_writer/include/ckw/Error.h index 996893823e..2793791802 100644 --- a/compute_kernel_writer/include/ckw/Error.h +++ b/compute_kernel_writer/include/ckw/Error.h @@ -24,8 +24,8 @@ #ifndef COMPUTE_KERNEL_WRITER_INCLUDE_CKW_ERROR_H #define COMPUTE_KERNEL_WRITER_INCLUDE_CKW_ERROR_H -#include <string> #include <stdexcept> +#include <string> namespace ckw { @@ -38,19 +38,20 @@ namespace ckw * * @return status containing the error */ -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); /** Print the given message then throw an std::runtime_error. * * @param[in] msg Message to display. */ -#define COMPUTE_KERNEL_WRITER_ERROR_ON_MSG(msg) \ - do \ - { \ - const std::string arg0(__FILE__); \ - const std::string arg1(__func__); \ - const std::string arg2(std::to_string(__LINE__)); \ - const std::string arg3(msg); \ +#define COMPUTE_KERNEL_WRITER_ERROR_ON_MSG(msg) \ + do \ + { \ + const std::string arg0(__FILE__); \ + const std::string arg1(__func__); \ + const std::string arg2(std::to_string(__LINE__)); \ + const std::string arg3(msg); \ std::runtime_error(create_error_msg(arg0, arg1, arg2, arg3)); \ } while(false) diff --git a/compute_kernel_writer/include/ckw/TensorInfo.h b/compute_kernel_writer/include/ckw/TensorInfo.h index 44846bc94c..41abe60f35 100644 --- a/compute_kernel_writer/include/ckw/TensorInfo.h +++ b/compute_kernel_writer/include/ckw/TensorInfo.h @@ -117,20 +117,28 @@ public: * - less than 0: bind a virtual tensor (tile) */ TensorInfo(DataType dt, const TensorShape &shape, TensorDataLayout dl, int32_t id); + /** Set shape */ TensorInfo &shape(const TensorShape &shape); + /** Get shape */ TensorShape shape() const; + /** Set data type */ TensorInfo &data_type(DataType dt); + /** Get data type */ DataType data_type() const; + /** Set data layout */ TensorInfo &data_layout(TensorDataLayout dl); + /** Get data layout */ TensorDataLayout data_layout() const; + /** Set id */ TensorInfo &id(int32_t id); + /** Get layout */ int32_t id() const; @@ -140,6 +148,6 @@ private: TensorDataLayout _dl{ TensorDataLayout::Unknown }; int32_t _id{ -1 }; }; -} // namespace kw +} // namespace ckw #endif /* COMPUTE_KERNEL_WRITER_INCLUDE_CKW_TENSORINFO_H */ diff --git a/compute_kernel_writer/include/ckw/TileInfo.h b/compute_kernel_writer/include/ckw/TileInfo.h index 86a4b441b7..293a90fb94 100644 --- a/compute_kernel_writer/include/ckw/TileInfo.h +++ b/compute_kernel_writer/include/ckw/TileInfo.h @@ -48,12 +48,14 @@ public: * @param[in] dt Tile data type */ TileInfo(DataType dt); + /** Constructor used to initialize a vector with a given data type and vector length. * * @param[in] dt Tile data type * @param[in] w Tile width (or vector length) */ TileInfo(DataType dt, int32_t w); + /** Constructor used to initialize a tile with a given data type and tile sizes. * * @param[in] dt Tile data type @@ -61,16 +63,22 @@ public: * @param[in] w Tile width */ TileInfo(DataType dt, int32_t h, int32_t w); + /** Set width */ TileInfo &width(int32_t w); + /** Get width */ int32_t width() const; + /** Set height */ TileInfo &height(int32_t h); + /** Get height */ int32_t height() const; + /** Set data type */ TileInfo &data_type(DataType dt); + /** Get data type */ DataType data_type() const; |