aclrtAllocatorGetByStream

Applicable Products

Product

Supported

Ascend 950PR/Ascend 950DT

√

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

√

Function

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; otherwise, failure. For details, see aclError.