aclrtSetMemcpyDesc

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

Sets the memory copy descriptor. After this API is called, the source address, destination address, and memory copy length are recorded in the memory copy descriptor.

This API must be used together with other key APIs to implement memory copy. For details, see aclrtMemcpyAsyncWithDesc.

Prototype

aclError aclrtSetMemcpyDesc(void *desc, aclrtMemcpyKind kind, void *srcAddr, void *dstAddr, size_t count, void *config)

Parameters

Parameter

Input/Output

Description

desc

Output

Pointer to the memory copy descriptor.

First call aclrtGetMemcpyDescSize to obtain the memory size required by the memory descriptor, allocate device memory (for example, by calling aclrtMalloc), and pass the device memory address as an input.

kind

Input

Memory copy type.

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

srcAddr

Input

Pointer to the source memory address.

The memory is allocated and managed by users.

dstAddr

Input

Pointer to the destination memory address.

The memory is allocated and managed by users.

count

Input

Size in bytes to copy.

config

Input

Reserved. The value is fixed at NULL.

Returns

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