Skip to main content

Module depthwise

Module depthwise 

Source
Expand description

Depthwise convolution, as a direct client of the tile DSL.

Every accelerated convolution routine in this crate refuses groups != 1, so a depthwise layer autotunes against a single surviving candidate and never reaches an accelerated path at all. This is the missing one, and it is deliberately not built on the blueprint/routine machinery the rest of kernels::forward uses: a depthwise convolution is not a contraction over channels, so a stage hierarchy sized for one has nothing to size here.

What it is instead: a dense convolution contracts input channels into output channels, so the channel pair appears in the two operands and not in the accumulator. A depthwise one has no such pairing — each channel carries its own filter and reaches exactly one output channel — so a single channel axis appears in all three operands. That makes it a batch axis, and the contraction is over the window taps alone. Written that way it is a space and a projection, and Tile::mma is the whole body.

Everything about the layout follows from that one axis. Channels stay innermost (NHWC) and are what the units are spent on, so consecutive units read consecutive channels of one pixel and the read coalesces; and they are what every operand is lined along, so one instruction moves a unit’s whole cell. A depthwise pass has too little arithmetic per byte to be anything but bandwidth-bound, and both of those are what let it reach the bandwidth.

Structs§

DepthwiseSpace
The space one launch runs over, in the terms the kernel builds it from: the problem’s extents and the tiling. The kernel’s comptime argument, so the space the launch sizes its grid from is the space the kernel walks.
DepthwiseTensors
The three tensors this routine moves, named because they are all TensorBinding and a positional triple lets two of them be swapped without a word from the compiler.
DepthwiseTiling
How one cube’s share of the output is shaped, and how the cube’s threads divide it.

Enums§

DepthwiseStrategy
Which tiling to run a problem under.

Functions§

launch_depthwise
Launch a depthwise convolution under strategy.