Skip to content

[CPU]RNN not specify weight layout when creating primitive descriptor.#20068

Merged
dmitry-gorokhov merged 8 commits into
openvinotoolkit:masterfrom
luweizhou2016:luwei/rnn_fix
Jan 22, 2024
Merged

[CPU]RNN not specify weight layout when creating primitive descriptor.#20068
dmitry-gorokhov merged 8 commits into
openvinotoolkit:masterfrom
luweizhou2016:luwei/rnn_fix

Conversation

@luweizhou2016
Copy link
Copy Markdown
Contributor

@luweizhou2016 luweizhou2016 commented Sep 27, 2023

Details:

  • RNN not specify weight layout when creating primitive descriptor.

Tickets:

RNN weight expose planar layout to cpu graph.
@luweizhou2016 luweizhou2016 requested review from a team as code owners September 27, 2023 03:50
@github-actions github-actions Bot added the category: CPU OpenVINO CPU plugin label Sep 27, 2023
@luweizhou2016 luweizhou2016 changed the title RNN not specify weight layout when creating primitive descriptor. [CPU]RNN not specify weight layout when creating primitive descriptor. Sep 27, 2023
@luweizhou2016 luweizhou2016 marked this pull request as draft October 8, 2023 06:25
@luweizhou2016 luweizhou2016 marked this pull request as ready for review October 12, 2023 03:46
@luweizhou2016 luweizhou2016 reopened this Nov 21, 2023
@dmitry-gorokhov
Copy link
Copy Markdown

@EgorDuplensky please review the PR

@dmitry-gorokhov dmitry-gorokhov added this to the 2023.3 milestone Nov 22, 2023
CPU_REGISTER_PASS_COMMON(manager, ConvertToSwishCPU);
CPU_REGISTER_PASS_COMMON(manager, OptimizeSequenceTransposes);
if (!ov::op::util::has_op_with_type<ov::op::v0::FakeQuantize>(nGraphFunc)) {
CPU_REGISTER_PASS_COMMON(manager, ReshapeFullyConnectedFusion);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you please split it into two PRs, one for "always any layout for RNN weights" and another one for disabling ReshapeFullyConnectedFusion transformation.
Also don't we want to remove the transformation itself if it is not need anymore?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These 2 changes aim to improve more bregemm kernel can be covered.
The reason of removing this reshape+fc fusing is because we found brgemm implement would have some limitations on input activation or weight shape. ONEDNN brgemm FC would fall back to gemm legacy when having input 4D tensors.
Also since reshape node in this case should only change input out memory descriptor and no memory copy in my recall.

"4D input -> Rehape to 2D input with 2D weight -> FC" would be transformed to "4D input with 4D weight -> FC"
The former internal CI run the result of regression:
http://10.67.108.202:8080/benchmark/tput/1566/1536
http://10.67.108.202:8080/benchmark/latency/1567/1529

Seem removing this fusion has no side effect on AVX2 and avx512 .

@luweizhou2016
Copy link
Copy Markdown
Contributor Author

@EgorDuplensky , Split into 2 PRs. Another #21442. Thx!

@github-actions
Copy link
Copy Markdown
Contributor

This PR will be closed in a week because of 2 weeks of no activity.

@github-actions github-actions Bot added the Stale label Dec 19, 2023
@dmitry-gorokhov dmitry-gorokhov modified the milestones: 2023.3, 2024.0 Dec 20, 2023
@github-actions github-actions Bot removed the Stale label Dec 21, 2023
Comment thread src/plugins/intel_cpu/src/nodes/rnn.cpp Outdated
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So, this heuristic is not needed anymore?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are we enabling avx2 for Convolution node at the same time?
If so, we better to do it in scope of separate PR as well.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems I have merged with another feature branch last time. Sorry for that, there should only rnn related changes in this PR. Already force update. Thx!

@luweizhou2016
Copy link
Copy Markdown
Contributor Author

@EgorDuplensky , Applied review comments.

@yuxu42
Copy link
Copy Markdown
Contributor

yuxu42 commented Jan 22, 2024

@EgorDuplensky Could you please continue to review the PR? Thanks!

@dmitry-gorokhov dmitry-gorokhov merged commit 9737fc7 into openvinotoolkit:master Jan 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

category: CPU OpenVINO CPU plugin

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants