The high-level solver has no backend-specific branches. Factory registration selects the Serial,
AVX or Device instantiation of HOutflowBndCondOpImpl; the same templated workflow then
uses the chosen execution and memory spaces.
The restricted velocity and its gradient take the interleave width of the velocity, 1 or that of the execution space, so that the volume derivative reads and writes them without reshaping. The restricted gather copies through index maps built on the host for the interleave widths of the source and the restricted block, the first time the pair is seen, and kept, so no kernel divides an index, and numbers its threads by restricted point, the element lane varying fastest, so that its writes are coalesced. Each gather runs on the stream of its restricted block, which waits on an event recorded on the stream of its source block, and the source streams wait on the gathers in turn; the host never waits. Block-local streams then order the derivative of the velocity. Each extraction, of the velocity, of its gradient and of the solved pressure, orders itself after the streams of the blocks it reads, and the streams of the region blocks the pointwise kernels run on after itself, with events (see §28.4.2). The projected boundary coefficients are copied into a compact array on the streams of the region blocks and gathered into the layout of each domain block on the stream of that block; the region and domain block streams wait on one another through the operator’s own stream before and after the gathers. The final set or scatter-add indexes each block of the domain coefficient field at the interleave width of the block, 1 or that of the execution space, through target indices built on the host the first time a block at that width is seen, so the field is updated in its own layout and never reshaped.