Function: set_memcpy_desc

Applicability

Product

Supported

Atlas 350 Accelerator Card

Atlas A3 training product/Atlas A3 inference product

Atlas A2 training product/Atlas A2 inference product

Atlas training product

x

Atlas inference product

x

Atlas 200I/500 A2 inference product

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 needs to work with other key APIs to implement memory copy. For details, see acl.rt.memcpy_async_with_desc.

Prototype

  • C Prototype
    1
    aclError aclrtSetMemcpyDesc(void *desc, aclrtMemcpyKind kind, void *srcAddr, void *dstAddr, size_t count, void *config)
    
  • Python Function
    1
    desc, ret = acl.rt.set_memcpy_desc(desc, kind, src_addr, dst_addr, count, config)
    

Parameters

Parameter

Description

desc

Int, pointer to the memory copy descriptor.

Call the acl.rt.get_memcpy_desc_size API to obtain the memory size required by the memory descriptor, allocate the device memory (for example, the acl.rt.malloc API), and pass the device memory address as the input parameter.

kind

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

src_addr

Int, pointer to the source memory address. The user applies for and manages the memory.

dst_addr

Int, pointer to the destination memory address. The user applies for and manages the memory.

count

Int, size in bytes to copy.

config

Int, reserved; fixed at 0.

Return Value

Return Value

Description

desc

Int, pointer to the memory copy descriptor.

ret

Int, error code. 0 on success; else, failure.