Commit Graph
9 Commits
Author SHA1 Message Date
helgehelge123 434fc50d43 Merge branch 'sam3-gpu-4-detr' into sam3-gpu-5-mask-decoder
# Conflicts:
#	docs/ai-masks.md
#	docs/target-app-parity.md
2026-11-16 00:19:05 +01:00
helgehelge123 f3ed3c4846 Merge branch 'sam3-gpu-3-necks' into sam3-gpu-4-detr 2026-11-16 00:07:44 +01:00
helgehelge123 c17384fc74 Merge branch 'sam3-gpu-2-backbone' into sam3-gpu-3-necks 2026-11-16 00:01:14 +01:00
helgehelge123 d0c17759d7 Merge branch 'sam3-gpu-1-plumbing' into sam3-gpu-2-backbone 2026-11-15 23:41:26 +01:00
Jeremy HookeandClaude Opus 5.5 50e6422a72 LR-EDIT-EFFECTS-GRAIN: grain drag benchmark; Ryzen numbers for main and #1060
`grain_drag_bench` (lightcraft-gpu example): GPU draft renders of a 2.5 MP
preview while Amount or Size is dragged, ms per frame. It doesn't depend on
the grain model, so it runs unchanged on other branches. docs/grain.md gets
its results on the Ryzen 5 7545U / Radeon 740M for main, #1060 and this
model, and the whole-render grain cost of main and #1060 there.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-03 11:11:55 +11:00
helgehelge123andClaude Opus 5.5 502a61997a M12: SAM 3 DETR encoder on the GPU (wgpu): the text detector's 6 layers over 5184 tokens
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>
2026-10-23 20:52:47 +02:00
helgehelge123andClaude Opus 5.5 0d217dad6d M12: SAM 3 necks on the GPU (wgpu): the tracker and detector feature pyramids
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>
2026-10-23 20:52:47 +02:00
helgehelge123andClaude Opus 5.5 d653132a25 M12: SAM 3 image encoder on the GPU (wgpu): shared kernels and the 32-layer ViT
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>
2026-10-23 20:52:47 +02:00
helgehelge123andClaude Opus 5.5 ba6f22567d M12: SAM 3 mask decoder on the GPU (wgpu), and the docs for all of SAM 3 on the GPU
Part 5 of 5 of #2167. The text detector's mask decoder runs on the GPU
device of the image encoder: the prompt cross-attention of the memory (the
DETR attention), the pixel decoder up to 288^2 (the necks' implicit-GEMM 3 x 3
convolution, a two-pass GroupNorm, ReLU), then the mask products. The
instance projection is folded into the 200 mask embeddings on the CPU, and
the semantic projection (#1963) is one more row, so the GPU returns the
per-query masks and the semantic mask in one product. Its weights load on
the first text prompt. The parity test checks the semantic mask too.

docs/gpu-pipeline.md and docs/ai-masks.md describe every part, with the
measured timings and accuracy, and what happens on an adapter that lacks
the limits or whose device can't be created.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-23 20:52:47 +02:00