Skip to content
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

[oneDNN] Pool softmax and LRN access to cache optimized #32922

Merged
merged 2 commits into from
May 19, 2021

Conversation

jczaja
Copy link
Contributor

@jczaja jczaja commented May 14, 2021

PR types

Function optimization

PR changes

OPs

Describe

This PR reduces some mutexes and references to oneDNN cache for three operators(more to come). General idea is that instead of relying on cache to get FWD_PD when BWD_PD is to be created we recreate FWD_PD from scratch in BWD_PD if the one in cache does not exist.

@paddle-bot-old
Copy link

Thanks for your contribution!
Please wait for the result of CI firstly. See Paddle CI Manual for details.

arogowie-intel
arogowie-intel previously approved these changes May 17, 2021
class LRNMKLDNNHandler : public platform::MKLDNNHandlerT<T, mkldnn::lrn_forward,
mkldnn::lrn_backward> {
public:
LRNMKLDNNHandler(const paddle::framework::ExecutionContext& ctx,
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
LRNMKLDNNHandler(const paddle::framework::ExecutionContext& ctx,
LRNMKLDNNHandler(const framework::ExecutionContext& ctx,

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ok

const float k = ctx.Attr<float>("k");
bool is_test = ctx.Attr<bool>("is_test");

auto dims = paddle::framework::vectorize(input->dims());
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
auto dims = paddle::framework::vectorize(input->dims());
auto dims = framework::vectorize(input->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.

ok

}
}

LRNMKLDNNHandler(const paddle::framework::ExecutionContext& ctx,
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
LRNMKLDNNHandler(const paddle::framework::ExecutionContext& ctx,
LRNMKLDNNHandler(const framework::ExecutionContext& ctx,

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ok

}

LRNMKLDNNHandler(const paddle::framework::ExecutionContext& ctx,
const platform::MKLDNNDeviceContext& dev_ctx,
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
const platform::MKLDNNDeviceContext& dev_ctx,
const MKLDNNDeviceContext& dev_ctx,

because you have "using paddle::platform::MKLDNNDeviceContext;" in line 30

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ok

const float beta = ctx.Attr<float>("beta");
const float k = ctx.Attr<float>("k");

auto dims = paddle::framework::vectorize<int64_t>(in_x->dims());
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
auto dims = paddle::framework::vectorize<int64_t>(in_x->dims());
auto dims = framework::vectorize<int64_t>(in_x->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.

ok

Copy link
Contributor

@jakpiase jakpiase left a comment

Choose a reason for hiding this comment

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

LGTM

@jczaja
Copy link
Contributor Author

jczaja commented May 18, 2021

@luotao1 Could you please start your review?

@luotao1 luotao1 merged commit 56008aa into PaddlePaddle:develop May 19, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants