GetPhyAddr

Applicability

Product

Supported

Atlas 350 Accelerator Card

Atlas A3 training product/Atlas A3 inference product

Atlas A2 training product/Atlas A2 inference product

Atlas 200I/500 A2 inference product

Atlas inference product AI Core

Atlas inference product Vector Core

Atlas training product

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

Table 1 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();