Skip to content

Allow multi-source packet flows; fix pathfinder silent drop#2963

Draft
hunhoffe wants to merge 11 commits intomainfrom
fix-multi-source-packet-route-check
Draft

Allow multi-source packet flows; fix pathfinder silent drop#2963
hunhoffe wants to merge 11 commits intomainfrom
fix-multi-source-packet-route-check

Conversation

@hunhoffe
Copy link
Copy Markdown
Collaborator

PacketFlowOp::verify() was rejecting flows with more than one aie.packet_source, breaking valid fan-in topologies that predate the verifier check added in PR #2919. Relax the check from numSources != 1 to numSources < 1 so zero-source flows are still rejected while multi-source flows are accepted.

The pathfinder (AIEPathFinder.cpp / AIECreatePathFindFlows.cpp) had a related "last source wins" bug: Pass 1 overwrote the single srcCoords/ srcPort accumulator on each PacketSourceOp, silently dropping all but the last source before calling addFlow(). This is left for a follow-up fix; the per-source loop change belongs in a separate commit.

Tests added / updated:

  • badpacket_flow_source_count.mlir: remove multi-source rejection case (no longer an error), update error message for zero-source case
  • multi_source_packet_flow.mlir: positive verifier regression test
  • multi_source_pathfinder.mlir: pathfinder-level regression test (currently failing — documents the remaining bug)
  • npu-xrt/multi_source_packet_flow/: end-to-end hardware test

hunhoffe and others added 10 commits March 12, 2026 16:21
PacketFlowOp::verify() was rejecting flows with more than one
aie.packet_source, breaking valid fan-in topologies that predate the
verifier check added in PR #2919. Relax the check from `numSources != 1`
to `numSources < 1` so zero-source flows are still rejected while
multi-source flows are accepted.

The pathfinder (AIEPathFinder.cpp / AIECreatePathFindFlows.cpp) had a
related "last source wins" bug: Pass 1 overwrote the single srcCoords/
srcPort accumulator on each PacketSourceOp, silently dropping all but the
last source before calling addFlow(). This is left for a follow-up fix;
the per-source loop change belongs in a separate commit.

Tests added / updated:
- badpacket_flow_source_count.mlir: remove multi-source rejection case
  (no longer an error), update error message for zero-source case
- multi_source_packet_flow.mlir: positive verifier regression test
- multi_source_pathfinder.mlir: pathfinder-level regression test
  (currently failing — documents the remaining bug)
- npu-xrt/multi_source_packet_flow/: end-to-end hardware test

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Pass 1 of the packet-flow lowering in AIEPathFinder.cpp and
AIECreatePathFindFlows.cpp accumulated a single srcCoords / srcPort,
overwriting it on every PacketSourceOp it encountered. For multi-source
(fan-in) packet flows that meant only the last source ever reached
addFlow / the switchbox-connection loop -- earlier sources were silently
dropped from the routing.

Collect all sources into a vector and iterate (source, dest) pairs in
Pass 2 so each source contributes a Flow / switchbox connection.
Pathfinder::addFlow already groups same-dest fan-ins by packetGroupId,
so calling it once per source is the intended shape.

Drops the pre-existing "// todo: support many-to-one & many-to-many?"
note now that many-to-one works. Single-source flows are unchanged
(the sources vector just holds one entry).

Co-Authored-By: Claude Opus 4 (1M context) <noreply@anthropic.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 7, 2026

Coverage Report

Created: 2026-05-07 21:35

Click here for information about interpreting this report.

FilenameFunction CoverageLine CoverageRegion CoverageBranch Coverage
IR/AIEDialect.cpp 90.73% 86.30% 87.61% 79.49%
Transforms/AIECreatePathFindFlows.cpp 100.00% 91.48% 86.57% 76.46%
Transforms/AIEPathFinder.cpp 87.50% 94.13% 89.28% 83.45%
Totals 91.30% 88.67% 87.63% 79.41%
Generated by llvm-cov -- llvm version 18.1.3

@hunhoffe hunhoffe added this to the IRON 1.4 milestone May 7, 2026
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.

1 participant