diff --git a/paddle/fluid/platform/mkldnn_helper.h b/paddle/fluid/platform/mkldnn_helper.h index 0b683a742c9fd8094e91c54d4f323120bad1eaca..01c2d95a0782b3977dbed07549b7ce2cbd534c0c 100644 --- a/paddle/fluid/platform/mkldnn_helper.h +++ b/paddle/fluid/platform/mkldnn_helper.h @@ -476,10 +476,8 @@ inline std::string CreateKey(const platform::MKLDNNDeviceContext& dev_ctx, inline std::string ExtendKeyWithThreadInfoIfNeeded( const platform::MKLDNNDeviceContext& dev_ctx, const std::string& key) { - return ((paddle::platform::MKLDNNDeviceContext::tls().is_tid_used_in_key() == - true) && - (platform::MKLDNNDeviceContext::tls().get_cur_mkldnn_session_id() == - platform::MKLDNNDeviceContextThreadLocals::kMKLDNNSessionID_Default)) + return (paddle::platform::MKLDNNDeviceContext::tls().is_tid_used_in_key() == + true) ? key + "-t:" + ThreadIDasStr() : key; }