Repository navigation
Make plans a tree, and workspaces a plan with its buffers - #183
Merged
Merged
Conversation
A plan recorded the resolved algorithms of the operations it calls (the scan in radix sort and findall, the key range reduction) in a separate `nested` NamedTuple next to their sizes, and a workspace copied every field of the plan. A plan's sizes now hold the plans of the operations it calls, and a workspace holds its plan, device and buffers. A workspace serves a call whose plan is structurally equal to its own (`same_plan`): the same backend, algorithms and sizes down the tree, which is what was compared before. The nested reduction of `ViaReduce` predicates now also has its algorithm compared; it was the only nested operation recorded by its sizes alone. A mismatch says which algorithms or which buffers differ, as before.
maleadt
force-pushed
the
tb/dedup-workspace
branch
from
October 25, 2026 06:47
5588367 to
7ae9619
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A plan (an operation's backend, resolved algorithm and scratch buffers) and a workspace repeated each other's fields, and both carried a second structure,
nested, holding the resolved algorithms of the operations an operation calls (the scan inside the radix sort andfindall, the reduction insideViaReduce), so that every nesting site built two parallelNamedTuples.Now plans form a tree: a plan's
sizeshold its buffer requirements or the plans of the operations it calls, and aWorkspaceis a plan, the device it was made for and the buffers. A workspace is accepted when its plan equals the call's (backend, algorithms and buffer sizes, all the way down), which is the same rule as before; the only difference is that aViaReducepredicate now also compares its reduction's algorithm, as the contract says, where it compared only its buffers. Mismatch errors say which part differs and show both sides.workspace_size,workspaceand the display of a workspace are unchanged.Per-call overhead is unchanged (RTX 5080, e.g.
sumof 100 elements 11.8 µs,findallof 1000 23.2 µs, with or without a workspace; all within 2.5%). Tested on CPU threads, PoCL, CUDA (Julia 1.12 and 1.10).