TP: fix 0-sized tensor slices, AllReduce fallback#21808
Open
JohannesGaessler wants to merge 3 commits intoggml-org:masterfrom
Open
TP: fix 0-sized tensor slices, AllReduce fallback#21808JohannesGaessler wants to merge 3 commits intoggml-org:masterfrom
JohannesGaessler wants to merge 3 commits intoggml-org:masterfrom
Conversation
Contributor
Author
|
I added a patch for Gemma 4 26b a4b on 3 GPUs. There were issues with aliasing because every 6 layers the layer structure is different and one of the GPUs would receive no tensors at all. The linked issue should now be fully fixed by this PR. |
gaugarg-nv
reviewed
Apr 13, 2026
|
Fails for me on four Instinct mi50 cards, BUT also fails on two with the same error, HIP_VISIBLE_DEVICES=0,1 |
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.
Partially fixes #21765 .
With Qwen 3.5
26b a4b27b there are only 2 KV heads so with 3+ GPUs some of them will get zero-sized slices of the data. This edge case is not being handled correctly on master. This PR makes it so that the corresponding nodes are disabled and the buffer for the AllReduce memset to 0 so that after the AllReduce all GPUs have the correct data. As of right now the buffer is zeroed out viaGGML_SCALEwith a factor of0.0ffor the AllReduce fallback implementation - this is not safe w.r.t. NaNs but it seems we currently lack the tooling to properly memset a tensor as part of aggml_cgraph. The same issue is present inllm_graph_context::build_rs.Additionally, on master the synchronization of 3+ GPUs is not being handled correctly for the AllReduce fallback. The problem is that in those cases 2+ reduction steps are needed but the same buffer is used for each step so there are race conditions. This PR extends the number of buffers accordingly.
Requirements