使用工具进行算子调测时,支持指定偏移位置的Tensor打印。该功能与DumpTensor功能类似,其使用更加灵活。
当Tensor数据较大时,可通过DumpAccChkPoint指定偏移位置,截取指定长度的元素值打印。
DumpAccChkPoint(srcLocal, 5, 32, dataLen);
ascendebug kernel --backend npu --dump-mode acc_chk ... {其他NPU调测参数}
--dump-mode取acc_chk,开启偏移位置打印Tensor模式,其他参数参考NPU调测参数按需配置。
Dump偏移位置Tensor数据存放在${root}/${work_dir}/npu路径下,其目录结构、结果说明与DumpTensor功能类似,此处不再赘述。
DumpAccChkPoint(srcLocal, 5, 32, dataLen);
compile_npu_options = ascendebug.CompileNpuOptions(dump_mode='acc_chk') name, kernel_file, extern = op_executor.compile_custom_npu(customize_path, tiling_info.tiling_key, compile_npu_options) npu_compile_info = ascendebug.NpuCompileInfo(syncall=extern['cross_core_sync'], task_ration=extern['task_ration'], dump_mode='acc_chk') run_npu_options = ascendebug.RunNpuOptions() op_executor.run_npu(kernel_file, run_npu_options, npu_compile_info=npu_compile_info, tiling_info=tiling_info)
Dump偏移位置Tensor数据存放在${root}/${work_dir}/npu路径下,其目录结构、结果说明与DumpTensor功能类似,此处不再赘述。
函数原型 |
|
|
函数功能 |
支持指定偏移位置的Tensor打印。 |
|
参数(IN) |
tensor |
用户需要Dump的Tensor。多个DumpTensor调用时,不可重复。
|
desc |
用户自定义附加信息(行号或其他自定义数字)。 |
|
offset |
偏移元素个数。 |
|
dumpNum |
需要Dump的元素个数。 |
|
参数(OUT) |
NA |
- |
返回值 |
NA |
- |
使用约束 |
|
|
调用示例 |
DumpAccChkPoint(srcLocal, 7, 32 , 128); |