Skip to content

Fix a documentation bug for memory orderings #27379

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

Merged
merged 1 commit into from
Jul 29, 2015
Merged

Fix a documentation bug for memory orderings #27379

merged 1 commit into from
Jul 29, 2015

Conversation

jeehoonkang
Copy link
Contributor

As described in the module documentation, the memory orderings in Rust
are the same with that of LLVM. However, the documentation for the
memory orderings enum says the memory orderings are the same of that of
C++. Note that they differ in that C++'s support the consume reads,
while LLVM's does not. Hence this commit fixes the bug in the
documentation for the enum.

As described in the module documentation, the memory orderings in Rust
are the same with that of LLVM.  However, the documentation for the
memory orderings enum says the memory orderings are the same of that of
C++.  Note that they differ in that C++'s support the consume reads,
while LLVM's does not.  Hence this commit fixes the bug in the
documentation for the enum.
@rust-highfive
Copy link
Contributor

Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @pcwalton (or someone else) soon.

If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. The way Github handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes.

Please see the contribution instructions for more information.

@steveklabnik
Copy link
Member

@bors: r+ rollup

@bors
Copy link
Collaborator

bors commented Jul 29, 2015

📌 Commit 2081aa6 has been approved by steveklabnik

@steveklabnik
Copy link
Member

Thanks!

steveklabnik added a commit to steveklabnik/rust that referenced this pull request Jul 29, 2015
As described in the module documentation, the memory orderings in Rust
are the same with that of LLVM.  However, the documentation for the
memory orderings enum says the memory orderings are the same of that of
C++.  Note that they differ in that C++'s support the consume reads,
while LLVM's does not.  Hence this commit fixes the bug in the
documentation for the enum.
bors added a commit that referenced this pull request Jul 29, 2015
@Gankra
Copy link
Contributor

Gankra commented Jul 29, 2015

We actually explicitly intend C's memory model just "without consume", which doesn't really change the semantics or anything. Arguably we should be linking to the C standard's memory model

@bors bors merged commit 2081aa6 into rust-lang:master Jul 29, 2015
@jeehoonkang
Copy link
Contributor Author

@gankro I agree with Rust community's choice to ignore consume loads at the current moment, which LLVM also takes, in that the semantics of consume loads are not well established yet. There is an ongoing discussion in both the Standard committee and the academia. (Even, release/acquire semantics is subject to discussion in programming languages and computer architecture disciplines.)

But one thing I would like to argue is: consume loads "meant" something to compilers. GCC "tried" to understand the consume semantics and exploit it further than just the acquire semantics. But a bug was found in exploitation of the consume semantics, and they reverted to regard consume as just acquire, though.

I believe some day the consume semantics will be settled, and compilers will rely on the semantics... If that dream comes true some day, maybe it would be possible that LLVM will incorporate the consume semantics, and so as Rust. But till then, our best shot will be just ignoring the consume loads.

By the way, I found the discrepancy of the documentation in course of implementing in Rust a user-level RCU, which was the main motivation for the consume loads at the first moment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants