Skip to content

Batched calls for ops on a GPU, and a plan of what a read computes - #45

Open
davidackerman wants to merge 1 commit into
mainfrom
feature/batched-calls
Open

davidackerman wants to merge 1 commit into
mainfrom
feature/batched-calls

Conversation

@davidackerman

Copy link
Copy Markdown
Member

Asked for by registration-station after timing a live last pass of its registration. A warm block-matching call costs about 20 ms of fixed overhead (launches, copies), whatever its size. And a view at s1 needs 80–96 small lattice chunks, which ran one call at a time.

batch on an op

  • Declaring batch puts the blocks of one stage and shape that are waiting in the op's queue, when a slot frees, into one call of apply_batch, up to batch of them, first in line first.
  • So the chunks a read gathers, or a viewer's concurrent requests, wait together while a call runs and go into the next one. In the test, 16 chunks run in calls of 1, 8 and 7.
  • Each block is still a job of its own: shared, ordered and dropped as one. A call gives up through demand.cancelled() only once none of its blocks is wanted.
  • An op with batch is a stage of its own and goes through its queue as with slots (one call at a time if it sets none). apply_batch defaults to one apply_at after another.
  • Mechanism: demand.Batch. When a slot frees, the chosen job takes the others of its group into its call. fused.run_batch runs it, and fused.run takes the first op's result already computed.
  • cellmap-flow's models gain the same way on a GPU.

Pipeline.plan(level, box)

  • Says what a read would compute, computing nothing. For each stage, from the first to the output, it gives the chunks the read asks of it, those held and those to compute; an overlapping op's blocks are a stage of their own.
  • It follows dataset:// into the named dataset's stages. It stops at a stage that holds all it is asked for, or at a source that is not a stage, such as a warp:// whose reads depend on its field's values.
  • ChunkedSource.reads says what a chunk's computation reads, and covering says which chunks a read takes.

/api/ops reports batch. The docs (pipelines, caching, contributing, API, roadmap) and the CHANGELOG are updated.

Not included: registration-station's materialize --verify-chunks. They can compare two pipelines with different chunkings on the public API.

… live last pass (one warm block-matching call costs about 20 ms of its own, launches and copies, whatever its size): the blocks of one stage and shape waiting in its queue when a slot frees are computed in one call of its apply_batch, up to batch of them, first in line first (demand.Batch: the job chosen takes the others of its group waiting then into its call; each is still a job of its own, shared, ordered and dropped as one, and the call gives up through demand.cancelled() only once none of them is wanted), so the chunks a read gathers or a viewer's requests wait together while a call runs and go in the next (16 chunks in calls of 1, 8 and 7 in the test), and a model or a block matcher on a GPU pays its fixed cost per call once for many blocks; an op with batch is a stage of its own and goes through its queue as with slots, one call at a time if it sets none, apply_batch defaulting to one apply_at after another, fused.run_batch running it and fused.run taking the first op's result computed already; and Pipeline.plan(level, box) says what a read would compute, computing nothing: per stage, from the first to the output, the chunks it is asked for, those held and those to compute, whose inputs padded by the halos are what the stage before is asked for (an overlapping op's blocks a stage of their own), following dataset:// into the named dataset's stages and stopping at a stage holding all it is asked for or at a source that is not a stage, such as a warp:// whose reads depend on its field's values (ChunkedSource.reads says what a chunk's computation reads, covering which chunks a read takes); /api/ops reports batch; docs (pipelines, caching, contributing, API, roadmap) and the CHANGELOG say so

This branch has not been deployed

No deployments
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