Skip to content

[Stream] Fold transferred stream clones into minimal slices before loads - #24740

Merged
jschuhmacher merged 2 commits into
iree-org:mainfrom
LekkalaSravya3:stream_load
Jul 29, 2026
Merged

jschuhmacher merged 2 commits into
iree-org:mainfrom
LekkalaSravya3:stream_load

Conversation

@LekkalaSravya3

Copy link
Copy Markdown
Contributor

This PR Extends clone folding for stream.async.load and stream.tensor.load to
handle the staging transfer introduced before loads.

Both stream.async.load and stream.tensor.load require their source to be
a staging resource, while stream.async.clone and stream.tensor.clone
always produce non-staging resources. As a result, loads from cloned
resources are always preceded by a stream.async.transfer.

This change matches the pattern:
clone -> transfer -> load

and rewrites it to:
slice -> transfer -> load

by creating a minimal slice of the original source, transferring only
that slice to staging, and loading from it. This avoids cloning and
transferring the entire resource when only a single value is accessed,
while preserving the required staging semantics.

@jschuhmacher

Copy link
Copy Markdown
Contributor

Thanks for the PR @LekkalaSravya3

@jschuhmacher jschuhmacher 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 @LekkalaSravya3!

@jschuhmacher
jschuhmacher merged commit 3eb9bba into iree-org:main Jul 29, 2026
60 checks passed
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