GetPhyAddr
Applicability
Product |
Supported |
|---|---|
Atlas 350 Accelerator Card |
√ |
√ |
|
√ |
|
√ |
|
√ |
|
√ |
|
√ |
Function Usage
Returns the address of the LocalTensor, or the address obtained by adding the specified offset to the base address.
Prototype
1 2 | __aicore__ inline uint64_t GetPhyAddr() const __aicore__ inline uint64_t GetPhyAddr(const uint32_t offset) const |
Parameters
Parameter |
Input/Output |
Description |
|---|---|---|
offset |
Input |
Offset. |
Returns
Returns the address of the LocalTensor, or the address obtained by adding the specified offset to the base address.
Restrictions
None
Examples
// Example // Call GetPhyAddr() to return the LocalTensor address. On the CPU, a pointer (T*) is returned, while on the NPU, a physical storage address (uint64_t) is returned. #ifdef ASCEND_CPU_DEBUG float *inputLocalCpuPtr = inputLocal.GetPhyAddr(); uint64_t realAddr = (uint64_t)inputLocalCpuPtr - (uint64_t)(GetTPipePtr()->GetBaseAddr(static_cast<int8_t>(AscendC::TPosition::VECCALC))); #else uint64_t realAddr = inputLocal.GetPhyAddr();
Parent topic: LocalTensor