Conv3DBackpropInput Tiling Usage Description

Ascend C provides a group of Conv3DBackpropInput tiling APIs for users to obtain tiling parameters required for Conv3DBackpropInput kernel computation. You only need to input the position, format, DType data type, and related parameters of Input/GradOutput/Weight, and call the API to obtain the related parameters in the TConv3DBackpropInputTiling structure of Init.

The Conv3DBackpropInput tiling API provides a GetTiling interface to obtain tiling parameters. The process of obtaining tiling parameters is as follows:

  1. Create a single-core tiling object.
  2. Set the parameter type and shape information of Input, GradOutput, and Weight. If the Padding and Stride parameters exist, set them by calling SetPadding and SetStride APIs.
  3. Call the GetTiling API to obtain the tiling information.

The following shows an example of using the Conv3DBackpropInput tiling API to obtain tiling parameters:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
#include "tiling/conv_backprop/conv3d_bp_input_tiling.h"

optiling::Conv3DBackpropInputTilingData tilingData;
auto ascendcPlatform = platform_ascendc::PlatformAscendCManager::GetInstance();
ConvBackpropApi::Conv3DBpInputTiling conv3DBpDxTiling(*ascendcPlatform);
conv3DBpDxTiling.SetWeightType(Convolution3DBackprop::TPosition::GM,
                                   Convolution3DBackprop::ConvFormat::FRACTAL_Z_3D,
                                   Convolution3DBackprop::ConvDtype::FLOAT32);
conv3DBpDxTiling.SetGradOutputType(Convolution3DBackprop::TPosition::GM,
                                   Convolution3DBackprop::ConvFormat::NDC1HWC0,
                                   Convolution3DBackprop::ConvDtype::FLOAT16);
conv3DBpDxTiling.SetInputType(Convolution3DBackprop::TPosition::CO1,
                                 Convolution3DBackprop::ConvFormat::NDC1HWC0,
                                 Convolution3DBackprop::ConvDtype::FLOAT16);
conv3DBpDxTiling.SetInputShape(orgN, orgCi, orgDi, orgHi, orgWi);
conv3DBpDxTiling.SetGradOutputShape(orgCo, orgDo, orgHo, orgWo);
conv3DBpDxTiling.SetWeightShape(orgKd, orgKh, orgKw);
conv3DBpDxTiling.SetPadding(padFront, padBack, padUp, padDown, padLeft, padRight);
conv3DBpDxTiling.SetStride(strideD, strideH, strideW);
conv3DBpDxTiling.SetDilation(dilationD, dilationH, dilationW);
int ret = conv3DBpDxTiling.GetTiling(tilingData);    // if ret = -1, get tiling failed

Header File to Be Included

1
#include "lib/conv_backprop/conv3d_bp_input_tiling.h"