AscendC kernel中使用printf和DumpTensor无输出
收藏回复举报
回复仅回复人和楼主可见
AscendC kernel中使用printf和DumpTensor无输出
t('forum.solved') 已解决
新人帖
发表于2025-11-23 16:55:56
0 查看

代码如下,昇腾920B3,无语法问题编译通过,控制台日志都无输出

AscendC::PRINTF("[MY_DEBUG] ProcessRow start, row=%d\n", row);

        AscendC::DumpTensor(aIndptrGm,1234,20);

        int32_t rowStartIdx = aIndptrGm.GetValue(row);

        int32_t rowEndIdx = aIndptrGm.GetValue(row + 1);

        int32_t nnzInRow = rowEndIdx - rowStartIdx;

        // 将标量值包装成 LocalTensor 后 dump

        AscendC::LocalTensor<int32_t> debugInfo = outQueueC.AllocTensor<int32_t>();

        debugInfo.SetValue(0, row);

        debugInfo.SetValue(1, rowStartIdx);

        debugInfo.SetValue(2, rowEndIdx);

        debugInfo.SetValue(3, nnzInRow);

       

        // Dump 调试信息

        AscendC::DumpTensor(debugInfo, 9999, 4);  // dump 前 4 个元素

       

        outQueueC.FreeTensor(debugInfo);

本帖最后由 匿名用户2025/11/25 13:42:15 编辑

我要发帖子