-
Notifications
You must be signed in to change notification settings - Fork 885
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
Try to prevent the compiler from optimizing out MPIR_Breakpoint(). #6828
Conversation
See issue #5501 |
would it be easier/more consistent to use |
I guess this goes back to what I was saying - we already merged in a change that was supposed to fix this problem, but I gather it didn't resolve it for some compilers? Is it because the configure check missed those compilers for some reason? I'd hate to wind up back in the whack-a-mole game again. |
@ggouaillardet My apologies for not being clear. What I was trying to convey (but so poorly did) was that we had played games like this PR with compilers many times before without lasting success. Either some compilers already knew how to detect it and optimized it out, or they eventually figured it out in a future generation. The method used in #5501 seems to have worked for a more general case. I didn't realize it doesn't cover |
I believe @ggouaillardet was referring to #6527 and wondering why that wouldn't resolve the case by simply adding the "unwind" flags to the |
-fasynchronous-unwind-tables is a gcc specific option, using it with xlc (for example) will have no effect:
|
I'll hunt to see if there is an xlc equivalent we can add when |
bot:ompi:retest |
@rhc54 and I talked about this on the phone. I actually kinda like the pure-C way in this PR (i.e., return something that is volatile) because there's no compile-time way to optimize that out. You have to run it, because some other thread may have changed the value. I also like this because it doesn't introduce yet-another compiler/linker-specific flag. It's also a little different than the fix introduced in #6527 -- that fix was about providing unwind information rather than ensuring that the breakpoint was actually invoked (I think @ggouaillardet was actually asking if the same fix as #6527 would have a side-effect of also ensuring that the breakpoint was actually invoked). I think there's no harm in merging this PR, but since this is a complicated, subtle issue, I'd first like to see the comment explaining a bit more about why this volatile variable exists, etc. (more than just "not let the compiler optimize out ..."). |
Another option I have looked into was moving out MPIR_Breakpoint() into its own file, and compiling that one file without optimizations (-O0). But that seems easier said than done. Adding the -O0 is easy enough, but removing the -O3 that is tacked onto every file at configure time (?) is another story - and I'm not sure of a good approach to that. |
Lucky for you, we already have |
Something went wrong in the AWS CI. See if it was a transient error... bot:ompi:retest |
Hmm, maybe I am not doing something right then. The file is being compiled with
And the full make line:
The O3 is coming right after the O0 I added in the Makefile.am above...Not sure from where? |
Check the generated Makefile, and/or throw in some |
A while back I added the Lines 35 to 41 in afcbc0c
Maybe the optimization flag still make it into that macro or around it somewhere? |
It seems to be added to the Short of removing O3 it from CFLAGS, and adding it separately to every Makefile, I am not sure the best way of removing it for these files. I am by no means a make expert, so maybe there is another way, but it's non-obvious to me. |
afcbc0c
to
a6501c6
Compare
@jsquyres I updated the commit with some additional remarks. If that is good should we just merge it as a work-around for now? |
@awlauria I am actually unable to reproduce this behavior. Meaning: I do not see Can you please do the following:
and post the results here? |
Following your steps outlined above, I see the -O3. I am on the v3.0.x
|
@awlauria Odd. I am totally unable to reproduce this, even on the v3.0.x branch. How exactly are you configuring Open MPI? Here's what I see when I rebuild that file:
|
@jsquyres I configured without --enable-debug, so maybe that is it? |
No, that shouldn't be it. Send the first several lines of your |
|
Are there any env variables set when |
@jsquyres is this ok now? I updated the comment to have more info. |
I'm sorry to be so picky, but the reason I was asking about /* MPIR_Breakpoint(). Unfortunately since -O3 is added
* to every file via CFLAGS, there is a possibility
* that the compiler will see this function as a NOOP and
* optimize it out. To prevent this, add the volatile keyword
*/ But that's not actually what should be happening (i.e., @gpaulsen said today on the Webex that he was just starting a build to see what's happening with env variables, etc. |
So I was able to reproduce the -O3 being added in a clean checkout / build of v3.0.x on ppc64le with gcc 4.8.5 without any relevant env variable set.
I pushed the logs to my private fork here: https://github.com/gpaulsen/ompi/tree/data/pr6828_logs/pr6828 I know I should have used a Gist, but I don't think Gists work well with such large files. |
With this, I tracked down your issue. @gpaulsen's logs confirm that But @gpaulsen also confirms that they're using Automake v1.13.4. According to https://www.open-mpi.org/source/building.php, Automake >= v1.15 should be used. When compiling with Automake v1.13.3, I can replicate the That being said, I'm still amenable to the code update in this PR. But please update the comment to be a little more clear (possibly even make reference to older versions of Automake...? However you want to say it, but just be clear that when using the recomended version of Automake, the Right Things happen, but with some older versions of Automake -- e.g., v1.13.4 -- |
a6501c6
to
f6b4351
Compare
Signed-off-by: Austen Lauria <awlauria@us.ibm.com>
f6b4351
to
00106f5
Compare
@jsquyres I updated the comment to be more clear on what's going on here. Thank you for root-causing. |
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.
Good to go -- thanks for your patience, @awlauria!
Thanks @awlauria for tracking that one down. We'll want to make sure this gets into the release branches once merged. |
CI completed, so I merged. Can someone make PRs for v3.0.x, v3.1.x, and v4.0.x? |
FWIW, GCC 9.1.0 reports the following warning
|
@ggouaillardet Good catch; thanks. @awlauria Can you make another master PR to fix this, and then add that commit to your 3 PRs? |
Actually, it looks like the 3 PRs have all been merged already. I guess we'll need 4 new PR's then (one for master, one for each of the release branches). |
@ggouaillardet thanks for reporting that. I posted #6904 to fix. @jsquyres If that's fine I'll post to the other 3 branches. |
Signed-off-by: Austen Lauria awlauria@us.ibm.com