Skip to content

GetPhyAddr

产品支持情况​

  • Ascend 950PR&950DT系列产品:支持
  • Atlas A3系列产品:支持
  • Atlas A2系列产品:支持
  • Atlas 200I/500 A2推理产品:支持
  • Atlas推理系列产品AI Core:支持
  • Atlas推理系列产品Vector Core:支持
  • Atlas训练系列产品:支持

功能说明​

获取全局数据的地址。

函数原型​

  • 获取全局数据的地址

    C++
    __aicore__ inline const __gm__ PrimType* GetPhyAddr() const
    
  • 获取全局数据(指定偏移offset个元素)的地址

    C++
    __aicore__ inline __gm__ PrimType* GetPhyAddr(const uint64_t offset) const
    

参数说明​

表1 参数说明

参数名

输入/输出

描述

offset

输入

偏移的元素个数,用于指定数据的位置。

返回值说明​

全局数据的地址。

约束说明​

无。

调用示例​

C++
template <typename T>
__aicore__ inline void CopyIn(const AscendC::GlobalTensor<T>& input)
{
    AscendC::GlobalTensor<T> output;
    output.SetGlobalBuffer(input.GetPhyAddr(0), input.GetSize());
    // ...
}

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