ROCm / ROCm/iris

as_symmetric: deduplicate repeated imports of the same tensor

Open
#499 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

iris
Dominant language
Python
Stars
202
Forks
47
Avg merge
6d 11h
Merged PRs (30d)
4

Description

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()

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with iris/allocators/vmem_allocator.py:220-296 and inspect import_external_tensor(), including get_address_range and alloc_base handling. Then read iris/symmetric_heap.py:276-298 to trace as_symmetric() and refresh_peer_access(). Done means repeated imports reuse the existing VA mapping and avoid redundant peer refresh exchanges.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
distributed-systems
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.