-
Notifications
You must be signed in to change notification settings - Fork 336
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
Add --enable-unsafe-fp-math flag when -O3 and NNPA is used #2963
Conversation
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.
LGTM, will check if it makes a difference for the test that I was looking at.
If it makes a difference, I almost wonder if we should not always turn it on at O3.
// Enable aggressive optimization for NNPA with -O3 | ||
if (OptimizationLevel == OptLevel::O3 && | ||
getTargetAccel().find("NNPA") != std::string::npos && | ||
getLLVMOption().find("enable-unsafe-fp-math") == std::string::npos) { |
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 see, the idea is that you just check if that opt is already there. If it's there, either its true
and there is no need to add it again, or false
and then we don't add it also. Clever.
Since NNPA uses less precise data, it is reasonable to enable aggressive optimization.
Add the flag only for O3, leaving O0 for debugging.