SetCLayout
Function Usage
Before calling IterateBatch, call this API to set the layout axis information of matrix C in the tiling implementation on the host, including the B, S, N, G, and D axes.
Prototype
1 | int32_t SetCLayout(int32_t B, int32_t S, int32_t N, int32_t G, int32_t D) |
Parameters
Parameter |
Input/Output |
Description |
|---|---|---|
B |
Input |
Layout B axis information of matrix C |
S |
Input |
Layout S axis information of matrix C |
N |
Input |
Layout N axis information of matrix C |
G |
Input |
Layout G axis information of matrix C |
D |
Input |
Layout D axis information of matrix C |
Returns
-1: setting failed; 0: setting succeeded.
Precautions
None
Example
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 30 31 32 33 34 35 36 | auto ascendcPlatform = platform_ascendc::PlatformAscendC(context->GetPlatformInfo()) matmul_tiling::MultiCoreMatmulTiling tiling(ascendcPlatform); int32_t M = 32; int32_t N = 256; int32_t K = 64; 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(M, N, K); tiling->SetOrgShape(M, N, K); tiling->SetBias(true); tiling->SetBufferSpace(-1, -1, -1); constexpr int32_t A_BNUM = 2; constexpr int32_t A_SNUM = 32; constexpr int32_t A_GNUM = 3; constexpr int32_t A_DNUM = 64; constexpr int32_t B_BNUM = 2; constexpr int32_t B_SNUM = 256; constexpr int32_t B_GNUM = 3; constexpr int32_t B_DNUM = 64; constexpr int32_t C_BNUM = 2; constexpr int32_t C_SNUM = 32; constexpr int32_t C_GNUM = 3; constexpr int32_t C_DNUM = 256; constexpr int32_t BATCH_NUM = 3; tiling->SetALayout(A_BNUM, A_SNUM, 1, A_GNUM, A_DNUM); tiling->SetBLayout(B_BNUM, B_SNUM, 1, B_GNUM, B_DNUM); tiling->SetCLayout(C_BNUM, C_SNUM, 1, C_GNUM, C_DNUM); //: Set the layout of matrix C. tiling->SetBatchNum(BATCH_NUM); tiling->SetBufferSpace(-1, -1, -1); optiling::TCubeTiling tilingData; int ret = tiling.GetTiling(tilingData); |
Parent topic: Matmul Tiling Class