mmad与aiv 融合算子编程报错:Synchronize stream failed, error code is 507015
收藏回复举报
mmad与aiv 融合算子编程报错:Synchronize stream failed, error code is 507015
t('forum.solved') 已解决
发表于2025-07-11 10:44:20
0 查看

报错截图:

QQ20250711-100802.png

文字描述:
主要问题是在原来aic上mmad代码基础上加上aiv的代码后发现aiv的tensro始终为0,并显示同步流失败错误。具体的,我基于mmad示例进行了更改,更改为了可以分块矩阵乘法(不得到最终的大矩阵乘法结果,而是每个base小块进行完整矩阵乘法,具体可见gen_data中的逻辑),目前这部分aic逻辑验证已经正确。但是当我尝试加上AIV的逻辑的时候,即使没有涉及任何global memory等内容,结果却发现aiv的tensor仍然始终为0.

核心代码如下(详细内容可以见附件,附件中的gen_data文件主要是有关aic上更改的mmad算法相关内容,可能与本bug无关):
    

```c+++ 

    __aicore__ inline void Process() 

    { 

        int tileNum = singleCoreM * singleCoreN / (baseM * baseN); 

        // B是单位阵,只需要搬运一次 

        CopyInB(0); 

        SplitB(0); 

        AscendC::LocalTensor<half> b2Local = inQueueB2.DeQue<half>(); 

        for (int i = 0; i < tileNum; ++i) { 

            CopyInA(i); 

            SplitA(i); 

             

            SplitBias(i); 

            Compute(i,b2Local); 

            CopyOut(i); 

            // //aiv部分 (新加部分,出现bug)

            //copyin 

            AscendC::LocalTensor<float> xLocal = inQueueX.AllocTensor<float>(); 

            // AscendC::DataCopy(xLocal, tmpcGM, { baseM, (uint16_t)(baseN * sizeof(float) / 32), (uint16_t)((4096-128)*sizeof(float) / 32), 0 }); 

            // AscendC::DataCopy(xLocal, tmpcGM, 32*32); 

            float inputVal(2.0);  //出于debug目的,直接填充一个值 

            AscendC::Duplicate<float>(xLocal, inputVal, 32*32); 

            AscendC::printf("inputVal: %f,xLocal(0): %f\n", inputVal,xLocal(0));  //打印结果xLocal(0)始终为0 

             

            // AscendC::DumpTensor(tmpcGM, 0, baseM ); 

            // AscendC::DumpTensor(xLocal, 0, baseM ); 

            inQueueX.EnQue<float>(xLocal); 

            //comput reduceMax操作(todo) 

            AscendC::LocalTensor<float> xxLocal = inQueueX.DeQue<float>(); 

            AscendC::LocalTensor<float> zLocal = outQueueZ.AllocTensor<float>(); 

             

            // AscendC::DumpTensor(xxLocal, 1, baseM * baseN); 

            // AscendC::WholeReduceMax<float>(zLocal, xxLocal, 32, 32, 1, 1, 512, AscendC::ReduceOrder::ORDER_ONLY_VALUE); 

            // AscendC::DumpTensor(zLocal, 2, baseM * baseN); 

            outQueueZ.EnQue<float>(zLocal); 

            inQueueX.FreeTensor(xxLocal); 

            //copyout 

            AscendC::LocalTensor<float> zzLocal = outQueueZ.DeQue<float>();  

            // AscendC::DataCopy(tmpcGM, zzLocal, baseN);   

            outQueueZ.FreeTensor(zzLocal); 

        } 

        inQueueB2.FreeTensor(b2Local); 

    } 

``` 

问题相关文件(见附件)

环境配置信息(见附件)

用户类型:高校

应用目的:相关项目

我要发帖子