---
title: GetPhyAddr
description: "| 产品 | 是否支持 |"
url: https://www.hiascend.com/document/detail/zh/canncommercial/latest/API/ascendcopapi/atlasascendc_api_07_00025.html
sourcePath: /source/zh/canncommercial/900/API/ascendcopapi/atlasascendc_api_07_00025.html
indexId: 12ff6c8b103d50f16193b6536b69f5b15e206a7e54e77e2db363f3442e3d652677
---
# GetPhyAddr

#### 产品支持情况

| 产品 | 是否支持 |
| --- | --- |
| Atlas 350 加速卡 | √ |
| Atlas A3 训练系列产品 / Atlas A3 推理系列产品 | √ |
| Atlas A2 训练系列产品 / Atlas A2 推理系列产品 | √ |
| Atlas 200I/500 A2 推理产品 | √ |
| Atlas 推理系列产品 AI Core | √ |
| Atlas 推理系列产品 Vector Core | √ |
| Atlas 训练系列产品 | √ |


#### 功能说明

获取全局数据的地址。


#### 函数原型

- 获取全局数据的地址
  1 __aicore__ inline const __gm__ PrimType* GetPhyAddr() const


- 获取全局数据（指定偏移offset个元素）的地址
  1 __aicore__ inline __gm__ PrimType* GetPhyAddr(const uint64_t offset) const


#### 参数说明


**表1 参数说明**

| 参数名 | 输入/输出 | 描述 |
| --- | --- | --- |
| offset | 输入 | 偏移的元素个数，用于指定数据的位置。 |


#### 返回值说明

全局数据的地址。


#### 约束说明

无。


#### 调用示例

```
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());
```
