Problem
Calling as_symmetric() twice on the same external tensor (or on tensors backed by the same physical allocation) repeats all the work with no deduplication:
- DMA-BUF export/import/map — full
export_dmabuf_handle → mem_import_from_shareable_handle → mem_map → mem_set_access cycle each call
- VA space consumption — each call bumps
current_offset, burning heap VA space for a redundant mapping to the same physical memory
- Collective peer refresh —
refresh_peer_access() fires every time, triggering TCP FD exchange + barriers across all ranks
Suggested fix
Add a lookup in VMemAllocator.import_external_tensor() keyed on alloc_base (from get_address_range). If the same physical allocation was already imported, return a view into the existing VA mapping at the correct offset instead of creating a new one.
Should also batch refresh_peer_access() — if the same segments are already mapped on peers, skip the re-exchange.
References
iris/allocators/vmem_allocator.py:220-296 — import_external_tensor
iris/symmetric_heap.py:276-298 — as_symmetric + unconditional refresh_peer_access()
Problem
Calling
as_symmetric()twice on the same external tensor (or on tensors backed by the same physical allocation) repeats all the work with no deduplication:export_dmabuf_handle→mem_import_from_shareable_handle→mem_map→mem_set_accesscycle each callcurrent_offset, burning heap VA space for a redundant mapping to the same physical memoryrefresh_peer_access()fires every time, triggering TCP FD exchange + barriers across all ranksSuggested fix
Add a lookup in
VMemAllocator.import_external_tensor()keyed onalloc_base(fromget_address_range). If the same physical allocation was already imported, return a view into the existing VA mapping at the correct offset instead of creating a new one.Should also batch
refresh_peer_access()— if the same segments are already mapped on peers, skip the re-exchange.References
iris/allocators/vmem_allocator.py:220-296—import_external_tensoriris/symmetric_heap.py:276-298—as_symmetric+ unconditionalrefresh_peer_access()