GetReduceAllMaxMinTmpSize
Function
To perform ReduceAll computation in the kernel, you need to reserve or allocate the temporary space. This API is used to obtain the maximum and minimum temporary space sizes to be reserved or allocated on the host. You can select a proper size within this range as the tiling parameters 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 is optimized to some extent. For better performance, reserve or allocate the temporary space based on the actual memory usage. The maximum temporary space of this API is currently equal to the minimum temporary space.
Prototype
1
|
void GetReduceAllMaxMinTmpSize(const ge::Shape& srcShape, const ge::DataType dataType, ReducePattern pattern, bool isSrcInnerPad, bool isReuseSource, uint32_t& maxValue, uint32_t& minValue) |
Parameters
Returns
None
Restrictions
None
Example
For details about the complete call example, see More Examples.
1 2 3 4 5 6 7 |
// The input shape is a 16 x 32 matrix. The operator input data type is float. The source operand cannot be modified. auto shape = ge::Shape({ 16, 32 }); uint32_t maxValue = 0; uint32_t minValue = 0; bool isSrcInnerPad = true; bool isReuseSource = false; AscendC::GetReduceAllMaxMinTmpSize(shape, ge::DataType::DT_FLOAT, AscendC::ReducePattern::AR, isSrcInnerPad, isReuseSource, maxValue, minValue); |
Parent topic: ReduceAll API