Skip to content

[AIR] Add air.shim_feed_no_pace opt-out for fire-and-free shim feeds - #1754

Merged
erwei-xilinx merged 4 commits into
Xilinx:mainfrom
erwei-xilinx:air-shim-feed-no-pace
Jul 29, 2026
Merged

[AIR] Add air.shim_feed_no_pace opt-out for fire-and-free shim feeds#1754
erwei-xilinx merged 4 commits into
Xilinx:mainfrom
erwei-xilinx:air-shim-feed-no-pace

Conversation

@erwei-xilinx

Copy link
Copy Markdown
Collaborator

Summary

  • Adds a per-op unit attribute air.shim_feed_no_pace that opts a single air.channel.put/get out of the pacing implied by an enclosing air.preserve_shim_dma_order launch.
  • A preserve launch propagates its marker to all channel ops, which makes AIRRtToNpu pace every shim MM2S feed with bounded double-buffered (await-on-drain) backpressure. That is correct for feeds coupled by a shared broadcast/multicast consumer, but wrong for mutually independent feeds: the per-task completion await serializes otherwise-concurrent channels and can deadlock when a single feed's BD exceeds the downstream ring depth.
  • With the opt-out, such a feed instead lowers to a fire-and-free MM2S feed (start, free BD, no per-task await) while still keeping the launch's no-fold guarantee, so a few large independent BDs stream concurrently and are backpressured only by their downstream ring locks.

Details

  • AIRDialect.h: new attrs::ShimFeedNoPace constant.
  • AIRDialect.cpp (copyChannelSteeringAttrs): carry the marker across op rewrites so it survives to the shim-DMA-BD pass (mirrors the existing AwaitAppends/AppendBarrier handling).
  • AIRDependencyScheduleOpt.cpp (AIROptimizeShimDMABDs): skip the preserve-marker propagation for ops carrying the opt-out.

Compatibility

Opt-in: behavior is byte-identical for any op that does not carry the new attribute.

Test plan

  • ninja check-air-mlir
  • A preserve_shim_dma_order launch with two independent MM2S feeds: without the attr both are paced (start/await interleaved); with the attr on both they issue fire-and-free (all starts before awaits).

A launch marked air.preserve_shim_dma_order currently propagates that marker to
ALL of its air.channel.put/get ops, which makes AIRRtToNpu pace every shim MM2S
feed with bounded double-buffered (await-on-drain) backpressure. That pacing is
required for feeds coupled by a shared broadcast/multicast consumer that advances
its destinations in lockstep, but it is wrong for feeds that are mutually
independent: the per-task completion await serializes otherwise-concurrent
channels and deadlocks when a single feed's BD exceeds the downstream ring depth.

Add a per-op opt-out unit attr, air.shim_feed_no_pace. When present on a
channel.put/get inside a preserve_shim_dma_order launch, the op is excluded from
the preserve-marker propagation (AIROptimizeShimDMABDs) and therefore lowers to a
fire-and-free MM2S feed (start, free BD, no per-task await), while still
benefiting from the launch's no-fold guarantee. This lets a few large independent
BDs stream concurrently, backpressured only by their downstream ring locks.
copyChannelSteeringAttrs carries the marker across op rewrites so it survives to
the shim-DMA-BD pass.

The change is opt-in: behavior is unchanged for any op that does not carry the
new attribute.
@erwei-xilinx
erwei-xilinx requested a review from fifield as a code owner July 29, 2026 03:50
Copilot AI review requested due to automatic review settings July 29, 2026 03:50

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 introduces a per-operation opt-out attribute (air.shim_feed_no_pace) to prevent specific air.channel.put/get ops from inheriting the pacing/backpressure behavior implied by an enclosing air.preserve_shim_dma_order launch, enabling “fire-and-free” shim MM2S feeds for mutually independent channels.

Changes:

  • Adds air.shim_feed_no_pace as a centralized AIR attribute constant.
  • Preserves the new marker across channel-op rewrites via copyChannelSteeringAttrs.
  • Updates AIROptimizeShimDMABDs to skip preserve-marker propagation onto opted-out channel ops.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
mlir/lib/Transform/AIRDependencyScheduleOpt.cpp Skips preserve pacing propagation for air.channel.put/get ops tagged air.shim_feed_no_pace.
mlir/lib/Dialect/AIR/IR/AIRDialect.cpp Copies air.shim_feed_no_pace across channel-op rewrites so it survives to later transforms.
mlir/include/air/Dialect/AIR/AIRDialect.h Defines the new attrs::ShimFeedNoPace attribute name and documents intended semantics.

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

Comment thread mlir/lib/Transform/AIRDependencyScheduleOpt.cpp
erwei-xilinx and others added 3 commits July 28, 2026 21:11
Covers the preserve-marker propagation and the per-op opt-out: an untagged feed
in a preserve_shim_dma_order launch inherits the marker, while a feed tagged
air.shim_feed_no_pace does not (it lowers fire-and-free) and keeps its opt-out
attribute.
…ival

Two gaps in the opt-out coverage:

- AIRRtToNpu lowering: a mixed preserve launch where one feed keeps the
  preserve marker and a sibling opts out. Asserts the kept feed is paced
  (issue_token + depth-2 completion-token awaits) while the opted-out feed
  lowers fire-and-free (no issue_token, no await, dma_free_task after start) --
  the actual downstream consequence the propagation test could not show.

- copyChannelSteeringAttrs round-trip: air.shim_feed_no_pace must survive the
  per-channel BD fold that rebuilds the op (two scf.for loops collapse into one
  wrap/stride put) in a non-preserve launch, so the marker reaches the
  preserve-marker propagation instead of being silently dropped on rebuild.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@erwei-xilinx
erwei-xilinx added this pull request to the merge queue Jul 29, 2026
Merged via the queue into Xilinx:main with commit 8fca978 Jul 29, 2026
27 checks passed
@erwei-xilinx
erwei-xilinx deleted the air-shim-feed-no-pace branch July 29, 2026 22:04
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.

2 participants