aclrtMemcpyAsyncWithDesc

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

Copies memory using a memory copy descriptor (level-2 pointer mode). This API is asynchronous.

This API must be used together with the following APIs to implement memory copy:

  1. Call aclrtGetMemcpyDescSize to obtain the memory size required by the memory descriptor.
  2. Allocate the device memory for storing the memory descriptor.
  3. Allocate the source and destination memory for storing the data before and after the copy.
  4. Call aclrtSetMemcpyDesc to set the source and destination memory addresses in the memory descriptor.
  5. Call aclrtMemcpyAsyncWithDesc to implement memory copy.

Prototype

aclError aclrtMemcpyAsyncWithDesc(void *desc, aclrtMemcpyKind kind, aclrtStream stream)

Parameters

Parameter

Input/Output

Description

desc

Input

Pointer to the memory copy descriptor address on the device.

Call aclrtSetMemcpyDesc to set the memory copy descriptor, and then pass the pointer of the memory copy descriptor address as an input parameter.

kind

Input

Memory copy type.

Currently, only ACL_MEMCPY_INNER_DEVICE_TO_DEVICE is supported, indicating memory copy within a device.

stream

Input

Stream for executing the memory copy task.

Returns

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