aclrtMemMallocPolicy

A single enumeration item or multiple enumeration items are supported.

  • Configure a single enumeration item:

    If either of the following conditions is met, the system applies for memory from the high-bandwidth or low-bandwidth physical memory based on the hardware support:

    • ACL_MEM_MALLOC_HUGE_FIRST
    • ACL_MEM_MALLOC_HUGE_ONLY
    • ACL_MEM_MALLOC_NORMAL_ONLY
    • ACL_MEM_MALLOC_HUGE_FIRST_P2P
    • ACL_MEM_MALLOC_HUGE_ONLY_P2P
    • ACL_MEM_MALLOC_NORMAL_ONLY_P2P

    If ACL_MEM_TYPE_LOW_BAND_WIDTH or ACL_MEM_TYPE_HIGH_BAND_WIDTH is configured, the system uses ACL_MEM_MALLOC_HUGE_FIRST by default and preferentially allocates huge pages.

  • Configure multiple enumeration item bits or:

    You can select one of the following two groups (for example, ACL_MEM_MALLOC_HUGE_FIRST | ACL_MEM_TYPE_HIGH_BAND_WIDTH):

    • ACL_MEM_MALLOC_HUGE_FIRST, ACL_MEM_MALLOC_HUGE_ONLY, ACL_MEM_MALLOC_NORMAL_ONLY
    • ACL_MEM_TYPE_LOW_BAND_WIDTH, ACL_MEM_TYPE_HIGH_BAND_WIDTH

Enumerated Item

Description

ACL_MEM_MALLOC_HUGE_FIRST = 0

When the requested memory is less than or equal to 1 MB, only normal page memory will be allocated. When the requested memory is greater than 1 MB, the huge page memory is preferentially allocated, and normal page memory will be allocated only when the huge page memory is insufficient.

ACL_MEM_MALLOC_HUGE_ONLY

Allocate only huge page memory. If the huge page memory is insufficient, an error is returned.

ACL_MEM_MALLOC_NORMAL_ONLY

Allocate only normal page memory. If the normal page memory is insufficient, an error is returned.

ACL_MEM_MALLOC_HUGE_FIRST_P2P

Applicable to inter-device memory copy. Prioritize the allocation of huge page memory. If huge page memory is insufficient, allocate normal page memory.

The Atlas 200/300/500 Inference Product does not support this option in the current version.

ACL_MEM_MALLOC_HUGE_ONLY_P2P

Applicable to inter-device memory copy. Allocate only huge page memory. If the huge page memory is insufficient, an error is returned.

The Atlas 200/300/500 Inference Product does not support this option in the current version.

ACL_MEM_MALLOC_NORMAL_ONLY_P2P

Applicable to inter-device memory copy. Allocate only normal page memory.

The Atlas 200/300/500 Inference Product does not support this option in the current version.

ACL_MEM_TYPE_LOW_BAND_WIDTH

Allocate memory from the physical memory with high bandwidth.

ACL_MEM_TYPE_HIGH_BAND_WIDTH

Allocate memory from the physical memory with low bandwidth.