Skip to content

refactor(gguf): drop the duplicated M=0 guard in GGUFCudaKernel.forward - #4782

Merged
Qubitium merged 1 commit into
mainfrom
fix/gguf-cuda-duplicate-m0-guard
Nov 17, 2026
Merged

Qubitium merged 1 commit into
mainfrom
fix/gguf-cuda-duplicate-m0-guard

Conversation

@Qubitium

Copy link
Copy Markdown
Collaborator

Follow-up to #4743. No issue: this is the merge artifact of two parallel fixes.

What happened

#4778 and #4780 both fixed #4743 and both added the same guard to
GGUFCudaKernel.forward. They merged four minutes apart, so main now runs the check twice:

if self.input_rows(x) == 0:          # kept
    return self.empty_linear_output(x)

original_shape = x.shape[:-1] + (self.out_features,)
if self.input_rows(x) == 0:          # unreachable, removed
    return self.empty_linear_output(x)

Change

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: the two guards were identical and both sat before the device check, the
weight upload and the plan cache.

Tests

#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.
@Qubitium
Qubitium merged commit e55e7eb into main Nov 17, 2026
6 checks passed
@Qubitium
Qubitium deleted the fix/gguf-cuda-duplicate-m0-guard branch November 17, 2026 14:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant