-
Couldn't load subscription status.
- Fork 2.8k
[CPU][MatMul][FC] enable 3d wei matmul for fc #32063
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
aabe78c to
e9622d8
Compare
a732ef7 to
c630d12
Compare
a2fa5a5 to
b33342e
Compare
fe30488 to
e82c5a2
Compare
|
@EgorDuplensky , could you please review this PR? |
|
@azhai219 Does the PR also fixes usage of dnnl::matmul as FullyConnected node executor for compressed weights? |
5946198 to
d5505d9
Compare
| auto wDims = weiDesc.get_dims(); | ||
| std::swap(wDims[wDims.size() - 1], wDims[wDims.size() - 2]); | ||
| const auto wDataType = weiDesc.get_data_type(); | ||
| if (wDims.size() == 3 && !weightsNonTransposed) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you please clarify this change?
Does it mean we never want to reshape down to rank 2 anymore (the logic below this if)?
If yes, can we simplify the code by adding a lambda:
auto weightsFormat = [](const size_t rank, const bool weightsNonTransposed) {
switch (rank) {
case 2:
return weightsNonTransposed ? dnnl::memory::format_tag::ab : dnnl::memory::format_tag::ba;
case 3:
return weightsNonTransposed ? dnnl::memory::format_tag::abc : dnnl::memory::format_tag::bac;
default:
OPENVINO_THROW("DnnlMatmulExecutor: unsupported weights rank: ", rank);
}
};There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@EgorDuplensky In 3d case, when weightsNonTransposed is false, the tag should be acb not bac.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sure, acb
So, can we implement it this way?
| return; | ||
| } | ||
| const auto rank = shape.getRank(); | ||
| if (rank == 3 && shape.getDims()[2] > 1) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you please use a named variable for this combination of checks. The name should help to explain why we disable tensor parallel in this case (like is3DwithMultipleInputChannels or maybe there is a better name if we are talking about transformers).
Also better to use shape.getDims().back() in this case.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you please use a named variable for this combination of checks. The name should help to explain why we disable tensor parallel in this case (like is3DwithMultipleInputChannels or maybe there is a better name if we are talking about transformers). Also better to use shape.getDims().back() in this case.
OK. fix it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what about the variable?
const bool is3DwithMultipleInputChannels = rank == 3 && shape.getDims()[2] > 1;
if (is3DwithMultipleInputChannels) ...
src/plugins/intel_cpu/tests/unit/transformations/arm/convert_matmul_test_3d_weight.cpp
Outdated
Show resolved
Hide resolved
src/plugins/intel_cpu/tests/unit/transformations/arm/convert_matmul_test_3d_weight.cpp
Outdated
Show resolved
Hide resolved
src/plugins/intel_cpu/tests/unit/transformations/x64/convert_matmul_test_3d_weight.cpp
Outdated
Show resolved
Hide resolved
6050e76 to
2cac933
Compare
|
Hi @EgorDuplensky @praasz could you please review again? thanks! |
cb8ecd5 to
62426aa
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@azhai219
It is OK for me, wait for CPU team member approval.
Details:
Tickets: