Repository navigation
refactor: reuse sam3_read_f32 for small embedding readbacks - #32
Merged
Merged
Conversation
…te_frame Move the duplicated code into static helpers: active/pending masklet propagation, memory encode + object pointer store, active commit + tracker update, mask-to-detection, and the post-processing. Call order and behavior are unchanged in both functions. track_frame keeps its pending masks in a scratch map, as before. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01M2qLmQ9ag49hT61V6i9qAq
Six sites open-coded "if F16 { read + ggml_fp16_to_fp32_row } else
{ read F32 }" for pe_gaussian, point_embed, not_a_point_embed,
no_mask_embed, no_obj_embed_spatial and no_obj_ptr. sam3_read_f32 already
does exactly that, and it also handles quantized tensors.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01M2qLmQ9ag49hT61V6i9qAq
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Six places in
sam3.cppopen-code the same readback:The tensors are
pe_gaussian, the 4point_embeds,not_a_point_embed,no_mask_embed,no_obj_embed_spatialandno_obj_ptr.sam3_read_f32(t, dst, n)already does exactly this, and it also dequantizes quantized tensors, which the inline copies would have misread as F32. Each site becomes one call.Stacked on #25 because the
no_obj_ptrread sits insidesam3_track_frame, which #25 restructures. Merge #25 first; GitHub will retarget this PR tomain. The identical readbacks in the test-API region are left alone, since #20 deletes them.Verification: a parity tool runs encode, PVS point + box, and a 3-frame visual track, then compares the output byte for byte with
origin/main. The prompt-encoder caches and the SAM2.1no_obj_embed_spatialpath are covered.The
no_obj_ptrread insam3_track_frame(text-prompted SAM3) only has a compile check, because no full SAM3 checkpoint is available locally.git diff --shortstat: 1 file changed, 7 insertions(+), 49 deletions(-).Part of an over-engineering cleanup series.
🤖 Generated with Claude Code
https://claude.ai/code/session_01M2qLmQ9ag49hT61V6i9qAq