Reserved APIs
The APIs described in this section are reserved and may be changed or deprecated in the future. They do not need your attention.
API Definition |
Description |
|---|---|
GetTid() |
Obtains the current thread ID. |
GetSafeStr(T name) |
Safely obtains a string pointer. The supported types are const char*, char*, and std::string. |
GetOpInfo(const std::string& str) |
Obtains the operator information string. |
GetOpInfo(const char* str) |
Obtains the operator information string. Null pointer protection is supported. |
IsContextType<T>() |
Checks whether the template type T is Context. |
GetOpInfo(T context) |
Obtains the operator type and name from TilingContext or InferShapeContext. |
DLOG_DEBUG |
DEBUG log constant. The value is 0. |
DLOG_INFO |
INFO log constant. The value is 1. |
DLOG_WARN |
WARN log constant. The value is 2. |
DLOG_ERROR |
ERROR log constant. The value is 3. |
OP_MODULE_ID |
Operator module ID constant. The value is 63. |
CheckLogLevel(int32_t moduleId, int32_t logLevel) |
Log level check function, which checks whether the log level of a specified module is enabled. If 1 is returned, the log level is enabled. |
DlogRecord(int32_t moduleId, int32_t level, const char* fmt, ...) |
Logging function, which records logs by module ID and log level. |
OP_LOGE_LIBOPAPI_REPORT(opName, fmt, ...) |
Reports bottom-layer logs and records ERROR logs. |
OP_LOGE_WITHOUT_REPORT(opName, ...) |
Records logs only and does not report errors. |
OpLogSub(moduleId, level, opInfo, fmt, ...) |
Logging macro for a specified module and level. |
OpLogErrSub(moduleId, level, opInfo, fmt, ...) |
Error logging macro for a specified module and level. |
D_OP_LOGI(opName, fmt, ...) |
INFO log debugging macro. |
D_OP_LOGW(opName, fmt, ...) |
WARN log debugging macro. |
D_OP_LOGE(opName, fmt, ...) |
ERROR log debugging macro. |
D_OP_LOGD(opName, fmt, ...) |
DEBUG log debugging macro. |
unlikely(x) |
Compiler branch prediction optimization macro, which marks x as a low-probability branch. |
likely(x) |
Compiler branch prediction optimization macro, which marks x as a high-probability branch. |
ToString(ge::DataType type) |
Obtains the string corresponding to the data type. |
ToString(ge::Format format) |
Obtains the string corresponding to the format. |
ToString(const gert::Shape& shape) |
Obtains the string corresponding to the shape. |
ToString(const std::vector<const gert::Shape*>& v) |
Obtains the string corresponding to the shape pointer list. |
ViewErrorCode |
Error code enumeration, which is used to report errors in scenarios such as infershape. |
LastPow2(uint64_t n) |
Obtains the maximum power of 2 that does not exceed n. |
MurmurHash(const void *src, uint32_t srcLen, uint32_t seed) |
Murmur hash algorithm, which is used to calculate the hash value of data. |
SplitResult |
Structure of the average result, including splitCount, splitFactor, and splitTailFactor. |
SplitIntoEqualByParts(int64_t splitLen, int32_t parts, SplitResult& splitResult) |
Splits splitLen evenly into parts and returns the size of each part. |
SplitIntoEqualByFactor(int64_t splitLen, int32_t factor, SplitResult& splitResult) |
Splits splitLen evenly based on the specified factor and returns the number of parts. |
GetValueToInteger<T1, T2>(const gert::Tensor *constTensor, T2 &value) |
Reads integer data from a const Tensor. |
GetConstInt<ContextType, T>(const ContextType *context, int64_t inputIdx, T &value) |
Obtains the constant integer value of a specified input from InferShapeContext or TilingContext. |
GetValueToShape<T>(const gert::Tensor *constTensor, gert::Shape &shape) |
Reads an integer array from a const Tensor to Shape. |
GetConstIntToShape<ContextType>(const ContextType *context, int64_t inputIdx, gert::Shape &shape) |
Obtains the constant integer of a specified input from InferShapeContext or TilingContext and writes it to Shape. |
IsRegbaseSocVersion(const gert::TilingParseContext* context) |
Checks whether the current platform is a Regbase SoC version. |
IsRegbaseSocVersion(const gert::TilingContext* context) |
Checks whether the current platform is a Regbase SoC version. |
EnsureNotScalar(const gert::Shape& inShape) |
Ensure that the shape is not a scalar. If it is a scalar, a one-dimensional shape is returned. |
AiCoreParams |
AiCore parameter structure, including ubSize, numBlocks, aicNum, l1Size, l0aSize, l0bSize, and l0cSize. |
CompileInfoCommon |
Common structure of compilation information, including platform information such as aivNum, aicNum, ubSize, and l1Size. |
TilingBaseClass(gert::TilingContext* context) |
Constructor of the Tiling base class, which receives TilingContext. |
DoTiling() |
Entry of the Tiling execution framework, which calls each Tiling phase in sequence. |
Reset(gert::TilingContext* context) |
Resets the context member of TilingBaseClass. |
IsCapable() |
Pure virtual function, which determines whether the current class supports the tiling of the operator. |
GetPlatformInfo() |
Pure virtual function, which obtains platform information, such as the number of cores and the size of UB/L1/L0C resources. |
GetShapeAttrsInfo() |
Pure virtual function, which obtains the INPUT/OUTPUT/ATTR information. |
DoOpTiling() |
Pure virtual function, which calculates the tiling data. |
DoLibApiTiling() |
Pure virtual function, which calculates the tiling data of high-level APIs. |
GetTilingKey() |
Pure virtual function, which calculates the tiling key. |
GetWorkspaceSize() |
Pure virtual function, which calculates the workspace size. |
PostTiling() |
Pure virtual function, which saves the tiling data. |
DumpTilingInfo() |
Prints tiling data information. |
DefaultTilingInfoDump() |
Default implementation for printing tiling data. |
CalcTschBlockDim(uint32_t sliceNum, uint32_t aicCoreNum, uint32_t aivCoreNum) |
Calculates the BlockDim in the tsch scenario. |
GetShapeDebugStr<T>(const T& shape) |
Obtains the debugging string of the shape. |
GetTensorDebugStr(const gert::StorageShape* shape, const gert::CompileTimeTensorDesc* tensor) |
Obtains the debugging string of a tensor, including the dtype, shape, and format information. |
GetTilingContextDebugStr() |
Obtains the debugging strings of all input and output tensors in TilingContext. |
GetTilingDataDebugStr() |
Obtains the debugging string of TilingData. |
bfloat16 |
bfloat16 data type structure, which supports conversion and arithmetic operations with types such as float and double. |
fp16_t |
fp16 half-precision floating-point data type structure, which supports conversion and arithmetic operations with types such as float and int. |
castTraitB162B32 |
CastTrait constant configuration from B16 to B32. |
castTraitB322B16 |
CastTrait constant configuration from B32 to B16. |
castTraitB322Int32 |
CastTrait constant configuration from B32 to int32. |
castTraitB322Int16 |
CastTrait constant configuration from B32 to int16. |
castTraitB162Int8 |
CastTrait constant configuration from B16 to int8. |
LoadOneTensorForDtypeT<T>(__local_mem__ T *input, MicroAPI::RegTensor<float> &dst, MicroAPI::MaskReg &preg, uint32_t offset) |
Loads an aligned tensor from the UB to the float32 register. |
LoadTwoTensorForDtypeT<T>(__local_mem__ T *src1, __local_mem__ T *src2, MicroAPI::RegTensor<float> &dst1, MicroAPI::RegTensor<float> &dst2, MicroAPI::MaskReg &dst1Preg, MicroAPI::MaskReg &dst2Preg, uint32_t src1Offset, uint32_t src2Offset) |
Loads two aligned tensors from the UB to the float32 register. |
StoreOneTensorForDtypeT<T>(__local_mem__ T *output, MicroAPI::RegTensor<float> &src, MicroAPI::MaskReg &preg, uint32_t offset) |
Stores the float32 register data to the UB. The output can be of the bfloat16, float16, float32, int32, int16, int8, or uint8 type. |
LoadUnAlignOneTensor<T>(__local_mem__ T *&input, MicroAPI::RegTensor<float> &dst, MicroAPI::UnalignReg &uSrc, MicroAPI::MaskReg &preg, uint32_t postUpdateStride) |
Loads an unaligned tensor from the UB to the float32 register. |
StoreUnAlignOneTensor<T>(__local_mem__ T *&output, MicroAPI::RegTensor<float> &src, MicroAPI::UnalignReg &uValue, MicroAPI::MaskReg &preg, uint32_t postUpdateStride) |
Stores the float32 register data to the UB in an unaligned manner. |
CeilDiv<T>(T a, T b) |
Returns the quotient rounded up to the nearest integer on the kernel side. |
FloorDiv<T>(T a, T b) |
Returns the quotient rounded down to the nearest integer on the kernel side. |
CeilAlign<T>(T a, T b) |
Returns the value rounded up on the kernel side. |
FloorAlign<T>(T a, T b) |
Returns the value rounded down on the kernel side. |
GetUbBlockSize() |
Obtains the size of the UB block (32 bytes) on the kernel side. |
GetVRegSize() |
Obtains the size of the vector register on the kernel side. |