aclrtMemAttr

Data Format

Description

ACL_DDR_MEM = 0

DDR memory, that is, all huge page memory and normal page memory on the DDR

ACL_HBM_MEM = 1

High bandwidth memory, including all huge pages and common pages.

ACL_DDR_MEM_HUGE = 2

DDR hugepage memory.

ACL_DDR_MEM_NORMAL = 3

Normal DDR memory.

ACL_HBM_MEM_HUGE = 4

Huge page of on-chip memory.

ACL_HBM_MEM_NORMAL = 5

Common page of on-chip memory.

ACL_DDR_MEM_P2P_HUGE = 6

Huge page memory for inter-device memory copy.

ACL_DDR_MEM_P2P_NORMAL = 7

Normal page memory for inter-device memory copy.

ACL_HBM_MEM_P2P_HUGE = 8

Huge page memory for inter-device memory copy.

ACL_HBM_MEM_P2P_NORMAL = 9

Normal page memory for inter-device memory copy.

ACL_HBM_MEM_HUGE1G = 10

Huge page, the memory allocation granularity is 1 GB. If the memory is less than 1 GB, it is rounded up to 1 GB.

ACL_HBM_MEM_P2P_HUGE1G = 11

Huge page memory for inter-device memory copy. The memory allocation granularity is 1 GB. If the memory is less than 1 GB, it is rounded up to 1 GB.

The preceding options are compatible with earlier versions. You need to select memory attribute options that match the hardware memory (DDR or on-chip memory).

The following options automatically select DDR or on-chip memory based on the underlying hardware memory. You do not need to pay attention to hardware details. The following options are recommended.

ACL_MEM_NORMAL = 12

Normal DDR memory.

ACL_MEM_HUGE = 13

Huge page, the memory allocation granularity is 2 MB. If the memory is less than 2 MB, it is rounded up to 2 MB.

ACL_MEM_HUGE1G = 14

Huge page, the memory allocation granularity is 1 GB. If the memory is less than 1 GB, it is rounded up to 1 GB.

ACL_MEM_P2P_NORMAL = 15

Normal page memory for inter-device memory copy.

ACL_MEM_P2P_HUGE = 16

Huge page memory for inter-device memory copy. The memory allocation granularity is 2 MB. If the memory is less than 2 MB, it is rounded up to 2 MB.

ACL_MEM_P2P_HUGE1G = 17

Huge page memory for inter-device memory copy. The memory allocation granularity is 1 GB. If the memory is less than 1 GB, it is rounded up to 1 GB.

To allocate a huge page of 1 GB, if the allocation granularity is 2 MB, 512 (1024/2) page tables are used. If the allocation granularity is 1 GB, only one page table is used by the huge page of 1 GB. This reduces the number of page tables, expands the address range of the translation lookaside buffer (TLB), and improves the discrete access performance. TLB is a hardware module in the AI processor used for caching. It stores the mapping between the recently used virtual addresses and physical addresses.

HUGE1G-related options are supported only for the Atlas A3 training products/Atlas A3 inference products and Atlas A2 training products/Atlas A2 inference products.

Currently, HUGE1G-related options are not supported for other models.