Repository navigation
chore(core): correct the sink attention Used by comment - #2472
Conversation
`fast_scaled_dot_product_attention_with_sinks` carried `Used by: GptOss` at its three declaration sites (the cxx bridge block in `src/lib/mlxcel-core/src/lib.rs`, `mlx_cxx_bridge.h` and `mlx_cxx_bridge.cpp`), but five families call it: GPT-OSS, Laguna, DeepSeek-V4, Falcon-OCR and, since lablup#2460, OpenAI Privacy Filter. `docs/code-guidelines.md` ("Shared Function Comments") makes the `// Used by:` line the record of what a change to a shared function can break, so the stale list hid four callers. The same comment described a sink as a "per-head attention bias for first position". A sink is an extra per-head logit that joins the softmax denominator and has no value row: MLX's fallback concatenates it in front of the scores, applies the softmax and slices it off. All three comments now say that and name the five families, with `OpenAIPrivacyFilter` spelled as the existing `Used by:` lines in `src/models/gpt_oss_common.rs` spell it. Comment-only change. `cargo fmt --all -- --check` passes, and `grep -rn 'fast_scaled_dot_product_attention_with_sinks(' src/models` lists exactly the five families' call sites plus the privacy filter's test. The three `Used by: GptOss` lines on the GPT-OSS SwiGLU activation are correct and are left as they are. Closes lablup#1786
|
Implementation hardening reviewed PR #2472 against issue #1786 and the current source. No correctness gap requiring a follow-up commit was found. Verified all three sink descriptions and five model-family callers, including OpenAI Privacy Filter. A source comparison excluding comment-only lines confirms executable Rust/C++ is unchanged; unrelated SwiGLU comments remain intact. Security and performance review: documentation/comment-only changes introduce no executable behavior, dependency, authorization, or resource-lifecycle changes. All applicable PR checks passed; path-filtered jobs were skipped by CI. Full GPU runtime tests were not run locally because no runtime logic changed. |
Summary
fast_scaled_dot_product_attention_with_sinkscarriedUsed by: GptOssat all three of its declaration sites, but five families call it: GPT-OSS, Laguna, DeepSeek-V4, Falcon-OCR and, since #2460 landed, OpenAI Privacy Filter. The same comment called a sink a "per-head attention bias for first position"; a sink is an extra per-head logit that joins the softmax denominator and has no value row. All three comments now describe the sink that way and list the five families. Comment-only; no code changes.src/lib/mlxcel-core/src/lib.rs(///in the cxx bridge block),src/lib/mlxcel-core/cpp/mlx_cxx_bridge.handsrc/lib/mlxcel-core/cpp/mlx_cxx_bridge.cpp(//): the two comment lines replaced with the text from the issue, plusOpenAIPrivacyFilter, which was not a caller when the issue was filed. The spelling follows the existingUsed by:lines insrc/models/gpt_oss_common.rs.Used by: GptOsslines on the GPT-OSS SwiGLU activation are correct and are left as they are, as the issue asks.Related issues
Closes #1786
Type of change
chore— build, CI, dependencies, release infrastructureTest plan
cargo fmt --all -- --checkpasses.grep -rn 'fast_scaled_dot_product_attention_with_sinks(' src/modelslistsgpt_oss.rs,laguna_layers.rs,deepseek_v4_attention.rs,falcon_ocr.rs,openai_privacy_filter_layers.rsand the privacy filter's test file, and nothing else insrc/,examples/,tests/orbenches/.git diff -U0shows only the six comment lines changed.cargo build --release --features metal,acceleratewas not run for this comment-only change; the C++ edits are inside//comments, so the bridge compiles as before.