Repository navigation
Conversation
Root cause: ggml_is_contiguously_allocated() returns true for view tensors whose nb[] is inherited from the parent, causing the contiguous-branch stride scaling (s01 *= src0_bs) to produce s01 < ne10. cuBLAS then returns CUBLAS_STATUS_INVALID_VALUE on the GEMM call. Fix 1 (lines 1554, 1583): guard the contiguous allocation path with !src0->view_src / !src1->view_src so view tensors always take the non-contiguous path which correctly recomputes s01 = ne00 after conversion. Fix 2 (after line 1643): add an explicit lda >= k / ldb >= k invariant check before every GEMM call, logging the tensor name, type, view_src, nb[1], and dimensions so future failures are immediately diagnosable. Tested: builds clean (no warnings), llama-server starts and responds to inference requests with MTP active (draft_n=2, draft_n_accepted=2).
Owner
|
Thanks for moving this onto its own branch. I'm closing #366 in favor of this one so the discussion lives in one place. The request from #366 still applies before this can merge: the exact tensor that reaches
If it only reproduces with a specific GGUF, a link plus the |
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.
ggml_is_contiguously_allocated()returns true for view tensors whosenb[]is inherited from the parent, causing the contiguous-branch stride scaling (s01 *= src0_bs) to produces01 < ne10. cuBLAS then returnsCUBLAS_STATUS_INVALID_VALUEon the GEMM call.Two fixes:
Guard the contiguous allocation path with
!src0->view_src/!src1->view_srcso view tensors always take the non-contiguous path, which correctly recomputess01 = ne00after conversion.Add an explicit
lda >= k/ldb >= kinvariant check before every GEMM call, logging the tensor name, type,view_src,nb[1], and dimensions so any future stride mismatch is immediately diagnosable.Tested: llama-server starts and responds to inference requests with MTP active (draft_n=2, draft_n_accepted=2).