Skip to content

Sort MemTile ObjectFifos by buffer size and spill to least-used neighbor#3116

Open
yenjames wants to merge 3 commits into
mainfrom
memtile-buffer-sort
Open

Sort MemTile ObjectFifos by buffer size and spill to least-used neighbor#3116
yenjames wants to merge 3 commits into
mainfrom
memtile-buffer-sort

Conversation

@yenjames
Copy link
Copy Markdown
Collaborator

Summary

  • Sort MemTile-producer ObjectFifos by buffer size descending before
    allocation, giving large buffers priority for home MemTile placement
    and spill target selection. Non-MemTile fifos keep their original IR
    positions undisturbed.
  • Sort neighbor tiles by remaining capacity (ascending) when spilling,
    preferring the neighbor with more room to avoid blocking adjacent
    MemTiles that also need spill space.

Changes

  • AIEObjectFifoStatefulTransform.cpp: Extract MemTile-producer fifos,
    stable_sort by buffer size descending, re-insert at original slots.
    Neighbor tiles stable_sorted by used memory ascending before spill
    iteration.
  • memtile_spill_order.mlir: Three MemTile fifos where IR-order
    allocation fails but size-sorted allocation succeeds.

yenjames added 3 commits May 26, 2026 11:16
When multiple MemTile ObjectFifos need to spill buffers to adjacent
tiles, IR order can cause suboptimal allocation where large buffers
find no spill room because smaller ones already consumed neighbor
capacity.

Sort MemTile-producer ObjectFifos by buffer size descending before
allocation so large buffers get priority. Also sort neighbor tiles
by remaining capacity when spilling, preferring the neighbor with more room.
@github-actions
Copy link
Copy Markdown
Contributor

Coverage Report

Created: 2026-05-27 17:24

Click here for information about interpreting this report.

FilenameFunction CoverageLine CoverageRegion CoverageBranch Coverage
home/runner/work/mlir-aie/mlir-aie/lib/Dialect/AIE/Transforms/AIEObjectFifoStatefulTransform.cpp 100.00% 94.88% 92.71% 86.00%
Totals 100.00% 94.88% 92.71% 86.00%
Generated by llvm-cov -- llvm version 18.1.3

@yenjames yenjames marked this pull request as ready for review May 28, 2026 22:56
Copilot AI review requested due to automatic review settings May 28, 2026 22:56
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the ObjectFifo stateful transform’s MemTile allocation heuristic to prioritize larger MemTile buffers and choose less-used adjacent MemTiles for spill placement, with tests adjusted to be less sensitive to resulting IR emission order.

Changes:

  • Sorts MemTile-producer ObjectFifos by per-buffer size before creating buffers/locks.
  • Sorts candidate spill neighbor MemTiles by current memory usage before allocation.
  • Adds a MemTile spill-order regression test and updates existing FileCheck patterns to tolerate reordered output.

Reviewed changes

Copilot reviewed 10 out of 10 changed files in this pull request and generated no comments.

Show a summary per file
File Description
lib/Dialect/AIE/Transforms/AIEObjectFifoStatefulTransform.cpp Adds MemTile FIFO size ordering and least-used-neighbor spill ordering.
test/objectFifo-stateful-transform/adjacent_memtile_allocation/memtile_spill_order.mlir Adds regression coverage for size-prioritized MemTile spill allocation.
test/objectFifo-stateful-transform/repeat_count/link_repeat_count_test.mlir Updates FileCheck variables/patterns for reordered emission.
test/objectFifo-stateful-transform/repeat_count/link_join_repeat_count_test.mlir Updates FileCheck patterns for reordered emission.
test/objectFifo-stateful-transform/init_values/init_values_join_output_test.mlir Updates FileCheck patterns for reordered emission.
test/objectFifo-stateful-transform/init_values/init_values_join_input_test.mlir Updates FileCheck patterns for reordered emission.
test/objectFifo-stateful-transform/dma_transformations/nd_dma_fromStream_join.mlir Updates FileCheck patterns for reordered emission.
test/objectFifo-stateful-transform/dma_transformations/memtile_padding_test.mlir Updates FileCheck patterns and lock coverage for reordered emission.
test/objectFifo-stateful-transform/debug_features/disable_synchronization_test_distribute.mlir Updates FileCheck patterns for reordered emission and SSA renumbering.
test/objectFifo-stateful-transform/data_movement_patterns/link/link_test_join_offsets.mlir Updates FileCheck patterns for reordered emission.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants