Skip to content

[FORK][FEATURE] InnerProduct primitive: u2 weights reorder to aBC4c24b4c - #320

Open
Cyberpunk1210 wants to merge 1 commit into
openvinotoolkit:v3.10_for_ie_masterfrom
Cyberpunk1210:u2-cpu-aBC4c24b4c-reorder
Open

[FORK][FEATURE] InnerProduct primitive: u2 weights reorder to aBC4c24b4c#320
Cyberpunk1210 wants to merge 1 commit into
openvinotoolkit:v3.10_for_ie_masterfrom
Cyberpunk1210:u2-cpu-aBC4c24b4c-reorder

Conversation

@Cyberpunk1210

@Cyberpunk1210 Cyberpunk1210 commented Aug 10, 2026

Copy link
Copy Markdown

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

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>
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