Skip to content

as_symmetric: deduplicate repeated imports of the same tensor #499

@mawad-amd

Description

@mawad-amd

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:

  1. DMA-BUF export/import/map — full export_dmabuf_handlemem_import_from_shareable_handlemem_mapmem_set_access cycle each call
  2. VA space consumption — each call bumps current_offset, burning heap VA space for a redundant mapping to the same physical memory
  3. Collective peer refreshrefresh_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-296import_external_tensor
  • iris/symmetric_heap.py:276-298as_symmetric + unconditional refresh_peer_access()

Metadata

Metadata

Assignees

No one assigned

    Labels

    irisIris project issue

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions