GetAscendAntiQuantMaxMinTmpSize
Function Usage
To perform AscendAntiQuant 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 from the minimum to the maximum, as the temporary space increases, the API compute 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.
Prototype
1
|
void GetAscendAntiQuantMaxMinTmpSize(const ge::Shape& srcShape, const ge::Shape& scaleShape, bool isTranspose, ge::DataType inputDataType, ge::DataType outputDataType, uint32_t& maxValue, uint32_t& minValue) |
1
|
uint32_t GetAscendAntiQuantMaxTmpSize(const ge::Shape& srcShape, const ge::Shape& scaleShape, bool isTranspose, ge::DataType inputDataType, ge::DataType outputDataType) |
1
|
uint32_t GetAscendAntiQuantMinTmpSize(const ge::Shape& srcShape, const ge::Shape& scaleShape, bool isTranspose, ge::DataType inputDataType, ge::DataType outputDataType) |
Parameters
Returns
GetAscendAntiQuantMaxMinTmpSize: none
GetAscendAntiQuantMaxTmpSize: maximum temporary space required by AscendAntiQuant computation
GetAscendAntiQuantMinTmpSize: minimum temporary space required by AscendAntiQuant computation
Constraints
None
Examples
1 2 3 4 5 6 7 8 |
uint32_t maxValue = 0; uint32_t minValue = 0; std::vector<int64_t> srcDims = { 64, 512 }; auto srcShape = ge::Shape(srcDims); std::vector<int64_t> scaleDims = { 1, 512 }; auto scaleShape = ge::Shape(scaleDims); bool isTranspose = false; AscendC::GetAscendAntiQuantMaxMinTmpSize(srcShape, scaleShape, isTranspose, ge::DT_INT8, ge::DT_BF16, maxValue, minValue); |
Parent topic: Quantization