Skip to content

feat(hexagon): implement Q4_1 support for MUL_MAT ops#56

Open
max-krasnyansky wants to merge 4 commits into
masterfrom
jules-8647656785856433991-943d5698
Open

feat(hexagon): implement Q4_1 support for MUL_MAT ops#56
max-krasnyansky wants to merge 4 commits into
masterfrom
jules-8647656785856433991-943d5698

Conversation

@max-krasnyansky
Copy link
Copy Markdown
Owner

This PR introduces full support for the Q4_1 data type in the Hexagon backend.

Key changes:

  • htp-ops.h: Added HTP_TYPE_Q4_1 and HTP_TYPE_Q8_1 with their respective constants.
  • ggml-hexagon.cpp: Added repacking logic for Q4_1 format using repack_row_q4x4x2_q4_1 and unpacked functions.
  • matmul-ops.c: Implemented Q8_1 dynamic quantization containing sums used for the affine min offset, plus the associated vec_dot kernels for Q4_1x4x2 layout.
  • hmx-matmul-ops.c: Extended HMX dequantization and matmul tasks to gracefully handle the additional min (m) scale values.

PR created automatically by Jules for task 8647656785856433991 started by @max-krasnyansky

- Add HTP_TYPE_Q4_1 and HTP_TYPE_Q8_1 definitions to htp-ops.h
- Implement repacking logic for Q4_1 into Q4_1x4x2 format in ggml-hexagon.cpp
- Implement dynamic Q8_1 quantization for F32 activations with block sums in matmul-ops.c
- Add vec_dot kernels for Q4_1 weights and Q8_1 activations in matmul-ops.c
- Add Q4_1 dequantizers and support for HMX fallback in hmx-matmul-ops.c

Co-authored-by: max-krasnyansky <1380796+max-krasnyansky@users.noreply.github.com>
@google-labs-jules
Copy link
Copy Markdown
Contributor

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

- Add HTP_TYPE_Q4_1 and HTP_TYPE_Q8_1 definitions to htp-ops.h
- Implement repacking logic for Q4_1 into Q4_1x4x2 format in ggml-hexagon.cpp
- Implement dynamic Q8_1 quantization for F32 activations with block sums in matmul-ops.c
- Add vec_dot kernels for Q4_1 weights and Q8_1 activations in matmul-ops.c
- Add Q4_1 dequantizers and support for HMX fallback in hmx-matmul-ops.c

Co-authored-by: max-krasnyansky <1380796+max-krasnyansky@users.noreply.github.com>
google-labs-jules Bot and others added 2 commits May 10, 2026 05:33
- Add HTP_TYPE_Q4_1 and HTP_TYPE_Q8_1 definitions to htp-ops.h
- Implement repacking logic for Q4_1 into Q4_1x4x2 format in ggml-hexagon.cpp
- Implement dynamic Q8_1 quantization for F32 activations with block sums in matmul-ops.c
- Add vec_dot kernels for Q4_1 weights and Q8_1 activations in matmul-ops.c
- Add Q4_1 dequantizers and support for HMX fallback in hmx-matmul-ops.c

Co-authored-by: max-krasnyansky <1380796+max-krasnyansky@users.noreply.github.com>
- Add HTP_TYPE_Q4_1 and HTP_TYPE_Q8_1 definitions to htp-ops.h
- Implement repacking logic for Q4_1 into Q4_1x4x2 format in ggml-hexagon.cpp
- Implement dynamic Q8_1 quantization for F32 activations with block sums in matmul-ops.c
- Add vec_dot kernels for Q4_1 weights and Q8_1 activations in matmul-ops.c
- Add Q4_1 dequantizers and support for HMX fallback in hmx-matmul-ops.c

Co-authored-by: max-krasnyansky <1380796+max-krasnyansky@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant