Part 4 of 5 of #2167. The text detector's DETR encoder runs on the GPU
device of the image encoder: the same matrix products (ReLU as a third
epilogue), attention for 8 heads of 32 with separate q / k / v buffers and
the prompt's key-padding bias. Its weights (~120 MB) load on the first text
prompt. A failure leaves the encoder to candle for the rest of the session;
the backbone and the necks stay on the GPU. The mask decoder is still in
candle. The parity test prints the largest difference of every query's mask.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Part 3 of 5 of #2167. Both necks (3 levels each) run on the GPU device of
the image encoder: the 2 x 2 stride-2 transposed convolutions as per-pixel
products (weights re-laid on upload), the 3 x 3 convolutions as an implicit
GEMM (the matrix kernel with an A-tile loader that reads the neighbourhood
straight from the image, so the 764 MB im2col at 288^2 never exists). Built
on first use, ~250 MB. A failing neck is left to candle on its own; the
backbone stays on the GPU. The bench reports a failing neck and goes on.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Part 2 of 5 of #2167. lightcraft-gpu gets a `sam` feature with `sam3`: a
device of its own (like denoise and faces, with the same switches, the crash
sentinel and the shutdown gate), the shared kernels (tiled matrix products
with bias / GELU / residual in the epilogue, flash-style attention, layer
norm, RoPE, im2col, the final reorder) and the image encoder built from them.
The engine now uses it as the GPU backbone where candle has no GPU (not
macOS); the necks and the text detector's heads stay in candle.
An adapter without the needed limits (98 MB storage buffers, 16 KB
workgroup memory) or whose device can't be created gets no device; the
backbone then runs in candle on the CPU and Settings shows why
(sam3::tests::an_adapter_short_of_the_limits_is_refused_with_what_it_lacks).
A pass that doesn't finish names its stage in the reason the device is
given up with. The parity test prints the largest mask difference to the
CPU next to the IoU.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>