产品 |
是否支持 |
|---|---|
Ascend 950PR/Ascend 950DT |
√ |
√ |
|
√ |
|
x |
|
√ |
|
x |
|
x |
在Kernel侧调用,NPU模式下会中断AI Core的运行,CPU模式下等同于assert。可用于Kernel侧异常场景的调试。
1 | __aicore__ inline void Trap() |
无
无
无。
1 2 3 4 5 6 7 8 9 | AscendC::LocalTensor<half> src0Local; AscendC::LocalTensor<half> src1Local; AscendC::LocalTensor<half> dstLocal; constexpr int32_t count = 512; // 参与计算的元素个数 if (src1Local[0] == 0) { // 如果除数为0,则报异常 AscendC::Trap(); } else { AscendC::Divs(dstLocal, src0Local, src1Local[0], 512); } |