EnableL1BankConflictOptimise

Function

Obtains whether the bank conflict optimization on L1 can be enabled based on the tiling parameters computed by the GetTiling API. If the function can be enabled, it is used together with the TilingKey mechanism. You can add TilingKey to associate the host with the kernel, add a code branch to the kernel, and set enableL1BankConflictOptimise in MatmulConfig to true to optimize the bank conflicts on L1.

Prototype

1
bool EnableL1BankConflictOptimise()

Parameters

None

Returns

  • false: Bank conflict optimization on L1 cannot be enabled in the kernel.
  • true: Bank conflict optimization on L1 can be enabled in the kernel.

Restrictions

This API needs to be called using the created tiling object after the tiling computation (GetTiling) is complete.

Example

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
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);
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);
// The function to enable L1 bank conflict optimization in the kernel can be used together with the TilingKey mechanism.
bool enableL1BankConflictOptimise = tiling.EnableL1BankConflictOptimise();