aclrtLaunchKernel

Applicability

Product

Supported

Atlas A3 training products/Atlas A3 inference products

Atlas A2 training products/Atlas A2 inference products

Atlas 200I/500 A2 inference products

Atlas inference products

Atlas training products

Description

Starts the compute task of the corresponding operator. This API is asynchronous. The operator is a custom operator developed using the Ascend C language.

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 device memory address that stores all input parameters of the kernel function.

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

The device that executes the task delivered by this API must be the same as the device that contains the memory used by argsData.

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

0 on success; else, failure. For details, see aclError.

See Also

All the APIs listed in the following table enable the compute tasks of the corresponding operators. However, their functions and usage modes are different.

API

How Kernel Function Parameter Values Are Passed

Where Kernel Function Parameter Values Are Stored

Configuration Customizable to Deliver

aclrtLaunchKernel

Specify the device memory address pointer for storing all input parameter data of the kernel function.

Device memory

No

aclrtLaunchKernelV2

Specify the device memory address pointer for storing all input parameter data of the kernel function.

Device memory

Yes

aclrtLaunchKernelWithConfig

Specify the parameter list handle aclrtArgsHandle.

Host memory

Yes

aclrtLaunchKernelWithHostArgs

Specify the host memory address pointer for storing all input parameter data of the kernel function.

Host memory

Yes