aclrtAllocatorGetByStream

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

Queries the information about a registered Allocator based on a stream.

Prototype

aclError aclrtAllocatorGetByStream(aclrtStream stream, aclrtAllocatorDesc *allocatorDesc, aclrtAllocator *allocator, aclrtAllocatorAllocFunc *allocFunc, aclrtAllocatorFreeFunc *freeFunc, aclrtAllocatorAllocAdviseFunc *allocAdviseFunc, aclrtAllocatorGetAddrFromBlockFunc *getAddrFromBlockFunc)

Parameters

Parameter

Input/Output

Description

stream

Input

Registration type, which is differentiated by submodule.

allocatorDesc

Output

Pointer to the Allocator descriptor.

allocator

Output

Pointer to a user-provided Allocator object.

allocFunc

Output

Callback function for allocating memory blocks.

Callback function definition:

typedef void *(*aclrtAllocatorAllocFunc)(aclrtAllocator allocator, size_t size);

freeFunc

Output

Callback function for freeing memory blocks.

Callback function definition:

typedef void (*aclrtAllocatorFreeFunc)(aclrtAllocator allocator, aclrtAllocatorBlock block);

allocAdviseFunc

Output

Callback function for allocating memory blocks based on the recommended addresses.

Callback function definition:

typedef void *(*aclrtAllocatorAllocAdviseFunc)(aclrtAllocator allocator, size_t size, aclrtAllocatorAddr addr);

getAddrFromBlockFunc

Output

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

Callback function definition:

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

Returns

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