GetReduceXorSumMaxMinTmpSize
Function Usage
To perform ReduceXorSum computation in the kernel, developers need to reserve or allocate the temporary space. This API is used to obtain the maximum and minimum sizes of the temporary space to be reserved or allocated on the host. Developers can select a proper size within this range as the tiling parameter and pass it to the kernel.
- To ensure correct functions, the temporary space to be reserved or allocated cannot be less than the minimum temporary space.
- Within the range between the minimum and maximum, as the temporary space increases, the API computing performance in the kernel can be optimized to some extent. To achieve better performance, reserve or allocate the space based on the actual buffer usage. The maximum temporary space of this API is currently equal to the minimum temporary space.
Prototype
1 | void GetReduceXorSumMaxMinTmpSize(const ge::Shape &srcShape, const uint32_t typeSize, const bool isReuseSource, uint32_t &maxValue, uint32_t &minValue) |
Parameters
API |
Input/Output |
Function |
|---|---|---|
srcShape |
Input |
Input shape. |
typeSize |
Input |
Type size of an operator input. The unit is byte. For example, if the data type of operator inputs is int16_t, set this parameter to 2. |
isReuseSource |
Input |
Whether to reuse the space of the source operand input, which must be the same as that of the ReduceXorSum API. |
maxValue |
Output |
Maximum size of the temporary space required by ReduceXorSum computation. Any space exceeding this value will not be utilized by the API. NOTE:
maxValue is for reference only and may be larger than the remaining space of the Unified Buffer. In this case, select a proper temporary space size based on the remaining space of the Unified Buffer. |
minValue |
Output |
Minimum size of the temporary space required by ReduceXorSum computation. To ensure correct functions, the size of the temporary space to be reserved or allocated during API computation cannot be less than the value of this parameter. |
Returns
There are no returns for GetReduceXorSumMaxMinTmpSize.
Availability
Example
1 2 3 4 5 6 7 | // The input shape is 1024. The operator input is of the int16_t type. The source operand cannot be modified. std::vector<int64_t> shape_vec = {1024}; ge::Shape shape(shape_vec); uint32_t maxValue = 0; uint32_t minValue = 0; uint32_t typeSize = sizeof(int16_t); AscendC::GetReduceXorSumMaxMinTmpSize(shape, typeSize, false, maxValue, minValue); |