__trap

Applicability

Product

Supported

Atlas 350 Accelerator Card

Atlas A3 training product/Atlas A3 inference product

x

Atlas A2 training product/Atlas A2 inference product

x

Atlas 200I/500 A2 inference product

x

Atlas inference product AI Core

x

Atlas inference product Vector Core

x

Atlas training product

x

Function Usage

Calling this API in the SIMT VF implementation code will interrupt the execution of an operator. This API is applicable to debug abnormal scenarios on the kernel side.

Prototype

1
__simt_callee__ inline void __trap()

Parameters

None

Returns

None

Restrictions

None

Header Files to Be Included

To use this API, the utils/debug/asc_assert.h header file must be included.

1
#include "utils/debug/asc_assert.h"

Examples

1
2
3
4
5
6
7
8
__simt_vf__ __launch_bounds__(1024) inline void SimtKernel(__gm__ bool* dst, __gm__ float* x)
{
    int idx = threadIdx.x + blockIdx.x * blockDim.x;
    if (isnan(x[idx])) {
        __trap();
    }
    dst[idx] = x[idx];
}