perf(metal): extend mlxcel_affine_qmm_t_rows to 4-row verify blocks on gen 13/14

Abierto
#3,401 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
5/5
Tiempo estimado
Más de una semana
Aptitud para principiantes
20/100
Tipo de issue
Nueva funcionalidad
Claridad
Bien especificado
Estado de actividad
Activo
Stack tecnológico
cmake, cpp, rust

Línea de trabajo

Read TECHNICAL_REPORTS/3400-qmv-wide-force-diagnostic-20261124.en.md, then dispatch_qmm_t in src/lib/mlxcelverse/overlays/metal/mlx/backend/metal/quantized.cpp:2349 and the use_mlxcel_qmm_rows gate at :622. Run the exactness probe in src/models/speculative_exactness.rs:311 with MLXCEL_QMV_WIDE=1, then benchmark interleaved verify ms and decode tok/s per docs/benchmarks.md. Done means byte-identical 4-row products reach mlxcel_affine_qmm_t_rows, faster verify, and updated src/lib/mlxcelverse/overlays/metal/README.md and src/lib/mlxcelverse/CMakeLists.txt if kept.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

platform:macos priority:low status:backlog type:performance

Problem

On Apple GPU generations 13 and 14 a block-4 MTP verify runs one qmv per row. In dispatch_qmm_t (src/lib/mlxcelverse/overlays/metal/mlx/backend/metal/quantized.cpp:2349), qmv_mma is disabled on Ultra parts, use_mlxcel_qmm_rows (:622) admits only M >= 5 && M <= 8, and affine qmv_wide is gen 15+. On an M1 Ultra with mlx-community/gemma-4-12b-it-4bit (revision 73bcf09) and mlx-community/gemma-4-12B-it-assistant-bf16, block 4, temperature 0, a verify round costs about 68 ms, about three classic steps (classic decode is about 43 tok/s). MTP reaches 50 tok/s on an enumeration prompt (acceptance 0.997) but 33 tok/s on prose (acceptance 0.52), slower than classic. See TECHNICAL_REPORTS/3400-qmv-wide-force-diagnostic-20261124.en.md.

Proposal

Lower the row floor of use_mlxcel_qmm_rows to 4 (try 2 and 3 if cheap), then measure. The comment at :622 records that the kernel beats qmv at 4 rows only for gate_up and from 6 rows for smaller projections, so a per-shape gate is an acceptable outcome.

Exactness risk: the overlay header says mlxcel_affine_qmm_t_rows reduces in a different order than qmv and shares the MLXCEL_QMV_WIDE switch for that reason. With the variable unset, a failing probe makes retry_without_qmv_wide (src/models/speculative_exactness.rs:311) pin the process narrow. That turns the rows kernel off, so the probe passes on per-row qmv with no speedup, and the 5-to-8-row batched decode kernel is lost for the process. If the probe fails, do not keep the range change alone. Either make the 4-row path order-preserving relative to qmv (see #1289), or close this issue with the numbers.

Acceptance Criteria

  • The exactness probe passes with MLXCEL_QMV_WIDE=1 (this skips the retry, so the new branch must itself be byte-identical), and the 4-row products are shown to reach mlxcel_affine_qmm_t_rows.
  • Verify ms per round and decode tok/s for unset vs changed, on enumeration and prose prompts, from interleaved runs.
  • A teacher-forced logit trace per docs/benchmarks.md ("Judging a change that moves the numbers"), including the reverted arm.
  • The change is kept only if the verify round gets faster.
  • A kept change is documented in the overlay header, src/lib/mlxcelverse/overlays/metal/README.md, and the overlay note in src/lib/mlxcelverse/CMakeLists.txt.

Refs #3398, #3400.

Lenguaje dominante
Rust
Estrellas
505
Forks
81
Merge medio
14 h 2 min
PR fusionados (30 d)
448

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de lablup/mlxcel

Todos los issues de lablup/mlxcel

Issues similares

Más issues de Rust

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.