产品 |
是否支持 |
|---|---|
Ascend 950PR/Ascend 950DT |
√ |
√ |
|
√ |
|
√ |
|
√ |
|
√ |
|
√ |
获取全局数据的地址。
1 | __aicore__ inline const __gm__ PrimType* GetPhyAddr() const |
1 | __aicore__ inline __gm__ PrimType* GetPhyAddr(const uint64_t offset) const |
参数名 |
输入/输出 |
描述 |
|---|---|---|
offset |
输入 |
偏移的元素个数,用于指定数据的位置。 |
全局数据的地址。
无。
1 2 3 4 5 | AscendC::LocalTensor<T> xLocal = inQueueX.DeQue<T>(); AscendC::LocalTensor<T> yLocal = outQueueY.AllocTensor<T>(); // 调用GetPhyAddr()返回LocalTensor地址,CPU上返回的是指针类型(T*),NPU上返回的是物理存储的地址(uint64_t) __ubuf__ T* srcAddr = reinterpret_cast<__ubuf__ T*>(xLocal.GetPhyAddr()); __ubuf__ T* dstAddr = reinterpret_cast<__ubuf__ T*>(yLocal.GetPhyAddr()); |