Template Argument Definition
Function Usage
Defines the template argument declaration ASCENDC_TPL_ARGS_DECL and template argument selection ASCENDC_TPL_ARGS_SEL (available template). For details, see Tiling Template Programming.
Prototype
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
// ParamStruct is a structure that stores the template argument declaration ASCENDC_TPL_ARGS_DECL and template argument selection ASCENDC_TPL_ARGS_SEL set by the user. It is used for subsequent encoding and decoding between the TilingKey and template arguments and can be ignored. struct ParamStruct { const char* name; uint32_t paramType; uint8_t bitWidth; std::vector<uint64_t> vals; const char* macroType; ParamStruct(const char* inName, uint32_t inParamType, uint8_t inBitWidth, std::vector<uint64_t> inVals, const char* inMacroType): name(inName), paramType(inParamType), bitWidth(inBitWidth), vals(std::move(inVals)), macroType(inMacroType) {} }; using TilingDeclareParams = std::vector<ParamStruct>; using TilingSelectParams = std::vector<std::vector<ParamStruct>>; // APIs for defining template arguments #define ASCENDC_TPL_DTYPE_DECL(x, ...) ParamStruct{#x, ASCENDC_TPL_DTYPE, ASCENDC_TPL_8_BW, {__VA_ARGS__}, "DECL"} #define ASCENDC_TPL_FORMAT_DECL(x, ...) ParamStruct{#x, ASCENDC_TPL_FORMAT, ASCENDC_TPL_8_BW, {__VA_ARGS__}, "DECL"} #define ASCENDC_TPL_UINT_DECL(x, bw, ...) ParamStruct{#x, ASCENDC_TPL_UINT, bw, {__VA_ARGS__}, "DECL"} #define ASCENDC_TPL_BOOL_DECL(x, ...) ParamStruct{#x, ASCENDC_TPL_BOOL, ASCENDC_TPL_1_BW, {__VA_ARGS__}, "DECL"} #define ASCENDC_TPL_DTYPE_SEL(x, ...) ParamStruct{#x, ASCENDC_TPL_DTYPE, ASCENDC_TPL_8_BW, {__VA_ARGS__}, "SEL"} #define ASCENDC_TPL_FORMAT_SEL(x, ...) ParamStruct{#x, ASCENDC_TPL_FORMAT, ASCENDC_TPL_8_BW, {__VA_ARGS__}, "SEL"} #define ASCENDC_TPL_UINT_SEL(x, ...) ParamStruct{#x, ASCENDC_TPL_UINT, 0, {__VA_ARGS__}, "SEL"} #define ASCENDC_TPL_BOOL_SEL(x, ...) ParamStruct{#x, ASCENDC_TPL_BOOL, ASCENDC_TPL_1_BW, {__VA_ARGS__}, "SEL"} #define ASCENDC_TPL_ARGS_DECL(x, ...) static TilingDeclareParams g_tilingDeclareParams{ __VA_ARGS__ } #define ASCENDC_TPL_ARGS_SEL(...) { __VA_ARGS__} #define ASCENDC_TPL_SEL(...) static TilingSelectParams g_tilingSelectParams{ __VA_ARGS__ } |
Arguments
|
Macro |
Function |
Description |
|---|---|---|
|
ASCENDC_TPL_ARGS_DECL(args0, ...) |
Overall template argument declaration of an operator. |
|
|
ASCENDC_TPL_DTYPE_DECL(args0, ...) |
||
|
ASCENDC_TPL_FORMAT_DECL(args0, ...) |
||
|
ASCENDC_TPL_UINT_DECL(args0, args1, args2, ...) |
Template argument declaration of the unsigned integer (UINT) type. |
|
|
ASCENDC_TPL_BOOL_DECL(args0, ...) |
Template argument declaration of the bool type. |
args0: argument name. args1-args2: The value can be 0 or 1. |
|
Macro |
Function |
Description |
|---|---|---|
|
ASCENDC_TPL_SEL(...) |
Overall template argument selection of an operator. |
Template argument selection that contains multiple operators. |
|
ASCENDC_TPL_ARGS_DSEL(...) |
Template argument selection of an operator. |
Template argument selection of an operator. |
|
ASCENDC_TPL_DTYPE_SEL(args0, ...) |
Template argument selection of DataType. |
|
|
ASCENDC_TPL_FORMAT_SEL(args0, ...) |
Template argument selection of Format. |
|
|
ASCENDC_TPL_UINT_SEL(args0, args1, args2, ...) |
Template argument selection of the UINT type. |
For details about how to configure the mode and arguments, see ASCENDC_TPL_UINT_DECL(args0, args1, args2, ...). |
|
ASCENDC_TPL_BOOL_SEL(args0, ...) |
Template argument selection of the bool type. |
args0: argument name. args1-args2: subset of the argument ranges defined in ASCENDC_TPL_BOOL_DECL. |
Returns
None
Constraints
After the values of template arguments are modified or added, the custom operator package needs to be recompiled. The original operator binary files cannot be used.