SetKernelMode

Supported Products

Product

Supported/Unsupported

Atlas A3 training products / Atlas A3 inference products

Atlas A2 training products / Atlas A2 inference products

Atlas 200I/500 A2 inference products

Atlas inference product 's AI Core

Atlas inference product 's Vector Core

x

Atlas training products

Functions

For separated mode, during CPU debugging, you can set the kernel mode to AIV, AIC, or MIX mode to support the debugging of single AIV vector operators, single AIC matrix operators, and MIX hybrid operators, respectively. If this API is not called, the MIX mode is used by default. To ensure that the operator code is compatible with multiple hardware platforms, this API can also be called in coupled mode. In this scenario, the API does not take effect and the debugging is not affected.

Prototype

1
void SetKernelMode(KernelMode mode)

Parameters

Parameter

Input/Output

Description

mode

Input

Kernel mode, which is used for CPU debugging of the AIC, AIV, and MIX operators. The parameter value can be AIC_MODE, AIV_MODE, or MIX_MODE.

1
2
3
4
5
enum class KernelMode {
    MIX_MODE = 0,
    AIC_MODE,
    AIV_MODE
};

Returns

None

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
int32_t main(int32_t argc, char* argv[])
{
    ...
#ifdef ASCENDC_CPU_DEBUG
    ...
    AscendC::SetKernelMode(KernelMode::AIV_MODE);
    ICPU_RUN_KF(add_custom, blockDim, x, y, z); // use this macro for cpu debug
    ...
    AscendC::GmFree((void *)x);
    AscendC::GmFree((void *)y);
    AscendC::GmFree((void *)z);
#else
    ...
#endif
    return 0;
}