Managed memory pools support a "preferred location" that hints where allocations should reside (device, host, or a specific host NUMA node). The current ManagedMemoryResourceOptions.preferred_location field only accepts a device ordinal, -1 for host, or None — there is no way to specify a NUMA node, and no way to query the resolved location after construction.
Prompted by this review comment on PR #1699, which identified that ManagedMemoryResource.device_id was insufficient for querying the preferred location.
Changes
Extend ManagedMemoryResourceOptions with a preferred_location_type field and add a ManagedMemoryResource.preferred_location query property. The default type, None, matches the previous behavior. Valid inputs are shown below:
preferred_location_type |
preferred_location |
Driver location type |
Meaning |
None |
None |
NONE |
No preference (legacy) |
None |
-1 |
HOST |
Host (legacy) |
None |
0 |
DEVICE |
Device 0 (legacy) |
"device" |
0 |
DEVICE |
Device 0 |
"host" |
None |
HOST |
Host |
"host_numa" |
3 |
HOST_NUMA |
NUMA node 3 |
"host_numa" |
None |
HOST_NUMA |
Current device's NUMA node (auto-resolved) |
Managed memory pools support a "preferred location" that hints where allocations should reside (device, host, or a specific host NUMA node). The current
ManagedMemoryResourceOptions.preferred_locationfield only accepts a device ordinal,-1for host, orNone— there is no way to specify a NUMA node, and no way to query the resolved location after construction.Prompted by this review comment on PR #1699, which identified that
ManagedMemoryResource.device_idwas insufficient for querying the preferred location.Changes
Extend
ManagedMemoryResourceOptionswith apreferred_location_typefield and add aManagedMemoryResource.preferred_locationquery property. The default type,None, matches the previous behavior. Valid inputs are shown below:preferred_location_typepreferred_locationNoneNoneNONENone-1HOSTNone0DEVICE"device"0DEVICE"host"NoneHOST"host_numa"3HOST_NUMA"host_numa"NoneHOST_NUMA