-
Notifications
You must be signed in to change notification settings - Fork 74k
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
[INTEL MKL] Enabling TF + OneDNN in stock TF build #47745
Conversation
@gzmkl Can you please resolve conflicts? Thanks! |
@gbaned The merge conflicts were related to oneDNN upgrade PR. They are gone after the upgrade PR is merged |
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.
Thank you very much for the PR!
#ifdef _OPENMP | ||
#include <omp.h> | ||
#endif | ||
#endif |
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.
Nit:
#endif | |
#endif // defined(ENABLE_ONEDNN_OPENMP) && defined(INTEL_MKL) |
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.
Yes, we are doing the change. Also replace INTEL_MKL with ENABLE_MKL due to line 35 change.
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.
The comment should be added to line 39 though. #endif
in line 38 is for #ifdef _OPENMP
. I will change this internally.
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.
Fixed!
@gzmkl By the way, if any change requires long testing time and you prefer to do it later. Please feel free to just add a TODO instead. |
@penpornk Thank you for the code review. Most code change suggestions are very good and I have done code change. |
@gzmkl Thank you very much for the quick responses! Please take your time. :) |
@penpornk I have committed changes per your suggestions. Please let me know if there is anything missing. |
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.
Thank you for the quick response! Several of my comments are still not addressed. But I can just make the rest of the minor modifications (and add TODOs for refactors) myself. I'm going to pull the PR in to test now.
There are two comments that I need answers though. Could you please reply to these questions? Q1, Q2
#ifdef _OPENMP | ||
#include <omp.h> | ||
#endif | ||
#endif |
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.
The comment should be added to line 39 though. #endif
in line 38 is for #ifdef _OPENMP
. I will change this internally.
PiperOrigin-RevId: 364470371 Change-Id: I6ff0e6bec13cb9dd4bf7396c22495c505f801cb1
Hey, I'm noticing some build failures in a downstream project (IREE) after this was merged. Full logs are here. Maybe we're using different flags/compilers to build. Relevant logs snippet:
This is the problematic line: tensorflow/tensorflow/core/util/mkl_util.h Line 472 in a45aa6f
This can be fixed by either removing that line or moving this tensorflow/tensorflow/core/util/mkl_util.h Lines 184 to 194 in a45aa6f
How do you want to proceed? |
@ScottTodd Sorry about the break and thank you for proposing the fix! |
@penpornk thanks, we are looking at it now. |
Changes don't need to be made in the external library, simply putting
above tensorflow/tensorflow/core/util/mkl_util.h Lines 52 to 56 in a45aa6f
works when I build locally. (I think That's just one solution though. Not sure what works best for your projects. |
After discussing with team and reviewing the related code in mkl_util.h, removing the related line of code is the right choice. |
@ScottTodd @penpornk A PR to fix the issue has been submitted here #48030. |
Refactor code to do the following:
code that is included in stock TF build will be guarded by macro INTEL_MKL
code that is included only when --config=mkl is used is now guarded by macro ENABLE_MKL
when building stock TF for x86 Linux/Windows the macro INTEL_MKL will be defined, and won't be defined for other architectures.
Added runtime env variable ENABLE_ONEDNN_OPTS that will enable oneDNN optimizations in stock TF.
for config=mkl, ENABLE_MKL will be defined.
This PR assumes
a) oneDNN is upgraded to 2.1 (PR #: #47743) and
b) stock TF and TF+oneDNN are using same oneDNN build (#47679)