mirror of
https://github.com/storytold/lightcraft.git
synced 2026-11-28 09:19:25 +01:00
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>