-
Notifications
You must be signed in to change notification settings - Fork 5.7k
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
Replace custom IOHW -> OIHW reorder with build-in oneDNN reorder #37175
Conversation
Thanks for your contribution! |
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.
Nicely done, but don't you want to try out AcquireApi?
|
||
return reordered_filter_data; | ||
}; | ||
platform::MKLDNNEngine engine = dev_ctx.GetEngine(); |
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.
platform::MKLDNNEngine engine = dev_ctx.GetEngine(); | |
const platform::MKLDNNEngine& engine = dev_ctx.GetEngine(); |
return reordered_filter_data; | ||
}; | ||
platform::MKLDNNEngine engine = dev_ctx.GetEngine(); | ||
platform::MKLDNNStream engine_stream(engine); |
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.
platform::MKLDNNStream engine_stream(engine); | |
auto& astream = platform::MKLDNNDeviceContext::tls().get_stream(); |
source_data_md, engine, platform::to_void_cast<K>(filter_data)); | ||
auto reordered_data_mem = platform::MKLDNNMemory(reordered_data_md, engine); | ||
platform::Reorder(source_data_mem, reordered_data_mem, engine); | ||
engine_stream.wait(); | ||
|
||
return this->template AcquireMemoryWithReorder<K>( |
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.
Why "AcquireMemoryWithReorder" is called just after doing a reorder?
|
||
return reordered_filter_data; | ||
}; | ||
const platform::MKLDNNEngine& engine = dev_ctx.GetEngine(); |
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.
I actually think this block of code is not needed. What should be modified is fragment "filter->format()" to "dnnl::format_tag::iohw" (guess) and then AcquireMemoryWithReorder will take care of rordering from IOHW -> blocked_optimized format. In your current changes you have two reorders: IOHW -> OIHW and then OIHW to blocked_optimized_format. One issue here is that filter-<format() is returning (probably) OIHW while in fact data is IOHW .
…o custom_reorder
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.
LGTM
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.
LGTM, good job!
@jczaja please merge |
PR types
Performance optimization
PR changes
OPs
Describe
PR resolves #18842