Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Plumbing buffer allocation responsibility through the runtime and up into the lower-level stream dialect. #20240

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

benvanik
Copy link
Collaborator

@benvanik benvanik commented Mar 13, 2025

Adds support through low-level stream (cmd phase) through to runtime for indicating buffer ownership responsibility. These APIs allow deallocation responsibility tracking at runtime by both hosting applications and compiled modules and include provisions for ownership transfer and indeterminant lifetimes (analysis failures/external resources/etc).

Passes that emit these ops will be added in the future.

(see commits for more information, this is going to be a merge)

@benvanik benvanik force-pushed the users/benvanik/arc-foundation branch from aa33d3d to bf8dfed Compare March 13, 2025 23:26
@MaheshRavishankar
Copy link
Contributor

Thanks. I am assuming this is just a WIP branch... Did you want me to start reviewing any of the commits here (I am wrapping up somethings before I start reading the code here, but I can prioritize this if you want to start landing the pieces)

@benvanik benvanik force-pushed the users/benvanik/arc-foundation branch from bf8dfed to f546750 Compare March 13, 2025 23:42
@benvanik
Copy link
Collaborator Author

No rush - I figured I'd split out the more durable parts of the trashfire that was my experimentation :)

@benvanik benvanik marked this pull request as ready for review March 20, 2025 18:01
@benvanik benvanik force-pushed the users/benvanik/arc-foundation branch from f546750 to 4a0829f Compare March 20, 2025 18:02
@benvanik benvanik requested review from MaheshRavishankar and krzysz00 and removed request for krzysz00 March 20, 2025 18:03
@krzysz00
Copy link
Contributor

Meta comment: can I get a bit more of a PR description so I have a sense of what the goal of this change is?

@benvanik
Copy link
Collaborator Author

I've been discussing it with Mahesh - I'm not sure why you were added to the reviewers (possibly your comment) - I'll add more description, but feel free to skip this.

These APIs allow deallocation responsibility tracking at runtime by both
hosting applications and compiled modules.
This allows allocations to be routed back to their original placement
instead of whatever the compiler thinks is appropriate. This will
mostly be useful for imported resources that the compiler cannot
associate an affinity with.
This allows the compiler or host applications to indicate they don't
trust any other code to deallocate the buffer prior to all handles to it
being released. This is intended for when lifetime analysis in the
compiler fails but could also be used to avoid letting the compiler
reuse application buffers that may have weird lifetimes.
These are used to indicate how many conceptual "owners" claim lifetime
responsibility for a resource.
It's the job of the verifier to ensure correct programs.
@benvanik benvanik force-pushed the users/benvanik/arc-foundation branch from 4a0829f to 02ff1d4 Compare March 21, 2025 16:09
This allows sources and sinks to indicate transfers of ownership.
It can roughly be thought of as an std::move on a std::shared_ptr.
@benvanik benvanik force-pushed the users/benvanik/arc-foundation branch from 02ff1d4 to 6e6ec64 Compare March 21, 2025 16:36
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