SetKernelMode
Product Support
|
Product |
Supported |
|---|---|
|
|
√ |
|
|
√ |
|
|
√ |
|
|
√ |
|
|
x |
|
|
√ |
Function
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.
|
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, 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; } |