aclrtAllocatorGetByStream

Applicability

Product

Supported

Atlas 350 Accelerator Card

Atlas A3 training product/Atlas A3 inference product

Atlas A2 training product/Atlas A2 inference product

Atlas 200I/500 A2 inference product

Atlas inference product

Atlas training product

Description

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

Prototype

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

allocatorDesc

Output

Pointer to the Allocator descriptor. For details about the type definition, see aclrtAllocatorDesc.

allocator

Output

Pointer to a user-provided Allocator object. For details about the type definition, see aclrtAllocator.

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.