产品 |
是否支持 |
|---|---|
Ascend 950PR/Ascend 950DT |
√ |
√ |
|
√ |
|
x |
|
x |
|
x |
|
x |
不经过DCache从GM地址上读数据。
当多核操作GM地址时,如果数据无法对齐到Cache Line,经过DCache的方式下,由于按照Cache Line大小进行读写,会导致多核数据随机覆盖的问题。此时,可以采用不经过DCache直接读写GM地址的方式,从而避免上述随机覆盖的问题。
1 2 | template <typename T> __aicore__ inline T ReadGmByPassDCache(__gm__ T* addr) |
参数名 |
描述 |
|---|---|
T |
操作数的数据类型。 Ascend 950PR/Ascend 950DT,支持的数据类型为:int8_t、uint8_t、int16_t、uint16_t、int32_t、uint32_t、int64_t、uint64_t。 |
参数名 |
输入/输出 |
含义 |
|---|---|---|
addr |
输入 |
源GM地址。 |
源GM地址上的数据。
无
更多示例请参考GmByPassDCache类样例。
1 2 | __gm__ int32_t *addr = const_cast<__gm__ int32_t *>(srcGlobal.GetPhyAddr()); int32_t value = AscendC::ReadGmByPassDCache<int32_t>(addr); |