Function: allocator_set_alloc_advise_func_to_desc

Applicability

Product

Supported (√/x)

Atlas A3 training products/Atlas A3 inference products

Atlas A2 training products/Atlas A2 inference products

Atlas training products

Atlas inference products

Atlas 200I/500 A2 inference products

Function Usage

Sets the callback function for allocating memory blocks based on recommended addresses when the user-provided allocator is used. This function is generally used in memory overcommitment scenario.

Prototype

  • C Prototype
    1
    aclError aclrtAllocatorSetAllocAdviseFuncToDesc(aclrtAllocatorDesc allocatorDesc, aclrtAllocatorAllocAdviseFunc func)
    
  • Python Function
    1
    ret = acl.rt.allocator_set_alloc_advise_func_to_desc(allocatorDesc, func)
    

Parameter Description

Parameter

Description

allocatorDesc

Int, pointer address of the allocator descriptor. Call acl.rt.allocator_create_desc to set the allocator description in advance.

func

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

    Callback function definition:

    def allocator_alloc_advise_func(allocator, size, addr):
        pass

Return Value Description

Return Value

Description

ret

Int, 0 on success; else, failure.