[FORK][FEATURE] InnerProduct primitive: u2 weights reorder to aBC4c24b4c - #320
Open
Cyberpunk1210 wants to merge 1 commit into
Open
Conversation
Adds the aBC4c24b4c blocked memory format tag (block dims {4, 24, 4}) and its
CPU reorder implementation for u2 (2-bit unsigned) weights: plumbed through
dnnl_types.h / c_types_map.hpp / memory_desc_wrapper.cpp / tag_traits.hpp,
registered in cpu_reorder_regular_u2.cpp, with a new simple_reorder_impl_t
specialization in simple_reorder.hpp doing manual 2-bit extract/insert
packing.
Builds on the existing u2 InnerProduct decompression support: the CPU
GatherMatmul executor builds its InnerProduct primitive with
format_tag::any for weights, and oneDNN's own implementation-selection
logic picks aBC4c24b4c for MoE expert weight shapes (e.g. 192x512x2048 /
192x2048x512), which did not have a reorder path yet.
Verified on target hardware: DNNL_VERBOSE confirms the new reorder is
invoked for shapes matching the model's per-expert gate_up_proj/down_proj
tensors, and GPU-vs-CPU logits comparison on the real model shows cosine
similarity >= 0.999 with this format in the loop.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
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.
Adds the aBC4c24b4c blocked memory format tag (block dims {4, 24, 4}) and its
CPU reorder implementation for u2 (2-bit unsigned) weights, plumbed through
dnnl_types.h / c_types_map.hpp / memory_desc_wrapper.cpp / tag_traits.hpp,
registered in cpu_reorder_regular_u2.cpp with a new simple_reorder_impl_t
specialization in simple_reorder.hpp doing manual 2-bit extract/insert
packing.
Builds on the existing u2 InnerProduct decompression support: the CPU
GatherMatmul executor builds its InnerProduct primitive with
format_tag::any for weights, and oneDNN's own implementation-selection
logic picks aBC4c24b4c for the expert weight shapes in an INT2-quantized
MoE model (e.g. 192x512x2048 / 192x2048x512) -- this format did not have a
reorder path yet.
Verified on target hardware: DNNL_VERBOSE confirms the new reorder is
invoked (matching the model's per-expert gate_up_proj/down_proj tensor
shapes), and a GPU-vs-CPU logits comparison on the real model shows cosine
similarity >= 0.999 with this format in the loop.
Companion openvino PR: openvinotoolkit/openvino#37335