SoftMax/SimpleSoftMax Tiling

Function

Obtains SoftMax/SimpleSoftMax tiling parameters.

Prototype

  • APIs for obtaining the minimum and maximum temporary space required for kernel computation
    1
    uint32_t GetSoftMaxMaxTmpSize(const ge::Shape& srcShape, const uint32_t dataTypeSize, const bool isReuseSource)
    
    1
    uint32_t GetSoftMaxMinTmpSize(const ge::Shape& srcShape, const uint32_t dataTypeSize, const bool isReuseSource)
    
  • Tiling computation APIs
    • Computation API in the AscendC::optiling namespace
      1
      void SoftMaxTilingFunc(const ge::Shape& srcShape, const uint32_t dataTypeSize, const uint32_t localWorkSpaceSize, optiling::SoftMaxTiling& softmaxTiling)
      
    • Computation API in the AscendC namespace
      1
      void SoftMaxTilingFunc(const ge::Shape& srcShape, const uint32_t dataTypeSize, const uint32_t localWorkSpaceSize, AscendC::tiling::SoftMaxTiling& softmaxTiling)
      

Parameters

Table 1 SoftMax/SimpleSoftMax GetSoftMaxMaxTmpSize/GetSoftMaxMinTmpSize parameters

Parameter

Input/Output

Description

srcShape

Input

Shape of the input srcTensor.

dataTypeSize

Input

Data type size of max and sum involved in computation, for example, half = 2.

isReuseSource

Input

The value must be the same as the API configuration in the kernel.

Table 2 SoftMax/SimpleSoftMax SoftMaxTilingFunc parameters

Parameter

Input/Output

Description

srcShape

Input

Shape of the input srcTensor.

dataTypeSize

Input

Data type size of max and sum involved in computation, for example, half = 2.

localWorkSpaceSize

Input

Size of the remaining space that can be used for SoftMax computation. The unit is byte. The value of localWorkSpaceSize must be greater than the minimum temporary space size required for computation by the GetSoftMaxMinTmpSize API.

softmaxTiling

Output

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

Returns

GetSoftMaxMaxTmpSize returns the maximum size (in byte) of the temporary space required for SoftMax or SimpleSoftMax computation.

GetSoftMaxMinTmpSize returns the minimum size (in byte) of the temporary space required for SoftMax or SimpleSoftMax computation.

Restrictions

None