Skip to content

chore: remove compile-time SAM3_LOG_LEVEL knob - #33

Closed
PABannier wants to merge 1 commit into
mainfrom
cleanup/remove-log-level
Closed

PABannier wants to merge 1 commit into
mainfrom
cleanup/remove-log-level

Conversation

@PABannier

Copy link
Copy Markdown
Owner

What

Removes the compile-time SAM3_LOG_LEVEL define and the SAM3_LOG(level, ...) macro from sam3.cpp.

  • SAM3_LOG(1, ...) → plain fprintf(stderr, ...) (per CLAUDE.md style). The 10 #if SAM3_LOG_LEVEL >= 1 guards around the std::chrono timers are gone, so the timers always run.
  • The 20 SAM3_LOG(2, ...) calls are deleted. None of them had work that existed only to feed the log: fenc_output_cpu (the fenc_out[0..4] log) is still used by the DETR decoder and the seg head, and every other argument is used elsewhere.
  • The define, macro and comment are removed. <chrono> stays because the timers still use it.

Why

The knob defaulted to 1, and no CMake option, CI job or doc ever set it. Level-2 logs were already compiled out of the default build, so stderr output from the default build is the same as before.

Verification

  • Parity tool (EdgeTAM f16 + SAM2.1-tiny q8_0, CPU + Metal), stdout byte-compared against origin/main baselines:
    PARITY OK   edgetam_f16 gpu0
    PARITY OK   edgetam_f16 gpu1
    PARITY OK   sam2.1_hiera_tiny_q8_0 gpu0
    PARITY OK   sam2.1_hiera_tiny_q8_0 gpu1
    
  • stderr from all 4 runs matches an origin/main build of the same tool once timings are masked. The only other difference is the timing in ggml_metal_library_init: loaded in X sec. These runs print sam3_segment_pvs: graph computed … and completed … (12 each). The sam3_encode_image and sam3_segment_pcs conversions are not reached by these SAM2/EdgeTAM runs; I checked them by reading the code.
  • Full Release build: no errors. clang++ -fsyntax-only -Wall -Wextra sam3.cpp gives the same 21 warnings as origin/main (none new, including unused variables). grep -c SAM3_LOG sam3.cpp → 0.
 1 file changed, 7 insertions(+), 83 deletions(-)

Merge note

Other open PRs change lines near these edits: the debug dumps in sam3_segment_pvs, the track/propagate frame functions, and the RAII cleanup of gallocr/ctx frees. Expect small textual conflicts; they need resolving when this merges.

🤖 Generated with Claude Code

https://claude.ai/code/session_01M2qLmQ9ag49hT61V6i9qAq

SAM3_LOG_LEVEL defaulted to 1 and nothing (CMake, CI, docs) ever set it.
Level-1 logs become plain fprintf(stderr, ...) with their timers made
unconditional; level-2 logs were compiled out by default and are removed.
Default-build stderr output is unchanged.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01M2qLmQ9ag49hT61V6i9qAq
@PABannier PABannier closed this Sep 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant