Skip to content

ggml : unify tie-breaking to first index across all backends#25032

Draft
angt wants to merge 3 commits into
ggml-org:masterfrom
angt:ggml-unify-tie-breaking-to-first-index-across-all-backends
Draft

ggml : unify tie-breaking to first index across all backends#25032
angt wants to merge 3 commits into
ggml-org:masterfrom
angt:ggml-unify-tie-breaking-to-first-index-across-all-backends

Conversation

@angt

@angt angt commented Jun 26, 2026

Copy link
Copy Markdown
Member

Overview

This PR unifies ggml_argmax tie-breaking semantics across the CPU, Metal and WebGPU backends by returning the first occurrence of the maximum value, matching the behavior of torch.argmax and numpy.argmax.
It also adds regression tests covering tied maxima across different tensor sizes to ensure consistent behavior across backends.

Additional information

Found while experimenting with GLM-5.2 on the llama.cpp repository.

Requirements

Signed-off-by: Adrien Gallouët <angt@huggingface.co>
@angt

angt commented Jun 26, 2026

Copy link
Copy Markdown
Member Author

not sure about CUDA yet 👀

@github-actions github-actions Bot added testing Everything test related ggml changes relating to the ggml tensor library for machine learning Apple Metal https://en.wikipedia.org/wiki/Metal_(API) WebGPU labels Jun 26, 2026
@angt

angt commented Jun 26, 2026

Copy link
Copy Markdown
Member Author

well, Vulkan is not happy 👀

Signed-off-by: Adrien Gallouët <angt@huggingface.co>
@github-actions github-actions Bot added the Vulkan Issues specific to the Vulkan backend label Jun 26, 2026
Signed-off-by: Adrien Gallouët <angt@huggingface.co>
@github-actions github-actions Bot added SYCL https://en.wikipedia.org/wiki/SYCL - GPU programming language CUDA Related to the CUDA backend labels Jun 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Apple Metal https://en.wikipedia.org/wiki/Metal_(API) CUDA Related to the CUDA backend ggml changes relating to the ggml tensor library for machine learning SYCL https://en.wikipedia.org/wiki/SYCL - GPU programming language testing Everything test related Vulkan Issues specific to the Vulkan backend WebGPU

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant