SetBType
Function
Sets the position, data format, data type, and transpose status of matrix B. These settings must be consistent with those in the kernel.
Prototype
1 | int32_t SetBType(TPosition pos, CubeFormat type, DataType dataType, bool isTrans = false) |
Parameters
Parameter |
Input/Output |
Description |
|---|---|---|
pos |
Input |
Position in the buffer where matrix B is located, which can be TPosition::GM, TPosition::VECOUT, or TPosition::TSCM. |
type |
Input |
Data format of matrix B, which can be CubeFormat::ND or CubeFormat::NZ. |
dataType |
Input |
Data type of matrix B, which can be DataType::DT_FLOAT, DataType::DT_FLOAT16, DataType::DT_BFLOAT16, DataType::DT_INT8, or DataType::DT_INT4. |
Input |
Whether matrix B should be transposed. Values:
|
Returns
-1: setting failed; 0: setting succeeded.
Restrictions
None
Example
1 2 3 4 5 6 7 8 9 10 11 12 13 | auto ascendcPlatform = platform_ascendc::PlatformAscendC(context->GetPlatformInfo()); matmul_tiling::MatmulApiTiling tiling(ascendcPlatform); tiling.SetAType(matmul_tiling::TPosition::GM, matmul_tiling::CubeFormat::ND, matmul_tiling::DataType::DT_FLOAT16); // Set matrix B, with the buffer located in the GM, data format of ND, data type of bfloat16, and transpose disabled by default. 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.SetOrgShape(1024, 1024, 1024); tiling.SetBias(true); tiling.SetBufferSpace(-1, -1, -1); optiling::TCubeTiling tilingData; int ret = tiling.GetTiling(tilingData); |
Parent topic: Matmul Tiling