Skip to content
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

Fix eltwise alter op layout for broadcast axis #11337

Merged
merged 2 commits into from
May 18, 2022

Conversation

elvin-n
Copy link
Contributor

@elvin-n elvin-n commented May 17, 2022

The issue appeared after implementation of handling broadcast axis on dependent eltwise operators in alter op layout.
The pattern that I had conv->add and it happened that the block size was equal to the number of output channels. In one moment during network compilation we got a situation when we have already blocked layout and alter_op_layout is called one more time. During this second invocation the part dedicated for determination of the layout for second input of add detects 1 unconditionally as broadcast axis and puts wrong layout_transform(->NCHW1c). This is wrong. In our case 1 was a reminder. Need to take into account block part as well in such cases.

I believe test test_alter_layout_blocked_no_broadcast shows situation clearly. The second test test_alter_layout_re_blocking_broadcast is not required on 100% but let's have it as well - it reproduce scenario of re-blocking of axises and verifies that our algos are correct.

+@lazycal

@masahi
Copy link
Member

masahi commented May 17, 2022

Can you add a test or more description of what problem it is solving?

@elvin-n
Copy link
Contributor Author

elvin-n commented May 18, 2022

@masahi

Can you add a test or more description of what problem it is solving?

Added PR description and tests

@elvin-n elvin-n force-pushed the amalyshe/aol_elwise_fix branch from 39eb396 to 2504599 Compare May 18, 2022 07:51
@elvin-n elvin-n force-pushed the amalyshe/aol_elwise_fix branch from 2504599 to cc3779b Compare May 18, 2022 07:52
@masahi masahi merged commit 7f1c54f into apache:main May 18, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants