Fix mkldnn related irpasses being added triple times#16175
Fix mkldnn related irpasses being added triple times#16175LeoZhao-Intel wants to merge 3 commits intoPaddlePaddle:developfrom
Conversation
|
|
|
start review @kbinias @Superjomn |
…Paddle into leo_mkldnn_irpass
|
Since #16174 (comment), how about fix "The rootcause is CpuPassStrategy uses copy constructor to re-initialize PassStrategy by update() function, the passes in previous instance is still kept"? |
In AnalysisConfig::Update(), pass_builder_ will be reset like this: it uses copy constructor to reconstruct passstrategy, and passes_ is kept like so when call EnableMKLDNN(), the mkldnn irpassed are inserted into old passes vector instead of null vector, my patch will check if head has already include mkldnn irpass, if not, it will do insertion. Not sure for the original purpose of CpuPassStrategy copy constructor, if not use copy constructor, the change may be big and not sure if impact other cases |
pass_builder()->EnableMKLDNN() is called again in Update() after pass_builder reset |
@Superjomn Could you help see #16175 (comment)? |
|
Thanks for your contribution, we will consider to solve it in general. |
|
I was thinking that the copy constructor could copy use_mkldnn_ flag and it would also be enough. I ran into this error to and I was wondering if it is on purpose that the copy constructor does a copy of the passes only. |
Yes, but unfortunately this copy constructor just copies passes_ |
|
@LeoZhao-Intel @sfraczek Could you help see #16225? I fix it in another way. |
seems not working, pass_builder_ will be reset to new instance with just passes_ kept, "use_mkldnn_" value will be lost in new PassStrategy, PassStrategy copy constructor just copies passes_. If do change like #16225, PassStrategy copy constructor need do more. |
As @sfraczek sugested (#16175 (comment)) you could make the copy constructor copy also the |
|
close due to #16606 |
test=develop
resolve #16174