GET_TILING_DATA_MEMBER

Function Usage

Obtains the member variables of a tiling structure.

Prototype

1
GET_TILING_DATA_MEMBER(struct_name,  mem_name,  tiling_data,  tiling_arg)

Parameters

Parameter

Input/Output

Description

struct_name

Input

Name of the specified structure.

mem_name

Input

Name of the specified member variable.

tiling_data

Output

Tiling data, for which the member variable of the specified tiling structure is returned.

tiling_arg

Input

Tiling argument of the entrypoint function of the operator.

Availability

Atlas Training Series Product

Constraints

  • This function needs to be used in the operator kernel code, and the type of tiling_data does not need to be declared.
  • Currently, the kernel launch project is not supported.

Example

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
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 ASCEND_IS_AIV {
        GET_TILING_DATA(tilingData, tiling);   // The complete structure registered by the operator by default is used by the Vector Unit.
	op.Init(x, y, z, tilingData.totalLength, tilingData.tileNum);
        op.Process();
    } else {
        GET_TILING_DATA_MEMBER(Add_Struct, tCubeTiling, tCubeTilingVar, tiling); // Only the member variable tCubeTiling of the structure registered by the operator is used by the Cube Unit.
	op.Init(x, y, z, tCubeTilingVar);
	op.Process();
    }
}