Skip to content

fix: size the QQQ workspace from the kernel's 64-column lock tiles (#4215) - #4269

Merged
Qubitium merged 1 commit into
mainfrom
pr/4215
Nov 16, 2026
Merged

Qubitium merged 1 commit into
mainfrom
pr/4215

Conversation

@Qubitium

Copy link
Copy Markdown
Collaborator

Summary

The QQQ workspace (locks) was sized out_features // 128 * 16, which is zero for N=64 and undersized whenever N % 128 != 0, causing an illegal memory access that poisons the CUDA context.

What Changed

  • gptqmodel/nn_modules/qlinear/qqq.py: new _workspace_numel() = ceil(N/64) * max_par, used by both __init__ and pack().
  • gptqmodel_ext/qqq/qqq_gemm.cu: guard now uses ceildiv(prob_n, min_thread_n) * max_par instead of prob_n/128*max_par.
  • Added tests/kernels/test_qqq_workspace.py.

Tests

pytest tests/kernels/test_qqq_workspace.py -q   # 7 passed
ruff check <changed files>   # clean

Workspace sizes: N=64 0→16, 128 16→32, 192 16→48, 256 32→64, 320 32→80. The QQQ CUDA kernel itself was not executed (extension unbuilt); verified statically against qqq_gemm.cu indexing.

Fixes #4215

Model Support / Module Plan

N/A — no new model types or registry entries.

Verification environment

No compiled GPTQModel extensions are built in this environment (Machete/Marlin/QQQ-CUDA unavailable), so hardware-specific paths are called out explicitly above. The 19 fix branches from this sprint merge cleanly into one integration branch; the combined run was 195 passed, 2 skipped, ruff check clean.

Comment thread tests/kernels/test_qqq_workspace.py Resolved
@Qubitium
Qubitium merged commit 6ff4f7e into main Nov 16, 2026
6 checks passed
@Qubitium
Qubitium deleted the pr/4215 branch November 16, 2026 06:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] QQQLinear workspace is zero-sized for out_features=64 → illegal memory access; undersized whenever N % 128 != 0

1 participant