SetScaleBType

Function Usage

Sets the position, data format, and transpose status of matrix scaleB in the MxMatmul scenario. These settings must be consistent with those in the kernel. If this API is not called, the settings of matrix scaleB will be kept the same as that of matrix B in SetBType.

Prototype

1
int32_t SetScaleBType(TPosition scalePos, CubeFormat scaleType, bool isScaleTrans = true)

Parameters

Table 1 Parameters

Parameter

Input/Output

Description

scalePos

Input

Logical memory location of matrix scaleB.

For the Atlas 350 Accelerator Card, this parameter can be set to TPosition::GM, TPosition::VECOUT, or TPosition::TSCM.

scaleType

Input

Physical layout format of matrix scaleB. For details, see Data Format.

For the Atlas 350 Accelerator Card, this parameter can be set to CubeFormat::ND or CubeFormat::NZ.

isScaleTrans

Input

Whether matrix scaleB is transposed. The options are as follows:

  • true (default): Matrix scaleB is transposed.
  • false: Matrix scaleB is not transposed.

Returns

-1: setting failed; 0: setting succeeded.

Restrictions

None

Example

1
2
3
4
5
6
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 scaleB, with the buffer located in the GM, data format of ND, and transpose enabled.
tiling.SetScaleBType(matmul_tiling::TPosition::GM, matmul_tiling::CubeFormat::ND, true);