Introduction to LocalMemAllocator
LocalMemAllocator is a class used for memory management when the static tensor programming mode is used. You can directly create a LocalTensor object (or use the constructor for LocalTensor to construct it) and develop operators, without the need to build TPipe or TQue. This reduces the overhead during runtime and achieves better performance.
LocalMemAllocator can be used only in the Ascend C static tensor programming mode and cannot be used together with APIs such as TPipe.
Header Files to Be Included
1
|
#include "kernel_operator.h" |
Prototype
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
template<Hardware hard = Hardware::UB> class LocalMemAllocator { public: __aicore__ inline LocalMemAllocator(); __aicore__ inline uint32_t GetCurAddr() const; template <class DataType, uint32_t tileSize> LocalTensor<DataType> __aicore__ inline Alloc(); template <TPosition pos, class DataType, uint32_t tileSize> __aicore__ inline LocalTensor<DataType> Alloc(); template <class DataType> LocalTensor<DataType> __aicore__ inline Alloc(uint32_t tileSize); template <TPosition pos, class DataType> LocalTensor<DataType> __aicore__ inline Alloc(uint32_t tileSize); template <class TensorTraitType> LocalTensor<TensorTraitType> __aicore__ inline Alloc(); }; |
Template Parameters
|
Parameter |
Description |
||
|---|---|---|---|
|
hard |
Physical location of data. The value is of the Hardware enumerated type. The valid locations are UB, L1, L0A, L0B, L0C, BIAS, and FIXBUF.
|
Parent topic: LocalMemAllocator