Paddle icon indicating copy to clipboard operation
Paddle copied to clipboard

Fix reorder bug in Conv MKLDNN

Open yeliang2258 opened this issue 3 years ago • 6 comments

PR types

Bug fixes

PR changes

OPs

Describe

Fix reorder bug in conv MKLDNN

yeliang2258 avatar Aug 03 '22 12:08 yeliang2258

@yeliang2258 Please update your PR to latest codebase . We would like to evaluate it by our CI to check impact on all models we trace which will take around two days since conflicts are solved.

jczaja avatar Aug 04 '22 09:08 jczaja

@yeliang2258 Please update your PR to latest codebase . We would like to evaluate it by our CI to check impact on all models we trace which will take around two days since conflicts are solved.

Done

yeliang2258 avatar Aug 04 '22 10:08 yeliang2258

@jczaja Hello, I want to know, how can I print out the specific data in the onednnl memory

yeliang2258 avatar Aug 08 '22 09:08 yeliang2258

Hi @yeliang2258, currently fuses with elementwise_add require both elementwise_addends to have same dimensions. That's because append_sum combined with ShareDataWith accumulates both of these tensors in one memory buffer. So if they're not equal, probably some random data is treated as output from convolution.

I reproduced error offline, and it can be fixed by disabling fuse pass if dimensions don't match. Please see changes on my branch https://github.com/Silv3S/Paddle/tree/fix_elem_add_fuses.

Our new strategy for implementing fuse passes with elementwise_add is to use append_binary post-op, which supports broadcasting.

Silv3S avatar Aug 08 '22 15:08 Silv3S

@Silv3S Thank you for your reply. The solution in your branch does work, but when the shape is different, what is the problem with the code I submitted? I create a new memory object and return the calculated data, I don't understand why the result is wrong in this case

yeliang2258 avatar Aug 09 '22 02:08 yeliang2258

@Silv3S Hello, I had a user problem, same as the one here, I solved it using the solution you provided, and I made a PR to fix conv + elementwise_add merge pass first. https://github.com/PaddlePaddle/Paddle/pull/45018

yeliang2258 avatar Aug 09 '22 09:08 yeliang2258