[MLX] Add quant regrouping to MLX lowering flow, and update quantize_and_save in Qwen to support MLX path#21023
Conversation
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/executorch/21023
Note: Links to docs will display an error until the docs builds have been completed. ❗ 1 Merge Blocking SEVsThere is 1 active merge blocking SEVs. Please view them below:
If you must merge, use ❌ 65 Pending, 1 Unclassified FailureAs of commit e0f870e with merge base 931ba24 ( UNCLASSIFIED FAILURE - DrCI could not classify the following job because the workflow did not run on the merge base. The failure may be pre-existing on trunk or introduced by this PR:
This comment was automatically generated by Dr. CI and updates every 15 minutes. |
|
@claude review this code |
This PR needs a
|
|
Claude finished @metascroy's task in 10m 16s —— View job Code ReviewReviewed the full diff against Findings below, roughly by importance. 1.
|
| old_groups = scale.shape[-1] | ||
| old_group_size = in_features // old_groups | ||
| repeat = old_group_size // target_group_size | ||
| if repeat <= 1: |
There was a problem hiding this comment.
why repeat < 1 is legal?
There was a problem hiding this comment.
target_group_size >= old_group_size, so repeat can only be 1 in this case. A bit confusing, though. I'll fix it
|
@claude review this code |
|
Claude finished @metascroy's task in 3m 17s —— View job Code ReviewReviewed the current diff (2 commits) against the base. This is a clean, well-documented refactor — centralizing group_size regrouping into the MLX pattern handlers ( A note on state since the last review: the Findings below, roughly by importance. 1.
|
For the MLX repacking and quantize_and_save work, we removed the redundant hand-rolled MLX regrouping/packing code in both gemma4 and qwen3.5 (deleting the old pack_mlx/export.py regroup paths and their tests).
We also added MLX path in qwen's quantize_and_save.py