Skip to content

cuda: extend IQ4_NL GET_ROWS support and fix paired row iteration - #30559

Open
amittell wants to merge 4 commits into
ggml-org:masterfrom
amittell:cuda-iq4-nl-get-rows
Open

amittell wants to merge 4 commits into
ggml-org:masterfrom
amittell:cuda-iq4-nl-get-rows

Conversation

@amittell

Copy link
Copy Markdown

Overview

Extends CUDA GET_ROWS support for valid IQ4_NL row widths that are multiples of 32 but not 256. Keeps the existing optimized path for 256-aligned widths.

Makes typed I32 index-stride support agree with the kernel requirements. A transposed-index case previously advertised support and then asserted; it passes with this change. Also fixes the generic paired-output loop step, which allowed overlapping writes on longer rows.

Adds regression cases and updates the operator capability records. Credit to Aristo94 for the original block-32 helper/fallback approach in e8e8f9dcb3f5c0cdd259233503a57a5220e98b7c.

Additional information

Validation at 5cdadfc326163ed1fa66cf609fb1761f7928900c:

  • Full CPU CI: 51 debug tests and 52 release tests passed, plus 5 model tests in each build.
  • Explicit CPU GET_ROWS: 286/286 passed.
  • CUDA: 262 supported cases passed, including all 48 IQ4_NL cases; 24 unsupported cases skipped.
  • Direct F32/F16 outputs: 40/40 passed, maximum error 0.
  • Compute Sanitizer memcheck: 0 errors across 52 added matrix cases and 40 direct-output cases.
  • Matched Qwen perplexity unchanged at printed precision; both BGE embedding vectors identical at JSON output precision.

On an RTX 5090, warmed ABBA benchmarks with identical BGE weights and 384-column IQ4_NL token embeddings improved mean throughput 18.9% at pp128 and 4.1% at pp512, with 10 samples per profile/configuration. These results apply to those configurations; they do not establish an AMD speedup. Direct runtime node placement was inferred from the buffer override and backend support conditions, rather than captured in a trace.

Related work: #25962 added quantized GET_ROWS but retains the 256-column IQ4_NL restriction. #29683 fixes short-row dequantization in convert.cu, a separate path.

Requirements

  • I have read and agree with the contributing guidelines
  • AI usage disclosure: YES. AI assistance was used for implementation, test preparation, validation analysis and this description.

Preserve the 256-column path and add a native block-32 fallback.
Align IQ4_NL index-stride support with the kernel and fix the
generic paired-output loop step. Add regression coverage and
operator capability records.

The original block-32 helper/fallback approach is by Aristo94,
from e8e8f9d.

Assisted-by: Codex
@amittell
amittell requested review from a team and ggerganov as code owners October 15, 2026 01:09
Copilot AI balanced review requested due to automatic review settings October 15, 2026 01:09
@github-actions github-actions Bot added documentation Improvements or additions to documentation testing Everything test related ggml changes relating to the ggml tensor library for machine learning CUDA Related to the CUDA backend labels Oct 15, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The new shared transposed-index tests trigger SYCL's stride assertion and abort its test run.

1 open finding
What changed in this PR

Extends CUDA IQ4_NL row lookup support while preserving the optimized path for 256-aligned widths.

Changes:

  • Adds a 32-value fallback and supports element-aligned index strides.
  • Fixes overlapping writes in paired-output iteration.
  • Adds regression cases and updates capability documentation.
File Description
tests/​test-backend-ops.cpp Adds row-width, repeated-index, and transposed-index cases.
ggml/​src/​ggml-cuda/​ggml-cuda.cu Updates IQ4_NL support checks.
ggml/​src/​ggml-cuda/​getrows.cu Adds fallback dispatch and fixes iteration stride.
ggml/​src/​ggml-cuda/​dequantize.cuh Adds block-32 IQ4_NL dequantization.
docs/​ops/​CUDA.csv Records support for new cases.
docs/​ops.md Documents supported widths and index layouts.

🧠 Review effort: Balanced


💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread tests/test-backend-ops.cpp Resolved
@amittell
amittell requested a review from a team as a code owner October 17, 2026 02:04
@github-actions github-actions Bot added the SYCL https://en.wikipedia.org/wiki/SYCL - GPU programming language label Oct 17, 2026
…-nl-get-rows

Assisted-by: Codex

# Conflicts:
#	tests/test-backend-ops.cpp

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CUDA Related to the CUDA backend documentation Improvements or additions to documentation ggml changes relating to the ggml tensor library for machine learning SYCL https://en.wikipedia.org/wiki/SYCL - GPU programming language testing Everything test related

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants