aclrtLaunchKernel

Description

Starts the computation task of a kernel. Only Ascend C custom operators are supported.

Restrictions

This API is asynchronous. The API call delivers a task rather than executes a task. After this API is called, you need to call a synchronization API (for example, aclrtSynchronizeStream) to ensure that the task is complete. Otherwise, service exceptions (such as training or inference exception) or unknown situations (such as device link or card disconnection) may occur.

Prototype

aclError aclrtLaunchKernel(aclrtFuncHandle funcHandle, uint32_t blockDim, const void *argsData, size_t argsSize, aclrtStream stream)

Parameters

Parameter

Input/Output

Description

funcHandle

Input

funcHandle obtained by the aclrtBinaryGetFunction call based on kernelName.

blockDim

Input

Number of cores on which a kernel function will be executed.

argsData

Input

Pointer to the memory address of the device that stores all input parameters of the kernel.

For details about the memory allocation APIs, see Memory Management.

argsSize

Input

Value of argsData, in bytes.

stream

Input

Stream for executing a task, which can be a created stream for saving resources or newly created by the aclrtCreateStream API call.

Returns

The value 0 indicates success, and other values indicate failure. For details, see aclError.