SetSingleShape

Function Usage

Sets the shape of Matmul single-core computation in the singleMIn, singleNIn, and singleKIn directions. The unit is the number of elements.

Prototype

1
virtual int32_t SetSingleShape(int32_t singleMIn = -1, int32_t singleNIn = -1, int32_t singleKIn = -1)

Parameters

Table 1 Parameters

Parameter

Input/Output

Description

singleMIn

Input

Size of singleMIn. The unit is element. The default value is -1. The value -1 indicates that singleMIn is not set. Instead, it is calculated by the tiling function.

singleNIn

Input

Size of singleNIn. The unit is element. The default value is -1. The value -1 indicates that singleNIn is not set. Instead, it is calculated by the tiling function.

singleKIn

Input

Size of singleKIn. The unit is element. The default value is -1. The value -1 indicates that singleKIn is not set. Instead, it is calculated by the tiling function.

Returns

-1: setting failed; 0: setting succeeded.

Precautions

Example

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
auto ascendcPlatform = platform_ascendc::PlatformAscendC(context->GetPlatformInfo());
matmul_tiling::MultiCoreMatmulTiling tiling(ascendcPlatform); 
tiling.SetDim(1);
tiling.SetAType(matmul_tiling::TPosition::GM, matmul_tiling::CubeFormat::ND, matmul_tiling::DataType::DT_FLOAT16);   
tiling.SetBType(matmul_tiling::TPosition::GM, matmul_tiling::CubeFormat::ND, matmul_tiling::DataType::DT_FLOAT16);   
tiling.SetCType(matmul_tiling::TPosition::GM, matmul_tiling::CubeFormat::ND, matmul_tiling::DataType::DT_FLOAT);   
tiling.SetBiasType(matmul_tiling::TPosition::GM, matmul_tiling::CubeFormat::ND, matmul_tiling::DataType::DT_FLOAT);   
tiling.SetShape(1024, 1024, 1024);   
tiling.SetSingleShape(1024, 1024, 1024);  // Set the shape of single-core computation.
tiling.SetOrgShape(1024, 1024, 1024);
tiling.SetBias(true);   
tiling.SetBufferSpace(-1, -1, -1);
optiling::TCubeTiling tilingData;   
int ret = tiling.GetTiling(tilingData);