-
Notifications
You must be signed in to change notification settings - Fork 3.7k
mkldnn activations.relu #86
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
Conversation
| @@ -0,0 +1,238 @@ | |||
| /* Copyright(C) 2018 Intel Corporation | |||
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.
Is there a legal reason to use this license? This has to be under MIT license, not Apache.
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 believe this should be ok. Will double check.
| ReluPrimitive<T>* relulPrimitive = ReluPrimitivePool<T>::Get(pool_params); | ||
|
|
||
| relulPrimitive->Compute(src_data, dst_data); | ||
| } catch (mkldnn::error& e) { |
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.
const mkldnn::error&
| @@ -0,0 +1,32 @@ | |||
| /* Copyright(C) 2018 Intel Corporation | |||
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.
same comment as above for the license
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 believe this should be ok. Will double check.
| mkldnn::engine& cpu_engine_; | ||
| }; | ||
|
|
||
| // Pool which allows for reuse of MKLDNN Conv2d primitives which are expensive |
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.
It should be not Conv2d.
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.
Changing Conv2d to Relu
pranavsharma
left a comment
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.
Blocking this for license related changes.
pranavsharma
left a comment
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.
Unblocking for now. Will double check.
Unblocking for now. Will double check.
| // Used as the key for Pool Primitive Reuse Pool. | ||
| std::string ToString() const { | ||
| std::string key; | ||
| key.reserve(128); |
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.
probably don't need 128 bytes for just a src and dst dims.
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.
will change this to 64 bytes
| return; | ||
| } | ||
|
|
||
| mkldnn::memory::format GetSrcMemoryFormat() const { return context_.src_fmt; } |
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.
GetSrcMemoryFormat and GetDstMemoryFormat are not used?
can get rid of the members (src_fmt, dst_fmt) in context as well then.
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.
Removed
|
|
||
| private: | ||
| struct ReluContext { | ||
| mkldnn::memory::format src_fmt; |
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.
per comment above. remove src_fmt, and dst_fmt if no need for them.
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.
removed
|
@pranavsharma committed the following. added const at catch
|
|
I still don't see MIT license mentioned like other files. You should mention |
|
@pranavsharma added second line in header
|
|
We did some build pipeline changes recently. Can you please rebase your changes? Thanks. |
|
@pranavsharma rebase done. |
|
|
||
| // Pool which allows for reuse of MKLDNN Relu primitives which are expensive | ||
| // to instantiate. To address thread safety, the primitives are stored in a map | ||
| // on thread local storage. |
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.
Who is in the thread local storage?
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.
@snnn kernel objects like Relu lives in thread local storage. This is very similar to @weixingzhang's implementation of Conv and Pool kernels.
* provider_options * use migraphx_provider_option contants * use migraphx_* constants for printing flags * add kDeviceId
* provider_options * use migraphx_provider_option contants * use migraphx_* constants for printing flags * add kDeviceId
Activator Relu is implemented using MKLDNN.
Modified CPU Relu class definition to enable MKLDNN Relu class to inherit for fallback option
class Relu final : public OpKernel {to
class Relu : public OpKernel {