Skip to content

[Stream] Add storage policy to async transfers - #25143

Merged
devtbi merged 1 commit into
iree-org:mainfrom
purnima-nlp:stream-transfer-storage-choice
Nov 3, 2026
Merged

devtbi merged 1 commit into
iree-org:mainfrom
purnima-nlp:stream-transfer-storage-choice

Conversation

@purnima-nlp

Copy link
Copy Markdown
Contributor

Description
Adds an optional storage policy to stream.async.transfer to distinguish whether lowering should eventually:

  • allocate separate destination storage and copy (copy)
  • reuse the source storage for the result (reuse)

When the policy is omitted, existing behavior is same.
This change only introduces and preserves the storage choice in Stream IR. It does not yet change allocation, transfer lowering, or cache-maintenance behavior.
Canonicalization is kept conservative for transfers with an explicit storage policy so that the policy is not silently dropped before later lowering consumes it.

Part of #24930.

@purnima-nlp

Copy link
Copy Markdown
Contributor Author

Hi @Manewing, I’ve opened the Step 1 PR for #24930.

This adds the optional copy / reuse storage policy on stream.async.transfer and keeps explicit policies from being dropped by canonicalization. It intentionally does not change allocation or lowering behavior yet.

Would appreciate your review when you get a chance. Thanks!

independently of the source and target storage affinities. When omitted an
execution affinity is derived from the resource lifetimes and endpoints.

The optional storage policy records the intended lowering choice: `copy`

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.

suggestion: personally in favor of calling it alias and not reuse

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Hey @devtbi, thanks a lot for taking the time to review this.

I’ve updated the PR based on the feedback. Please have a look whenever you get a chance.

I’ve kept reuse for now instead of renaming it to alias, mainly so we can first make sure the semantics and implementation are sound. I’m happy to revisit the naming after that if needed.

Thanks again for the review.

@Manewing Manewing 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.

Thanks for the changes!

I think we should already update the canoncialization handling of the storage attribute in this PR, I think both belong together and should be implemented together. Unless there is a good reason I am missing here.

I left several comments on what I think the behavior should be in the respective cases. I also think we should make canonicalization make the storage attribute explicit, until it is a mandatory requirement, I think this makes it much nicer to read.

@purnima-nlp
purnima-nlp force-pushed the stream-transfer-storage-choice branch from 1ca1360 to 799c4d3 Compare November 2, 2026 15:16
@Manewing
Manewing requested a review from devtbi November 3, 2026 08:55

@Manewing Manewing 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.

Thanks for addressing the feedback, looks good! :)

You'll just need to address the failing pre-commit tests

@purnima-nlp
purnima-nlp force-pushed the stream-transfer-storage-choice branch from 799c4d3 to a65b65c Compare November 3, 2026 12:36
@purnima-nlp

Copy link
Copy Markdown
Contributor Author

Thanks for addressing the feedback, looks good! :)

You'll just need to address the failing pre-commit tests

thanks for your guidance i have done the required changes

@devtbi devtbi 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.

@purnima-nlp thank you :)

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