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:
- 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);
- (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
Sets the communication task type.
Sets the communicator of a communication task.
Sets the communication algorithm.
Sets the reduction operation type.
Sets the step size of the communication algorithm during fine-grained communication.
Sets whether to output the compute result of the communication algorithm on the device to recvBuf.
Sets the location where the communication algorithm obtains the input data.
Sets the debugging mode.
- 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);