Skip to content

Conversation

@sreekanth-yalachigere
Copy link
Contributor

Activator Relu is implemented using MKLDNN.

core/providers/mkldnn/activation
    activations.cc
    activations.h

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 {

@sreekanth-yalachigere sreekanth-yalachigere requested a review from a team as a code owner December 4, 2018 03:57
@msftclas
Copy link

msftclas commented Dec 4, 2018

CLA assistant check
All CLA requirements met.

@@ -0,0 +1,238 @@
/* Copyright(C) 2018 Intel Corporation
Copy link
Contributor

@pranavsharma pranavsharma Dec 4, 2018

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.

Copy link
Contributor

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) {
Copy link
Contributor

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
Copy link
Contributor

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

Copy link
Contributor

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.

@pranavsharma pranavsharma requested review from a team and jywu-msft December 4, 2018 06:02
mkldnn::engine& cpu_engine_;
};

// Pool which allows for reuse of MKLDNN Conv2d primitives which are expensive
Copy link
Contributor

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changing Conv2d to Relu

Copy link
Contributor

@pranavsharma pranavsharma left a 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.

Copy link
Contributor

@pranavsharma pranavsharma left a 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.

@pranavsharma pranavsharma dismissed their stale review December 4, 2018 07:33

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);
Copy link
Member

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.

Copy link
Contributor Author

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; }
Copy link
Member

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.

Copy link
Contributor Author

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;
Copy link
Member

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

removed

@sreekanth-yalachigere
Copy link
Contributor Author

@pranavsharma committed the following.
Modified the license header

added const at catch

catch (const mkldnn::error& e)

@pranavsharma
Copy link
Contributor

I still don't see MIT license mentioned like other files. You should mention // Licensed under the MIT License. at the top of the file.

@sreekanth-yalachigere
Copy link
Contributor Author

@pranavsharma added second line in header

// Licensed under the MIT License.

@pranavsharma
Copy link
Contributor

We did some build pipeline changes recently. Can you please rebase your changes? Thanks.

@sreekanth-yalachigere
Copy link
Contributor Author

@pranavsharma rebase done.

@pranavsharma pranavsharma merged commit 6d80253 into microsoft:master Dec 6, 2018

// 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.
Copy link
Contributor

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?

Copy link
Contributor Author

@sreekanth-yalachigere sreekanth-yalachigere Dec 11, 2018

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.

snnn pushed a commit that referenced this pull request Dec 11, 2018
snnn pushed a commit that referenced this pull request Dec 12, 2018
* Revert "mkldnn activations.relu (#86)"

This reverts commit 6d80253.

* Revert "MKLDNN Sum and Batch Normalizaton kernels (#115)"

This reverts commit bdd5e58.
TedThemistokleous pushed a commit to TedThemistokleous/onnxruntime that referenced this pull request Jun 2, 2025
* provider_options

* use migraphx_provider_option contants

* use migraphx_* constants for printing flags

* add kDeviceId
TedThemistokleous pushed a commit to TedThemistokleous/onnxruntime that referenced this pull request Jul 9, 2025
* provider_options

* use migraphx_provider_option contants

* use migraphx_* constants for printing flags

* add kDeviceId
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.

6 participants