-
Notifications
You must be signed in to change notification settings - Fork 30
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
Issues due to OCaml 5 compiler bug with Atomic.get
#97
Comments
The MPMC relaxed queue has this operation: saturn/src_lockfree/mpmc_relaxed_queue.ml Lines 113 to 115 in 49e4e59
And it is used here: saturn/src_lockfree/mpmc_relaxed_queue.ml Lines 125 to 134 in 49e4e59
Unfortunately the compiler optimizes out the
The register So, the optimization done by the compiler defeats the optimization done by the programmer. |
I think that the compiler bug affects more things than I initially thought. Basically, if you have a non-recursive function (i.e. an inlineable function) that uses You would expect two linearizable operations on a single thread to have a timeline like:
But with the optimization that is no longer the case. The timelines are merged and the points ( This can even happen across operations. You might have three operations, So, basically, any operations in Saturn that are non-recursive and might return after a(ny number of) To be safe(r), as a workaround, any non-recursive uses of |
Today we identified a compiler bug in OCaml 5 where the compiler may incorrectly optimize away repeated
Atomic.get
s.We already identified several places in my PR #83 that were affected by this compiler bug.
I'll go through the code in Saturn (in the following days) and try to identify other places affected by the bug and add them as comments here. I already identified one case, but I probably don't have time today to find more.
The text was updated successfully, but these errors were encountered: