DumpAccChkPoint

产品支持情况

产品

是否支持

Ascend 950PR/Ascend 950DT

√

Atlas A3 训练系列产品/Atlas A3 推理系列产品

√

Atlas A2 训练系列产品/Atlas A2 推理系列产品

√

Atlas 200I/500 A2 推理产品

x

Atlas 推理系列产品AI Core

√

Atlas 推理系列产品Vector Core

x

Atlas 训练系列产品

x

功能说明

基于算子工程开发的算子,可以使用该接口Dump指定Tensor的内容。同时支持打印自定义的附加信息(仅支持uint32_t数据类型的信息),比如打印当前行号等。区别于DumpTensor,使用该接口可以支持指定偏移位置的Tensor打印。

在算子kernel侧实现代码中需要打印偏移后Tensor数据的地方调用DumpAccChkPoint接口打印相关内容。样例如下:
1
AscendC::DumpAccChkPoint(srcLocal, 5, 32, dataLen);

DumpAccChkPoint接口打印功能会对算子实际运行的性能带来一定影响,通常在调测阶段使用。开发者可以按需通过设置ASCENDC_DUMP=0来关闭打印功能。

函数原型

1
2
3
4
template <typename T>
__aicore__ inline void DumpAccChkPoint(const LocalTensor<T> &tensor, uint32_t index, uint32_t countOff, uint32_t dumpSize)
template <typename T>
__aicore__ inline void DumpAccChkPoint(const GlobalTensor<T> &tensor, uint32_t index, uint32_t countOff, uint32_t dumpSize)

参数说明

表1 模板参数说明

参数名

描述

T

需要dump的Tensor的数据类型。

Ascend 950PR/Ascend 950DT,支持的数据类型为:bool、uint8_t、int8_t、int16_t、uint16_t、int32_t、uint32_t、int64_t、uint64_t、float、half、bfloat16_t。

Atlas A3 训练系列产品/Atlas A3 推理系列产品,支持的数据类型为:bool、uint8_t、int8_t、int16_t、uint16_t、int32_t、uint32_t、int64_t、uint64_t、float、half、bfloat16_t。

Atlas A2 训练系列产品/Atlas A2 推理系列产品,支持的数据类型为:bool、uint8_t、int8_t、int16_t、uint16_t、int32_t、uint32_t、int64_t、uint64_t、float、half、bfloat16_t。

Atlas 推理系列产品AI Core,支持的数据类型为:bool、uint8_t、int8_t、int16_t、uint16_t、int32_t、uint32_t、int64_t、uint64_t、float、half。

表2 参数说明

参数名

输入/输出

描述

tensor

输入

需要dump的Tensor。

待dump的tensor位于Unified Buffer/L1 Buffer/L0C Buffer时使用LocalTensor类型的tensor参数输入。

待dump的tensor位于Global Memory时使用GlobalTensor类型的tensor参数输入。

index

输入

用户自定义附加信息(行号或其他自定义数字)。

countOff

输入

偏移元素个数。偏移后的Tensor地址需要满足所在物理位置的对齐约束,具体参考通用说明和约束。

dumpSize

输入

需要dump的元素个数。

返回值说明

无

约束说明

调用示例

1
2
3
4
5
6
7
8
constexpr uint32_t totalLength = 256;    // 参与搬运的元素个数
AscendC::LocalTensor<half> srcLocal;
AscendC::GlobalTensor<half> srcGlobal;
AscendC::DataCopy(srcLocal, srcGlobal, totalLength * sizeof(half));
uint32_t index = 8;    // 用户自定义附加信息,此处传入DumpAccChkPoint指令的行号
uint32_t countOff = 32;    // 偏移元素个数,从srcLocal[32]开始打印
uint32_t dupmSize = 128;    // dump的元素个数,从srcLocal[32]开始打印128个元素个数
AscendC::DumpAccChkPoint(srcLocal, index, countOff, dupmSize);