SetCType

Function Usage

Sets the position, data format, data type, and transpose status of matrix C. These settings must be consistent with those in the kernel.

Prototype

1
int32_t SetCType(TPosition pos, CubeFormat type, DataType dataType)

Parameters

Table 1 Parameters

Parameter

Input/Output

Description

pos

Input

Position in the buffer where matrix C is located, which can be TPosition::GM or TPosition::VECIN.

type

Input

Data format of matrix C, which can be CubeFormat::ND, CubeFormat::NZ, or CubeFormat::ND_ALIGN.

dataType

Input

Data type of matrix C, which can be DataType::DT_FLOAT, DataType::DT_FLOAT16, DataType::DT_BFLOAT16, DataType::DT_FLOAT8_E4M3FN, DataType::DT_HIFLOAT8, DataType::DT_INT8, or DataType::DT_INT32.

Returns

-1: setting failed; 0: setting succeeded.

Restrictions

None

Example

1
2
3
4
5
auto ascendcPlatform = platform_ascendc::PlatformAscendC(context->GetPlatformInfo());
matmul_tiling::MatmulApiTiling tiling(ascendcPlatform); 
 
// Set matrix C, with the buffer located in the GM, data format of ND, data type of float, and transpose disabled by default.
tiling.SetCType(matmul_tiling::TPosition::GM, matmul_tiling::CubeFormat::ND, matmul_tiling::DataType::DT_FLOAT);