UPSTREAM PR #18528: llama-graph: fix UB warning from cross-attn mask loop indices - #778
UPSTREAM PR #18528: llama-graph: fix UB warning from cross-attn mask loop indices#778loci-dev wants to merge 1 commit into
Conversation
|
Explore the complete analysis inside the Version Insights I've successfully generated a comprehensive summary report for your project. The report analyzes the performance comparison between two versions of the llama.cpp project (Pull Request #778) and highlights: Key Highlights:
The report includes detailed metrics, recommendations for investigation, and highlights both improvements and potential concerns that should be reviewed as part of PR #778. |
ca06125 to
76fc6ba
Compare
b68e1d7 to
cdd47ab
Compare
|
Explore the complete analysis inside the Version Insights I've successfully retrieved the summary report for your project. The report shows a performance analysis comparing the base version to the new version for the llama.cpp repository (Pull Request #778). Key Highlights:
The report recommends investigating these regressions, particularly the STL operations and graph input logic, and suggests considering a review of the changes before merging PR #778. Would you like me to provide more detailed information about any specific function or aspect of this performance report? |
bfd3c27 to
58eff53
Compare
Normalize loop index types across batch, graph, and KV code paths to match the width of their bounds (e.g. n_tokens, n_rs, n_seq_id, n_expert_used). This also removes an unreachable loop with identical start/end conditions GCC emited the following warning when building with optimizations: llama-graph.cpp:473:9: warning: iteration 2147483645 invokes undefined behavior [-Waggressive-loop-optimizations] Signed-off-by: Nic Boet <nic@boet.cc>
cdd47ab to
4f310f4
Compare
e48f18a to
82cdf69
Compare
Mirrored from ggml-org/llama.cpp#18528
I observed this behavior when building ollama on Gentoo.
Confirmed llm_graph_input_attn_cross::set_input functions are aligned between these two projects so submitting the PR here.
GCC emits the following warning when building with optimizations:
llama-graph.cpp:473:9: warning: iteration 2147483645 invokes undefined
behavior [-Waggressive-loop-optimizations]
The warning is caused by using int loop induction variables against int64_t bounds (n_tokens, n_enc), which allows signed overflow in the induction variable and enables undefined behavior.
This change widens the loop counters to int64_t to match the bounds and removes an unreachable loop of the form:
for (i = n_tokens; i < n_tokens; ++i)
which could never execute.
Thank you