aclrtLaunchKernelWithArgsArray
Applicable Products
Product |
Supported |
|---|---|
√ |
|
√ |
|
√ |
|
√ |
|
√ |
|
√ |
Function
Passes kernel function input parameters through a parameter array and starts the compute task of an operator. This is an asynchronous API.
Prototype
1 | aclError aclrtLaunchKernelWithArgsArray(void *func, uint32_t numBlocks, aclrtStream stream, aclrtLaunchKernelCfg *cfg, void **args) |
Parameters
Parameter |
Input/Output |
Description |
|---|---|---|
func |
Input |
Pointer to the kernel function. The value can be the kernel function name (for example, myKernel) declared by _global__ or the kernel function handle of the aclrtFuncHandle type. |
numBlocks |
Input |
Number of cores on which the kernel function will be executed. |
stream |
Input |
Stream for executing the task. For details about the type definition, see aclrtStream. |
cfg |
Input |
Task configuration. For details about the type definition, see aclrtLaunchKernelCfg. If no configuration is specified, NULL can be passed. |
args |
Input |
Pointer to the parameter array. Each element in the array points to the host-side memory address of the value of a kernel function parameter. |
Returns
0 on success; otherwise, failure. For details, see aclError.
Restrictions
The sequence of elements in the parameter array must be the same as that of kernel function parameters, and the size of the parameter array must be the same as the number of kernel function parameters. Otherwise, undefined behavior may occur.
Reference
All the APIs listed in the table below can start the compute task of an operator. However, their functions and usage methods are different.
API |
How Kernel Function Parameter Values Are Passed |
Where Kernel Function Parameter Values Are Stored |
Task Configurable |
|---|---|---|---|
Specify the pointer to the device memory address that stores all input parameters of the kernel function. |
Device memory |
No |
|
Specify the pointer to the device memory address that stores all input parameters of the kernel function. |
Device memory |
Yes |
|
Specify the parameter list handle aclrtArgsHandle. |
Host memory |
Yes |
|
Specify the pointer to the host memory address that stores all input parameters of the kernel function. |
Host memory |
Yes |
|
Specify the parameter array that stores all input parameters of the kernel function. Each element in the array points to the data of a kernel function parameter. |
Host memory |
Yes |