Repository navigation
cuda: do not read src[0] of source-less nodes in the graph compat check - #412
Merged
TheTom merged 1 commit intoNov 11, 2026
Conversation
ggml_cuda_graph_check_compability computed is_tq_w from node->src[0]->type for every node, before testing node->op == GGML_OP_MUL_MAT_ID. Nodes with no sources (ARANGE, ...) have src[0] == NULL, so this is a NULL dereference whenever the compiler keeps the load ahead of the op test. Release builds here happen to sink it into the branch; an unoptimized build, or a change to the type test, does not, and test-backend-ops then segfaults at ARANGE. Compute is_tq_w inside the MUL_MAT_ID branch, where src[0] always exists. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Owner
|
Thanks @jasstrong, merged. The ARANGE segfault also reproduces on an NVIDIA GB10 in a plain Release build, so this fixed a real crash there too, not only the -O0 host case. |
jasstrong
pushed a commit
to jasstrong/llama-cpp-turboquant
that referenced
this pull request
Nov 11, 2026
… into the TQ3_4S stack One conflict, in ggml_cuda_graph_check_compatibility: TheTom#412 moved is_tq_w inside the MUL_MAT_ID branch so source-less nodes are not dereferenced, and this branch adds TQ3_4S to that test. Resolved as TheTom#412's placement with TQ3_4S added. TheTom#414's tq_ncols change to the fused TQ condition merged cleanly with this branch's TQ3_4S additions. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This was referenced Nov 21, 2026
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.
What
ggml_cuda_graph_check_compabilityreadsnode->src[0]->typefor every node in the graph, before it checks whether the node is aMUL_MAT_ID:A node with no sources, such as
ARANGE, hassrc[0] == NULL. The value is only used inside theMUL_MAT_IDbranch, so an optimizing compiler usually moves the load into the branch and nothing goes wrong. Nothing guarantees that, though. Whether it crashes depends on how the type test happens to compile.This PR moves
is_tq_winside theMUL_MAT_IDbranch, wheresrc[0]always exists. It's a 2-line change with no effect on behavior.How it showed up
In a downstream branch that adds one more TQ weight type to this test, clang compiled the three-way comparison into a bitmask test. That kept the load ahead of the op check.
test-backend-opsthen segfaulted atARANGEon all three cards I tried (gfx90a, gfx1100, gfx1030):It also reproduces on this branch unmodified (6439568). Build with host code unoptimized and device code at -O3 (
-DCMAKE_HIP_FLAGS_RELEASE="-DNDEBUG -Xarch_host -O0 -Xarch_device -O3"), then run:test-backend-ops -b ROCm0 -o ARANGETesting
ROCm 7.2.3; the first run is on the MI210 (gfx90a):
test-backend-ops -b ROCm0: 21062/21063. The one failure isMUL_MAT(type_a=q5_cr, ..., cr_pattern=random), the intermittent ConvRot tolerance failure, which also fails on base. With host code unoptimized, no other source-less-node dereference turned up anywhere in the suite.ARANGE.Limits of this testing
🤖 Generated with Claude Code