目录

GET_TILING_DATA_WITH_STRUCT

Function Description

Specifies a structure name to obtain the specified tiling information and fill the information in the corresponding tiling structure. This function is compiled in macro expansion mode. Unlike the GET_TILING_DATA API which can obtain only the default registered structure, this API can obtain the corresponding structure based on the specified structure name and is used when different structures are registered based on different tiling keys.

Function Prototype

GET_TILING_DATA_WITH_STRUCT(struct_name, tiling_data, tiling_arg)

Parameters

Parameter Input/Output Description
struct_name Input Name of the specified structure.
tiling_data Output Tiling data, for which the specified tiling structure variable is returned.
tiling_arg Input Tiling argument of the entrypoint function of the operator.

Supported Models

Kirin 9020 series processors

Kirin 9030 series processors

Kirin X90 series processors

Restrictions

Calling Example

extern "C" __global__ __aicore__ void add_custom(__gm__ uint8_t *x, __gm__ uint8_t *y, __gm__ uint8_t *z, __gm__ uint8_t *tiling)
{
    KernelAdd op;
    if (TILING_KEY_IS(1)) {
        GET_TILING_DATA_WITH_STRUCT(Add_Struct_Special, tilingData, tiling); // Use the specified structure registered by the operator.
    op.Init(x, y, z, tilingData.totalLengthSpecial, tilingData.tileNumSpecial);
    } else {
        GET_TILING_DATA(tilingData, tiling);   // Use the default structure registered by the operator.
    op.Init(x, y, z, tilingData.totalLength, tilingData.tileNum);
    }
    if (TILING_KEY_IS(1)) {
        op.Process();
    }  else  if (TILING_KEY_IS(2)) {
        op.Process();
    } else  if (TILING_KEY_IS(3)) {
        op.Process();
    }
}