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

Support passing captures by-value to subgraphs #407

Merged
merged 1 commit into from
Nov 14, 2024
Merged

Conversation

robertknight
Copy link
Owner

When preparing the capture environment to pass to an operator with subgraphs, if a captured value is not going to be needed by subsequent operators in the current graph then it can be passed by value rather than by reference. In the subgraph, this allows the value to be (potentially) used as an in-place input.

  • Pass CaptureEnv to Graph::run_subgraph by value rather than by reference

  • Add map of by-value captures to CaptureEnv

  • Add CaptureEnv::child method which creates a child environment with no captures of its own. This is not currently used but will be needed by loop operators which run a subgraph more than once and need to obtain a fresh capture environment for each iteration.

Part of #399.

When preparing the capture environment to pass to an operator with subgraphs,
if a captured value is not going to be needed by subsequent operators in the
current graph then it can be passed by value rather than by reference. In
the subgraph, this allows the value to be (potentially) used as an in-place
input.

 - Pass `CaptureEnv` to `Graph::run_subgraph` by value rather than by reference

 - Add map of by-value captures to `CaptureEnv`

 - Add `CaptureEnv::child` method which creates a child environment with no
   captures of its own. This is not currently used but will be needed by loop
   operators which run a subgraph more than once and need to obtain a fresh
   capture environment for each iteration.

Part of #399.
@robertknight robertknight marked this pull request as ready for review November 14, 2024 09:01
@robertknight robertknight merged commit 773f728 into main Nov 14, 2024
2 checks passed
@robertknight robertknight deleted the capture-by-value branch November 14, 2024 09:02
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