aclrtMemcpyAsyncWithDesc

Applicable Products

Product

Supported

Ascend 950PR/Ascend 950DT

√

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

☓

Function

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

This API must be used 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

1
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 of this parameter.

kind

Input

Memory copy kind. For details about the type definition, see aclrtMemcpyKind.

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. For details about the type definition, see aclrtStream.

Returns

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