Repository navigation
chore: remove SAM2_DUMP_DIR dumps and dbg_ tensor markers - #22
Merged
Merged
Conversation
Drop debug-session leftovers from production code paths:
- SAM2_DUMP_DIR file dumps in the Hiera PE precompute and sam3_segment_pvs
- dbg_* tensor names and their ggml_set_output markers (Hiera patch
embed / blocks / FPN laterals, two-way block internals, decoder outputs)
- the block-0 dump flag (and now-unused block_idx param) in
sam2_hiera_block_forward
- the static _sa_call_count/_sa_merge_count counters in sam3_sam_attention
sam_dec_tokens_initial / sam_dec_block%d_{queries,keys} keep their names
(the test API looks them up) but lose the ggml_set_output markers.
Numerics are unchanged (byte-identical parity on CPU and Metal).
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.
What
Removes debug-session leftovers from production code paths in
sam3.cpp:SAM2_DUMP_DIRdumps in the Hiera PE precompute (bkg_interp/win_tiled) and insam3_segment_pvs(sparse embeddings, image feats, decoder outputs and intermediates).dbg_*tensor names and theirggml_set_outputmarkers: Hiera patch embed / after-PE / blocks 0,1,2,5,21 / FPN laterals, the two-way block internals, and the decoder'sdbg_dec_{queries,keys}_out.dumpflag insam2_hiera_block_forwardand theblock_idxparameter it used (nothing else read it)._sa_call_count/_sa_merge_countcounters insam3_sam_attention. Besides being debug-only, they were hidden global state.ggml_set_outputonsam_dec_tokens_initialandsam_dec_block%d_{queries,keys}. Those names are kept because the test API still looks them up withggml_get_tensorand sets its own outputs.Why
These blocks only existed to compare against Python during debugging. The extra
ggml_set_outputmarkers also stopped the graph allocator from reusing those intermediate buffers.Verification
Parity tool, byte-compared against deterministic origin/main baselines. It covers
encode_image,segment_pvswith point and box prompts, and the visual tracker'sadd_instance+propagate_frame.Full Release build: no errors. The only warnings come from ggml and stb, and they are already on main.
Caveats
SAM2_DUMP_DIRblocks and lists ofdbg_*names; the EdgeTAM profiler; and the#if 0manual SDPA block. The Hiera dump in the test API skips missing tensors, so it still runs; it just finds nothing to dump.🤖 Generated with Claude Code
https://claude.ai/code/session_01M2qLmQ9ag49hT61V6i9qAq