diff options
author | Gunes Bayir <gunes.bayir@arm.com> | 2023-07-11 14:57:36 +0100 |
---|---|---|
committer | Gunes Bayir <gunes.bayir@arm.com> | 2023-07-12 10:09:19 +0000 |
commit | ab0b75054ca3ddd62cff34518f331aa8474daa5a (patch) | |
tree | bf23ec6a1baee5b7359af1b91fb4b3a462760e2f /compute_kernel_writer/include/ckw/KernelWriter.h | |
parent | 653b96c9a72b2b6d4d82d6ee67b51be66351c617 (diff) | |
download | ComputeLibrary-ab0b75054ca3ddd62cff34518f331aa8474daa5a.tar.gz |
Add tile declaration capability in KernelWriter
Resolves: COMPMID-5816
Signed-off-by: Gunes Bayir <gunes.bayir@arm.com>
Change-Id: Ibd885707a842550a058252f9d01e072129896055
Reviewed-on: https://review.mlplatform.org/c/ml/ComputeLibrary/+/9901
Tested-by: Arm Jenkins <bsgcomp@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>
Diffstat (limited to 'compute_kernel_writer/include/ckw/KernelWriter.h')
-rw-r--r-- | compute_kernel_writer/include/ckw/KernelWriter.h | 36 |
1 files changed, 34 insertions, 2 deletions
diff --git a/compute_kernel_writer/include/ckw/KernelWriter.h b/compute_kernel_writer/include/ckw/KernelWriter.h index ba8a6015e6..f1635c6449 100644 --- a/compute_kernel_writer/include/ckw/KernelWriter.h +++ b/compute_kernel_writer/include/ckw/KernelWriter.h @@ -25,9 +25,10 @@ #ifndef CKW_INCLUDE_CKW_KERNELWRITER_H #define CKW_INCLUDE_CKW_KERNELWRITER_H -#include "ckw/types/TargetArchitecture.h" -#include "ckw/types/TargetLanguage.h" +#include "ckw/ITileOperand.h" + #include <memory> +#include <set> #include <string> namespace ckw @@ -35,6 +36,11 @@ namespace ckw class Kernel; +/** Forward Declerations */ +class TileInfo; +enum class TargetArchitecture; +enum class TargetLanguage; + /** A kernel writer. * * This class is used to construct a new kernel by defining arguments, declaring variable and writing code. @@ -71,6 +77,7 @@ public: // ============================================================================================= /** Write the line comment in debug build. + * * This function does not take effect on release build. * * The comment must only contain one line (i.e. no newline character is allowed). @@ -88,6 +95,31 @@ public: * @param[in] name The name of the kernel object to be generated. */ virtual std::unique_ptr<Kernel> emit_kernel(const std::string &name) = 0; + + /** Declare a tile given its name and tile info + * + * @param[in] name Name of the tile + * @param[in] tile_info Shape and data type of the tile + * + * @returns The created tile operand + */ + virtual ITileOperand &declare_tile(const std::string &name, const TileInfo &tile_info) = 0; + +protected: + int32_t id_space() const; + + /** Pure virtual function to be overridden by language specific subclasses to add a tile operand to the kernel */ + virtual ITileOperand &add_operand(const std::string &name, const TileInfo &tile_info) = 0; + + /** Add a tile operand to the operand list */ + ITileOperand &add_operand(std::unique_ptr<ITileOperand> &operand_ptr); + + /** Generate full variable name by prefixing it with id space */ + std::string generate_full_name(const std::string &name) const; + +private: + int32_t _id_space{ 0 }; + std::set<std::unique_ptr<ITileOperand>> _operands {}; }; } // namespace ckw |