HCCL Tiling Instructions

This section describes the TilingData structure required by communication operators. It provides three versions of TilingData: TilingData Structure (recommended), TilingData of v1 (Deprecated) (not recommended), and TilingData of v2 (Deprecated) (not recommended).

For TilingData Structure, when defining the tiling structure of an MC2 operator, Mc2InitTiling must be defined as the first parameter of the operator tiling structure. Mc2CcTiling has no requirement on the position defined in the operator tiling structure.

Ascend C provides a set of HCCL Tiling APIs to help users obtain the Tiling parameters needed for HCCL kernel computation according to the method of Using the Standard C++ Syntax to Define the Tiling Structure. You only need to pass the communication information and call the APIs to obtain related tiling parameters.

The process of obtaining tiling parameters by using HCCL tiling APIs is as follows:

  1. Create an Mc2CcTilingConfig object.
    1
    2
    3
    4
    5
    const char *groupName = "testGroup";
    uint32_t opType = HCCL_CMD_REDUCE_SCATTER;
    std::string algConfig = "ReduceScatter=level0:fullmesh";
    uint32_t reduceType = HCCL_REDUCE_SUM;
    AscendC::Mc2CcTilingConfig mc2CcTilingConfig(groupName, opType, algConfig, reduceType);
    
  2. (Optional) Configure communication information through the configuration APIs.
    1
    2
    mc2CcTilingConfig.SetSkipLocalRankCopy(0);
    mc2CcTilingConfig.SetSkipBufferWindowCopy(1);
    

    The following table lists the configuration APIs to be called.

    Table 1 Configuration APIs of the Mc2CcTilingConfig class

    API

    Function

    SetOpType

    Sets the communication task type.

    SetGroupName

    Sets the communicator of a communication task.

    SetAlgConfig

    Sets the communication algorithm.

    SetReduceType

    Sets the reduction operation type.

    SetStepSize

    Sets the step size of the communication algorithm during fine-grained communication.

    SetSkipLocalRankCopy

    Sets whether to output the compute result of the communication algorithm on the device to recvBuf.

    SetSkipBufferWindowCopy

    Sets the location where the communication algorithm obtains the input data.

    SetDebugMode

    Sets the debugging mode.

  3. Call the GetTiling API to obtain the tiling information.
    1
    2
    mc2CcTilingConfig.GetTiling(tiling->mc2InitTiling); // tiling is the TilingData structure assembled by the operator.
    mc2CcTilingConfig.GetTiling(tiling->reduceScatterTiling);