aclrtMemManagedRangeAttribute

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
typedef enum aclrtMemManagedRangeAttribute {
    ACL_MEM_RANGE_ATTRIBUTE_READ_MOSTLY  = 1,
    ACL_MEM_RANGE_ATTRIBUTE_PREFERRED_LOCATION,
    ACL_MEM_RANGE_ATTRIBUTE_ACCESSED_BY,
    ACL_MEM_RANGE_ATTRIBUTE_PREFERRED_LOCATION_TYPE,
    ACL_MEM_RANGE_ATTRIBUTE_PREFERRED_LOCATION_ID,
    ACL_MEM_RANGE_ATTRIBUTE_LAST_PREFETCH_LOCATION,
    ACL_MEM_RANGE_ATTRIBUTE_LAST_PREFETCH_LOCATION_TYPE,
    ACL_MEM_RANGE_ATTRIBUTE_LAST_PREFETCH_LOCATION_ID
} aclrtMemManagedRangeAttribute;

The enumerations are described as follows:

  • ACL_MEM_RANGE_ATTRIBUTE_READ_MOSTLY

    Queries whether the read-mostly attribute is set for the specified memory range.

    After setting ACL_MEM_ADVISE_SET_READ_MOSTLY or ACL_MEM_ADVISE_UNSET_READ_MOSTLY using the aclrtMemManagedAdvise call, you can use this option to query the value of the read-mostly attribute.

    If the read-mostly attribute is set for all memory pages in the specified memory range, 1 is returned. Otherwise, 0 is returned. Since the attribute value is an integer, dataSize must be set to 4.

  • ACL_MEM_RANGE_ATTRIBUTE_PREFERRED_LOCATION

    Queries whether the preferred location attribute is set for the specified memory range.

    After setting ACL_MEM_ADVISE_SET_PREFERRED_LOCATION or ACL_MEM_ADVISE_UNSET_PREFERRED_LOCATION using the aclrtMemManagedAdvise call, you can use this option to query the value of the preferred location attribute.

    The attribute values are described as follows:

    • If all memory pages in the specified memory range use the same device or NUMA node as their preferred location, the device ID or NUMA node ID is returned. Otherwise, -2 is returned.
    • If all memory pages in the specified memory range use the host as their preferred location, -1 is returned. Otherwise, -2 is returned.

    Since the attribute value is an integer, dataSize must be set to 4.

  • ACL_MEM_RANGE_ATTRIBUTE_ACCESSED_BY

    Queries whether the accessed-by attribute is set for the specified memory range.

    After setting ACL_MEM_ADVISE_SET_ACCESSED_BY or ACL_MEM_ADVISE_UNSET_ACCESSED_BY using the aclrtMemManagedAdvise call, you can use this option to query the value of the accessed-by attribute.

    The attribute value is a list of IDs for hosts, devices, or NUMA nodes for which the ACL_MEM_ADVISE_SET_ACCESSED_BY attribute is set within the specified memory range. Note the following:

    • If the user-allocated data array size is greater than the number of such hosts, devices, or NUMA nodes, -2 is returned for the excess part.
    • If the user-allocated data array size is smaller than the number of such hosts, devices, or NUMA nodes, the data array size is used. However, the IDs of the nodes where data is stored cannot be guaranteed.

    Since the attribute value is an integer, dataSize must be a non-zero integer multiple of 4.

  • ACL_MEM_RANGE_ATTRIBUTE_PREFERRED_LOCATION_TYPE

    Obtains the preferred location type of the specified memory range. Note that the actual location type of the memory page to be queried may differ from the preferred location type.

    If all memory pages in the specified memory range use the host, the same device, or the same NUMA node as their preferred location, ACL_MEM_LOCATIONTYPE_HOST, ACL_MEM_LOCATIONTYPE_DEVICE, or ACL_MEM_LOCATIONTYPE_HOST_NUMA is returned, respectively. Otherwise, ACL_MEM_LOCATIONTYPE_INVALID is returned.

    dataSize must be sizeof (aclrtMemManagedLocationType). data is parsed as specified by aclrtMemManagedLocationType.

  • ACL_MEM_RANGE_ATTRIBUTE_PREFERRED_LOCATION_ID

    Queries the ID of the preferred location for the specified memory range.

    If all memory pages in the specified memory range use the same device or NUMA node as their preferred location, the device ID or NUMA node ID is returned. Otherwise, the ID is invalid.

    Since the attribute value is an integer, dataSize must be set to 4.

  • ACL_MEM_RANGE_ATTRIBUTE_LAST_PREFETCH_LOCATION (reserved attribute)

    Queries the last location explicitly prefetched for the specified memory range through the prefetch API. The return value indicates only the location of the last memory range that the application requested to prefetch, not whether the prefetch operation has completed.

    The attribute values are described as follows:

    • If the last prefetch location of all memory pages in the specified memory range is a device or NUMA node, the device ID or NUMA node ID is returned. Otherwise, -2 is returned.
    • If the last prefetch location of all memory pages in the specified memory range is the host, -1 is returned. Otherwise, -2 is returned.

    Since the attribute value is an integer, dataSize must be set to 4.

  • ACL_MEM_RANGE_ATTRIBUTE_LAST_PREFETCH_LOCATION_TYPE (reserved attribute)

    Obtains the location type of the last explicit prefetch for the specified memory range through the prefetch API. The return value indicates only the location type of the last memory range that the application requested to prefetch, not whether the prefetch operation has completed.

    If the last prefetch location of all memory pages in the specified memory range is the host, the same device, or the same NUMA node, ACL_MEM_LOCATIONTYPE_HOST, ACL_MEM_LOCATIONTYPE_DEVICE, or ACL_MEM_LOCATIONTYPE_HOST_NUMA is returned, respectively. Otherwise, ACL_MEM_LOCATIONTYPE_INVALID is returned.

    dataSize must be sizeof (aclrtMemManagedLocationType). data is parsed as specified by aclrtMemManagedLocationType.

  • ACL_MEM_RANGE_ATTRIBUTE_LAST_PREFETCH_LOCATION_ID (reserved attribute)

    Queries the ID of the last location explicitly prefetched for the specified memory range through the prefetch API.

    If the last prefetch location of all memory pages in the specified memory range is the same device or NUMA node, the device ID or NUMA node ID is returned. Otherwise, the ID is invalid.

    Since the attribute value is an integer, dataSize must be set to 4.