ggml: fix cuda kernel launch configuration for k_compute_batched_ptrs to support large batch#16744
Merged
JohannesGaessler merged 4 commits intoggml-org:masterfrom Oct 26, 2025
Merged
Conversation
Collaborator
|
Same comment for this one. Please add a backend test that hits this case. The bug may exist in other backends, too. |
Contributor
Author
|
The backend test has been added. |
slaren
reviewed
Oct 23, 2025
tests/test-backend-ops.cpp
Outdated
|
|
||
| // test cases with large batch size | ||
| test_cases.emplace_back(new test_mul_mat(type_a, type_b, 16, 8, 256, {1024, 2}, {1, 1})); | ||
| test_cases.emplace_back(new test_mul_mat(type_a, type_b, 16, 8, 256, {4096, 1}, {1, 1})); |
Member
There was a problem hiding this comment.
Wouldn't a batch size of 1024 be enough to test this?
Contributor
Author
There was a problem hiding this comment.
1024 happens to be the maximum number of threads, so it won’t trigger any issues. I’ve now changed the batch size to 1536, which is smaller than before.
Co-authored-by: Johannes Gäßler <johannesg@5d6.de>
JohannesGaessler
approved these changes
Oct 24, 2025
Collaborator
|
@JohannesGaessler merge? |
Anico2
added a commit
to Anico2/llama.cpp
that referenced
this pull request
Jan 15, 2026
… to support large batch (ggml-org#16744) * fix k_compute_batched_ptrs * add backend ops test * Update ggml/src/ggml-cuda/ggml-cuda.cu Co-authored-by: Johannes Gäßler <johannesg@5d6.de> * reduce the batch size --------- Co-authored-by: Johannes Gäßler <johannesg@5d6.de>
blime4
referenced
this pull request
in blime4/llama.cpp
Feb 5, 2026
… to support large batch (#16744) * fix k_compute_batched_ptrs * add backend ops test * Update ggml/src/ggml-cuda/ggml-cuda.cu Co-authored-by: Johannes Gäßler <johannesg@5d6.de> * reduce the batch size --------- Co-authored-by: Johannes Gäßler <johannesg@5d6.de>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR fixes an invalid CUDA kernel launch issue for
k_compute_batched_ptrswhenne12orne13is large.dim3 block(ne13, ne12), which can exceed the maximum threads per block (1024) and triggercudaErrorInvalidConfiguration.