Skip to content

asc_load_dev

产品支持情况

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

功能说明

头文件路径为:"c_api/scalar_compute/scalar_load.h"

不经过DCache直接从GM地址读取整型数据。 当多核操作GM地址且数据无法对齐到Cache Line时,经过DCache读写可能引入Cache Line粒度的数据覆盖。此时,可使用本接口绕过DCache读取GM数据。

函数原型

C++
__aicore__ inline int8_t asc_load_dev(__gm__ int8_t* addr)

__aicore__ inline uint8_t asc_load_dev(__gm__ uint8_t* addr)

__aicore__ inline int16_t asc_load_dev(__gm__ int16_t* addr)

__aicore__ inline uint16_t asc_load_dev(__gm__ uint16_t* addr)

__aicore__ inline int32_t asc_load_dev(__gm__ int32_t* addr)

__aicore__ inline uint32_t asc_load_dev(__gm__ uint32_t* addr)

__aicore__ inline int64_t asc_load_dev(__gm__ int64_t* addr)

__aicore__ inline uint64_t asc_load_dev(__gm__ uint64_t* addr)

参数说明

表1 参数说明

参数名输入/输出描述
addr输入源GM地址。支持的数据类型为int8_tuint8_tint16_tuint16_tint32_tuint32_tint64_tuint64_t

返回值说明

从GM读取的数据,返回值的数据类型与addr指向的数据类型一致。

流水类型

PIPE_S

约束说明

仅支持整型数据,不支持浮点类型。

调用示例

C++
// addr是外部输入的GM地址,类型为__gm__ int32_t*。
int32_t value = asc_load_dev(addr);

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