Skip to content

chore: remove disabled manual SDPA block - #26

Closed
PABannier wants to merge 2 commits into
mainfrom
cleanup/remove-disabled-sdpa
Closed

PABannier wants to merge 2 commits into
mainfrom
cleanup/remove-disabled-sdpa

Conversation

@PABannier

Copy link
Copy Markdown
Owner

sam3_sam_attention contains a compiled-out #if 0 // Manual SDPA (for debugging only) block. It's a hand-written Q·K^Tsoftmax→V path next to the real ggml_flash_attn_ext call, with about 20 lines of scratch-work comments ("... no.", "let me think differently."). It never compiles, and git history keeps it.

Stacked on #22 because that PR edits the lines right below this block (the _sa_merge_count debug marker). Merge #22 first; GitHub will retarget this PR to main.

Verification: preprocessor-dead code, so the compiled output doesn't change. The parity tool still matches origin/main byte for byte:

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

git diff --shortstat: 1 file changed, 37 deletions(-).

Part of an over-engineering cleanup series.

🤖 Generated with Claude Code

https://claude.ai/code/session_01M2qLmQ9ag49hT61V6i9qAq

PABannier and others added 2 commits September 11, 2026 13:48
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
The #if 0 block in sam3_sam_attention held a hand-written
Q·K^T → softmax → V path next to the ggml_flash_attn_ext call. It was
compiled out and full of scratch-work comments. Git history keeps it.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01M2qLmQ9ag49hT61V6i9qAq
Base automatically changed from cleanup/remove-debug-dumps to main September 16, 2026 18:53
@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