Repository navigation
refactor(gguf): drop the duplicated M=0 guard in GGUFCudaKernel.forward - #4782
Merged
Merged
Conversation
#4778 and #4780 fixed #4743 in parallel and both added the same `input_rows()`/`empty_linear_output()` guard to `GGUFCudaKernel.forward`. Merged main therefore runs the check twice, with the second one unreachable. Keep one guard, placed before `original_shape` is computed so an M=0 input does no work at all, and fold both comments into it. No behaviour change: both guards were identical and both sat before the device check, the weight upload and the plan cache.
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.
Follow-up to #4743. No issue: this is the merge artifact of two parallel fixes.
What happened
#4778and#4780both fixed #4743 and both added the same guard toGGUFCudaKernel.forward. They merged four minutes apart, somainnow runs the check twice:Change
Keep one guard, placed before
original_shapeis computed so an M=0 input does no work at all, and fold bothcomments into it. No behaviour change: the two guards were identical and both sat before the device check, the
weight upload and the plan cache.
Tests
tests/kernels/test_gguf_cuda_zero_rows_4743.py(fix(gguf): return an empty output for zero-row GGUF CUDA inputs (#4743) #4778) andtests/kernels/test_gguf_cuda_empty_rows_4743.py(fix(gguf): return an empty output for M=0 on the CUDA kernel (#4743) #4780) -> 16 passed (with CUDA visible).tests/test_checkpoint_resume_nonpersistent_4777.py-> 18 passed, 6 skipped on a CPU-only run.
ruff checkclean.