Q2_0 group 64: Metal backend#41
Draft
khosravipasha wants to merge 1 commit into
Draft
Conversation
There was a problem hiding this comment.
Pull request overview
Adds Metal backend support for the Q2_0 quantization format (group size 64) so quantized weights can participate in common Metal paths (copy/dequant, get_rows, mul_mv, mul_mm, and mul_mat dispatch).
Changes:
- Implements
Q2_0quantize/dequant routines in the Metal shader library and wires them into existing generic kernels (cpy/get_rows/mul_mm). - Adds a
Q2_0-specific dot-product routine and a dedicatedkernel_mul_mv_q2_0_f32path. - Enables
GGML_TYPE_Q2_0in Metal op dispatch / device capability checks and sets up pipeline params for mul_mv/mul_mv_id.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
ggml/src/ggml-metal/ggml-metal.metal |
Adds Q2_0 quantize/dequant, dot-product helper, and kernel/template instantiations for copy/get_rows/mul_mm/mul_mv. |
ggml/src/ggml-metal/ggml-metal-ops.cpp |
Allows Q2_0 to use the small-batch mul-mv-ext path in MUL_MAT when applicable. |
ggml/src/ggml-metal/ggml-metal-impl.h |
Introduces N_R0_Q2_0 / N_SG_Q2_0 constants for pipeline configuration. |
ggml/src/ggml-metal/ggml-metal-device.m |
Updates Metal device op support checks to include Q2_0 for relevant copy/dup/cont paths. |
ggml/src/ggml-metal/ggml-metal-device.cpp |
Adds Q2_0 case for mul_mv and mul_mv_id pipeline configuration (nsg/nr0). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
7c6c628 to
0f07ba4
Compare
a592d04 to
774d555
Compare
0f07ba4 to
a69cff5
Compare
774d555 to
be87981
Compare
a69cff5 to
dc7c932
Compare
be87981 to
7a4a89a
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
DRAFT PR for tesintg and reviews.