aclrtAllocatorSetGetAddrFromBlockFuncToDesc

Description

Sets the callback function for obtaining the device memory address based on the allocated block when the user-provided Allocator is used.

Prototype

aclError aclrtAllocatorSetGetAddrFromBlockFuncToDesc(aclrtAllocatorDesc allocatorDesc, aclrtAllocatorGetAddrFromBlockFunc func)

Parameters

Parameter

Input/Output

Description

allocatorDesc

Input

Pointer to the Allocator descriptor.

Call aclrtAllocatorCreateDesc to set the Allocator description in advance.

func

Input

Callback function for obtaining the device memory address based on the allocated block.

Callback function definition:

typedef void *(*aclrtAllocatorGetAddrFromBlockFunc)(aclrtAllocatorBlock block);

aclrtAllocatorBlock definitions:

typedef void *aclrtAllocatorBlock;

Returns

The value 0 indicates success, and other values indicate failure. For details, see aclError.