[PR #1418] [CLOSED] cuda: opt-in MMVQ activation reuse across output rows #3439

Closed
opened 2026-11-07 14:41:30 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Niko1221/Strata/pull/1418
Author: @imanu86
Created: 10/7/2026
Status: ❌ Closed

Base: main ← Head: pr/b6-mmvq-rows


📝 Commits (1)

  • 8cae814 OPUS-MTP-MMVQ multi-colonna con attivazioni riusate fra le righe del blocco (STRATA_B6_MMVQ_ROWS) e micro-bench

📊 Changes

4 files changed (+398 additions, -0 deletions)

View changed files

📝 CMakeLists.txt (+6 -0)
📝 include/strata/kernels/native_mmvq.hpp (+6 -0)
➕ src/kernels/b6_mmvq_bench.cpp (+218 -0)
📝 src/kernels/cuda/native_mmvq.cu (+168 -0)

📄 Description

This adds an opt-in exact multi-column MMVQ kernel for Q4_K, Q5_K, Q6_K and IQ4_XS, plus b6_mmvq_bench. Each column's Q8_1 activation fragment is loaded once per weight block and reused across multiple output rows. The Q6_K scales remain in registers. The intended arithmetic order matches the existing exact layout.

STRATA_B6_MMVQ_ROWS=1 selects two output rows per block; 2, 4, and 8 select those row counts explicitly. Unset or 0 retains the existing kernel. The new path requires the exact layout, STRATA_TSUM off, and a supported format; other calls fall back. The setter/getter are for tools and must be used before graph capture. Single-column calls retain their existing path.

Relationship to current upstream: this branch starts at 82f46a8. Upstream d5ea713 now also contains the separate interleaved MMVQ path (MMVQ_IL), whose selection is restricted to supported shapes, 2-4 columns, and sm_80 or newer. This PR has not been rebased or measured together with that addition. Its potential relevance includes Turing and calls that use the existing native layout; it should not be described as a measured improvement over the new interleaved path.

Historical evidence, with limits:

  • Local fork microbenchmark logs from October 6-7 cover RTX 2080 Ti sm_75 and RTX 3060 sm_86, 15 model-shaped cases, widths 1, 2, 3, 4, 5 and 8. They end with zero failed comparisons for the tested modes. These synthetic checks compare the new and existing exact kernels, and both against individual single-column calls. They are historical fork results, not a fresh test of this PR head.
  • In the historical two-row run, for example, GDN qkv Q6_K at four columns was 0.0848 to 0.0654 ms on the 2080 Ti and 0.1372 to 0.1044 ms on the 3060. CUDA-event microbenchmarks do not establish an end-to-end speedup.
  • The fork's deterministic full-model runs reported a modest improvement, but forced IDs/windows do not control all cache and speculative work. No causal end-to-end percentage, general quality equivalence, or improvement on latest upstream is claimed here.
  • Some wider cases regress; this does not change the default. HIP and other GPU architectures have not been runtime-qualified.

Publication validation:

  • Head 8cae814e6e819736e47c95f3b5e8b056c7528c0f, one commit over 82f46a8c8f475f001ad76d92f58f4a4f8ffb0253; git diff --check 82f46a8..HEAD passes.
  • No fresh build or GPU test of this exact branch was performed for publication. Compilation of this exact branch, synthetic parity on both cards, and an integration comparison against current upstream remain pending.

Reproduction after building the CUDA branch:

cmake --build build --target b6_mmvq_bench
build/b6_mmvq_bench 500 -1 1
build/b6_mmvq_bench 500 0 4

The first benchmark selects all visible devices and two rows per block; the second selects device 0 and four rows per block. An exit code of zero covers only the benchmark's synthetic case matrix, not full-model equivalence.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/Niko1221/Strata/pull/1418 **Author:** [@imanu86](https://github.com/imanu86) **Created:** 10/7/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `pr/b6-mmvq-rows` --- ### 📝 Commits (1) - [`8cae814`](https://github.com/Niko1221/Strata/commit/8cae814e6e819736e47c95f3b5e8b056c7528c0f) OPUS-MTP-MMVQ multi-colonna con attivazioni riusate fra le righe del blocco (STRATA_B6_MMVQ_ROWS) e micro-bench ### 📊 Changes **4 files changed** (+398 additions, -0 deletions) <details> <summary>View changed files</summary> 📝 `CMakeLists.txt` (+6 -0) 📝 `include/strata/kernels/native_mmvq.hpp` (+6 -0) ➕ `src/kernels/b6_mmvq_bench.cpp` (+218 -0) 📝 `src/kernels/cuda/native_mmvq.cu` (+168 -0) </details> ### 📄 Description This adds an opt-in exact multi-column MMVQ kernel for Q4_K, Q5_K, Q6_K and IQ4_XS, plus `b6_mmvq_bench`. Each column's Q8_1 activation fragment is loaded once per weight block and reused across multiple output rows. The Q6_K scales remain in registers. The intended arithmetic order matches the existing exact layout. `STRATA_B6_MMVQ_ROWS=1` selects two output rows per block; `2`, `4`, and `8` select those row counts explicitly. Unset or `0` retains the existing kernel. The new path requires the exact layout, `STRATA_TSUM` off, and a supported format; other calls fall back. The setter/getter are for tools and must be used before graph capture. Single-column calls retain their existing path. Relationship to current upstream: this branch starts at `82f46a8`. Upstream `d5ea713` now also contains the separate interleaved MMVQ path (`MMVQ_IL`), whose selection is restricted to supported shapes, 2-4 columns, and sm_80 or newer. This PR has not been rebased or measured together with that addition. Its potential relevance includes Turing and calls that use the existing native layout; it should not be described as a measured improvement over the new interleaved path. Historical evidence, with limits: - Local fork microbenchmark logs from October 6-7 cover RTX 2080 Ti sm_75 and RTX 3060 sm_86, 15 model-shaped cases, widths 1, 2, 3, 4, 5 and 8. They end with zero failed comparisons for the tested modes. These synthetic checks compare the new and existing exact kernels, and both against individual single-column calls. They are historical fork results, not a fresh test of this PR head. - In the historical two-row run, for example, GDN qkv Q6_K at four columns was 0.0848 to 0.0654 ms on the 2080 Ti and 0.1372 to 0.1044 ms on the 3060. CUDA-event microbenchmarks do not establish an end-to-end speedup. - The fork's deterministic full-model runs reported a modest improvement, but forced IDs/windows do not control all cache and speculative work. No causal end-to-end percentage, general quality equivalence, or improvement on latest upstream is claimed here. - Some wider cases regress; this does not change the default. HIP and other GPU architectures have not been runtime-qualified. Publication validation: - Head `8cae814e6e819736e47c95f3b5e8b056c7528c0f`, one commit over `82f46a8c8f475f001ad76d92f58f4a4f8ffb0253`; `git diff --check 82f46a8..HEAD` passes. - No fresh build or GPU test of this exact branch was performed for publication. Compilation of this exact branch, synthetic parity on both cards, and an integration comparison against current upstream remain pending. Reproduction after building the CUDA branch: ```text cmake --build build --target b6_mmvq_bench build/b6_mmvq_bench 500 -1 1 build/b6_mmvq_bench 500 0 4 ``` The first benchmark selects all visible devices and two rows per block; the second selects device 0 and four rows per block. An exit code of zero covers only the benchmark's synthetic case matrix, not full-model equivalence. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-07 14:41:30 +07:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Niko1221/Strata#3439
No description provided.