|
产品 |
是否支持 |
|---|---|
|
|
√ |
|
|
√ |
|
|
x |
|
|
√ |
|
|
x |
|
|
x |
|
|
x |
基于算子工程开发的算子,可以使用该接口Dump指定Tensor的内容。同时支持打印自定义的附加信息(仅支持uint32_t数据类型的信息),比如打印当前行号等。区别于DumpTensor,使用该接口可以支持指定偏移位置的Tensor打印。
1
|
AscendC::DumpAccChkPoint(srcLocal,5, 32, dataLen); |
Dump时,每个block核的dump信息前会增加对应信息头DumpHead(32字节大小),用于记录核号和资源使用信息;每次Dump的Tensor数据前也会添加信息头DumpTensorHead(32字节大小),用于记录Tensor的相关信息。如下图所示,展示了多核打印场景下的打印信息结构。

DumpHead的具体信息如下:
DumpHead打印时,除了上述打印还会自动打印当前所运行核的类型及对应的该类型下的核索引,如:AIV-0。
DumpTensorHead的具体信息如下:
DumpAccChkPoint打印结果的最前面会自动打印CANN_VERSION_STR值与CANN_TIMESTAMP值。其中,CANN_VERSION_STR与CANN_TIMESTAMP为宏定义,CANN_VERSION_STR代表CANN软件包的版本号信息,形式为字符串,CANN_TIMESTAMP为CANN软件包发布时的时间戳,形式为数值(uint64_t)。开发者也可在代码中直接使用这两个宏。
打印结果的样例如下:
1 2 3 4 5 6 7 |
opType=AddCustom, DumpHead: AIV-0, CoreType=AIV, block dim=8, total_block_num=8, block_remain_len=1046912, block_initial_space=1048576, rsv=0, magic=5aa5bccd CANN Version: XX.XX,TimeStamp: XXXXXXXXXXXXXXXXX DumpTensor: desc=5, addr=40, data_type=float16, position=UB [16.000000, 22.000000, 2.000000, 3.000000, 58.000000, 62.000000, 33.000000, 74.000000, 51.000000, 69.000000, 61.000000, 9.000000, 53.000000, 35.000000, 14.000000, 43.000000, 20.000000, 43.000000, 92.000000, 84.000000, 9.000000, 6.000000, 78.000000, 53.000000, 52.000000, 33.000000, 51.000000, 61.000000, 92.000000, 45.000000, 39.000000,34.000000] ... DumpTensor: desc=5, addr=140, data_type=float16, position=UB [41.000000, 91.000000, 12.000000, 32.000000, 28.000000, 49.000000, 2.000000, 75.000000, 11.000000, 32.000000, 17.000000, 31.000000, 70.000000, 38.000000, 76.000000, 87.000000, 61.000000, 8.000000, 55.000000, 70.000000, 17.000000, 37.000000, 35.000000, 58.000000, 94.000000, 31.000000, 50.000000, 29.000000, 13.000000, 37.000000, 79.000000,29.000000] |
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) |
|
参数名 |
描述 |
|---|---|
|
T |
需要dump的Tensor的数据类型。支持的数据类型为uint8_t/int8_t/int16_t/uint16_t/int32_t/uint32_t/int64_t/uint64_t/float/half/bfloat16_t。 |
|
参数名 |
输入/输出 |
描述 |
|---|---|---|
|
tensor |
输入 |
需要dump的Tensor。 待dump的tensor位于Unified Buffer/L1 Buffer/L0C Buffer时使用LocalTensor类型的tensor参数输入。 待dump的tensor位于Global Memory时使用GlobalTensor类型的tensor参数输入。 |
|
index |
输入 |
用户自定义附加信息(行号或其他自定义数字)。 |
|
countOff |
输入 |
偏移元素个数。 |
|
dumpSize |
输入 |
需要dump的元素个数。 |
无
1
|
AscendC::DumpAccChkPoint(srcLocal, 7, 32 , 128); |