Skip to content

SoftmaxFlash Tiling接口

功能说明

注意:该接口后续即将废弃,新开发内容不要使用该接口

用于获取SoftmaxFlash Tiling参数。

函数原型

  • 获取Kernel接口计算所需最小/最大临时空间的接口

    Text
    uint32_t GetSoftMaxFlashMaxTmpSize(const AscendC::TensorShape& srcShape, const uint32_t dataTypeSize, const bool isUpdate, const bool isReuseSource)
    
    Text
    uint32_t GetSoftMaxFlashMinTmpSize(const AscendC::TensorShape& srcShape, const uint32_t dataTypeSize, const bool isUpdate, const bool isReuseSource)
    
  • Tiling计算接口

    • AscendC::optiling命名空间下的计算接口

      Text
      void SoftMaxFlashTilingFunc(const AscendC::TensorShape& srcShape, const uint32_t dataTypeSize, const uint32_t localWorkSpaceSize, optiling::SoftMaxTiling& softmaxFlashTiling, const bool isUpdate = false)
      
    • AscendC命名空间下的计算接口

      Text
      void SoftMaxFlashTilingFunc(const AscendC::TensorShape& srcShape, const uint32_t dataTypeSize, const uint32_t localWorkSpaceSize, AscendC::tiling::SoftMaxTiling& softmaxFlashTiling, const bool isUpdate = false)
      

参数说明

表1 SoftmaxFlash GetSoftMaxFlashMaxTmpSize/GetSoftMaxFlashMinTmpSize接口参数列表

参数名输入/输出功能
srcShape输入输入srcTensor的shape信息,参数类型为AscendC::TensorShape
dataTypeSize输入参与计算的maxTensor和sumTensor的数据类型,比如half=2。
isUpdate输入是否开启刷新功能,和kernel侧SoftmaxFlash接口一致,默认false。
isReuseSource输入与kernel侧接口配置保持一致。

表2 SoftmaxFlash SoftMaxFlashTilingFunc接口参数列表

参数名输入/输出功能
srcShape输入输入srcTensor的shape信息,参数类型为AscendC::TensorShape
dataTypeSize输入参与计算的maxTensor和sumTensor的数据类型,比如half=2。
localWorkSpaceSize输入剩余的可供SoftmaxFlash接口计算的空间大小,单位为Byte。localWorkSpaceSize的取值必须大于GetSoftMaxFlashMinTmpSize接口返回的计算所需的最小临时空间大小。
isUpdate输入是否开启刷新功能,和kernel侧SoftmaxFlash接口一致,默认false。
softmaxFlashTiling输出输出SoftmaxFlash接口所需的tiling信息,支持optiling::SoftMaxTiling形式入参和AscendC::tiling::SoftMaxTiling形式入参。

返回值说明

GetSoftMaxFlashMaxTmpSize返回SoftmaxFlash接口能完成计算所需最大临时空间大小,单位为Byte。

GetSoftMaxFlashMinTmpSize返回SoftmaxFlash接口能完成计算所需最小临时空间大小,单位为Byte。

约束说明

免责声明:本站内容由 asc-devkit 仓 master 分支自动编译生成,属于持续开发版本,可能存在缺陷,仅供预览与参考。如需稳定及商用资料,请查阅官方 昇腾社区