asc_icache_preload

产品支持情况

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

功能说明

从指令所在GM地址预加载数据到对应的cacheline中。

开发者手动调用该接口,能够从指令所在GM地址预加载指令到ICache中。

函数原型

__aicore__ inline void asc_icache_preload(const void* addr, int64_t prefetch_len)

参数说明

表1 参数说明

参数名 输入/输出 描述
addr 输入 预加载数据的地址。
prefetch_len 输入 预加载数据的长度,单位为2K Byte,取值需满足 prefetch_len<ICache大小2K\text{prefetch\_len} < \dfrac{\text{ICache大小}}{2K}。其中,AIC和AIV的ICache大小分别为32KB和16KB。

返回值说明

流水类型

PIPE_S

约束说明

prefetch_len参数单位为2K Byte,取值需满足 prefetch_len<ICache大小2K\text{prefetch\_len} < \dfrac{\text{ICache大小}}{2K}。其中,AIC和AIV的ICache大小分别为32KB和16KB。

调用示例

int64_t prefetch_length = 32;
int64_t pc = asc_get_program_counter() & 0xFFFFFFFFFFFF;
asc_icache_preload(reinterpret_cast<void *>(pc), prefetch_length);