SoftmaxFlashV3 Tiling

Function

Obtains the tiling parameters required by SoftmaxFlashV3.

Prototype

  • APIs for obtaining the minimum and maximum temporary space required for kernel computation
    1
    void GetSoftMaxFlashV3MaxMinTmpSize(const ge::Shape& srcShape, const uint32_t dataTypeSize1, const uint32_t dataTypeSize2, uint32_t& maxValue, uint32_t& minValue, const bool isUpdate, const bool isBasicBlock = false)
    
  • Tiling computation APIs
    • Computation API in the AscendC::optiling namespace
      1
      void SoftMaxFlashV3TilingFunc(const ge::Shape& srcShape, const uint32_t dataTypeSize1, const uint32_t dataTypeSize2,const uint32_t localWorkSpaceSize, optiling::SoftMaxTiling& softmaxFlashV3Tiling, const bool isUpdate,const bool isBasicBlock = false)
      
    • Computation API in the AscendC namespace
      1
      void SoftMaxFlashV3TilingFunc(const ge::Shape& srcShape, const uint32_t dataTypeSize1, const uint32_t dataTypeSize2,const uint32_t localWorkSpaceSize, AscendC::tiling::SoftMaxTiling& softmaxFlashV3Tiling, const bool isUpdate,const bool isBasicBlock = false)
      

Parameters

Table 1 GetSoftMaxFlashV3MaxMinTmpSize API parameters

Parameter

Input/Output

Description

srcShape

Input

Shape of the input srcTensor.

dataTypeSize1

Input

Data type size of the input srcTensor, which is the data type size of parameter T in the SoftMaxFlashV3 kernel function. Currently, T supports only the half type. Therefore, this parameter can only be set to 2.

dataTypeSize2

Input

Data type size of the input inMeanTensor, inExpSumTensor, and inMaxTensor, that is, the data type size of U in the SoftMaxFlashV3 kernel function. Currently, U supports only the float type. Therefore, this parameter can only be set to 4.

maxValue

Output

Maximum size of the temporary space required for SoftMaxFlashV3 computation. Any space exceeding this value will not be utilized by the API. 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. For better performance, reserve or allocate the temporary space based on the actual memory usage. If the maximum space size is 0, no temporary space is required.

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 for SoftMaxFlashV3 computation. To ensure correct functions, the temporary space to be reserved or allocated during API computation cannot be less than the value of this parameter. If the minimum space size is 0, no temporary space is required.

isUpdate

Input

Whether to set update to true in the SoftMaxFlashV3 computation. The parameter value must be the same as isUpdate in the SoftmaxFlashV3 kernel API.

isBasicBlock

Input

Reserved for future use. The default value false must be used.

Table 2 SoftMaxFlashV3TilingFunc API parameters

Parameter

Input/Output

Description

srcShape

Input

Shape of the input srcTensor.

dataTypeSize1

Input

Data type size of the input srcTensor, which is the data type size of parameter T in the SoftMaxFlashV3 kernel function. Currently, T supports only the half type. Therefore, this parameter can only be set to 2.

dataTypeSize2

Input

Data type size of the input inMeanTensor, inExpSumTensor, and inMaxTensor, that is, the data type size of U in the SoftMaxFlashV3 kernel function. Currently, U supports only the float type. Therefore, this parameter can only be set to 4.

localWorkSpaceSize

Input

Size of the remaining space that can be used for SoftmaxFlashV3 computation. The value of localWorkSpaceSize must be greater than the minimum temporary space size required for computation by the GetSoftMaxFlashV3MaxMinTmpSize API.

isUpdate

Input

Whether to set update to true in the SoftMaxFlashV3 computation. The parameter value must be the same as isUpdate in the SoftmaxFlashV3 kernel API.

isBasicBlock

Input

Reserved for future use. The default value false must be used.

softmaxFlashV3Tiling

Output

Tiling information required by the SoftMaxFlashV3 APIs. The input parameters in the optiling::SoftMaxTiling and AscendC::tiling::SoftMaxTiling formats are supported.

Returns

None

Restrictions

None