SetKernelMode

Applicability

Product

Supported

Atlas 350 Accelerator Card

Atlas A3 training product / Atlas A3 inference product

Atlas A2 training product / Atlas A2 inference product

Atlas 200I/500 A2 inference product

Atlas inference product AI Core

Atlas inference product Vector Core

x

Atlas training product

Function Usage

Sets the kernel mode to single AIV mode, single AIC mode, or MIX mode for separated mode to support CPU debugging of single AIV vector operators, single AIC cube operators, or MIX 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

Example

 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, numBlocks, 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;
}