SetScaleAType

Function Usage

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

Prototype

1
int32_t SetScaleAType(TPosition scalePos, CubeFormat scaleType, bool isScaleTrans = false)

Parameters

Table 1 Parameters

Parameter

Input/Output

Description

scalePos

Input

Logical memory location of matrix scaleA.

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 scaleA. 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 scaleA is transposed. The options are as follows:

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

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); 
tiling.SetAType(matmul_tiling::TPosition::GM, matmul_tiling::CubeFormat::ND, matmul_tiling::DataType::DT_FLOAT16);  
// Set matrix scaleA, with the buffer located in the GM, data format of ND, and transpose disabled.
tiling.SetScaleAType(matmul_tiling::TPosition::GM, matmul_tiling::CubeFormat::ND, false);