Skip to content
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

[intro.races] CWG 2297, LWG 2506: Unclear specification of atomic operations #1611

Open
jensmaurer opened this issue Apr 12, 2017 · 9 comments
Labels
not-editorial Issue is not deemed editorial; the editorial issue is kept open for tracking. sg1 Issue must be reviewed by SG1.

Comments

@jensmaurer
Copy link
Member

It is not sufficiently clear that the only atomic operations are the ones defined in clause 32 [atomics] by the library. The intent is that no accesses are atomic unless the Standard describes them as such.

An additional problem is that, e.g., new and delete are defined to be synchronization operations, but they are not defined in Clauses 32 [atomics] and 33 [thread].

CWG telecon 2017-04-10 determined this issue was editorial.

@jensmaurer jensmaurer self-assigned this Apr 12, 2017
@jensmaurer
Copy link
Member Author

I'm not seeing where we normatively say "new and delete are defined to be synchronization operations".

@jensmaurer
Copy link
Member Author

jensmaurer commented Apr 12, 2017

It is not sufficiently clear that the only atomic operations are the ones defined in clause 32 [atomics] by the library. The intent is that no accesses are atomic unless the Standard describes them as such.

This is slightly confused. Since the standard does not define operations other than those in [atomics] to be "atomic operations", and furthermore we usually use "operation on atomic object M" when talking about ordering in [intro.races], there seems to be no leeway for a hostile interpretation.

The intent is that no accesses are atomic unless the Standard describes them as such.

A conforming implementation could make all accesses atomic, but a portable user program may only rely on atomic operations specified as such in the standard.

If there is any doubt what "atomic operations on atomic objects" are, it seems [intro.races] is not the place to fix it, but instead this should be addressed in [atomics].

@timsong-cpp
Copy link
Contributor

I'm not seeing where we normatively say "new and delete are defined to be synchronization operations".

Maybe it's referring to the last sentence of [new.delete.dataraces]?

@jensmaurer
Copy link
Member Author

jensmaurer commented Apr 19, 2017

@timsong-cpp: That still doesn't say that new/delete are synchronization operations; those make unrelated memory updates visible to other threads. In contrast, for new/delete we just specify that they are serializable as individual function calls, but we don't say anything about visibility of unrelated memory updates. (I'm not positive [new.delete.dataraces] actually says what it should say; we certainly want to allow thread-optimized allocators that respond to some allocations entirely locally without coordinating with other threads. See LWG 2508 for the opposite viewpoint; to be discussed.)

@timsong-cpp
Copy link
Contributor

timsong-cpp commented Apr 19, 2017

we don't say anything about visibility of unrelated memory updates

The "happens before" part almost does that (but for consume operations).

@jensmaurer
Copy link
Member Author

jensmaurer commented Apr 19, 2017

@timsong-cpp: Fine, but I think that direction is misguided to start with. See http://lists.isocpp.org/parallel/2017/04/0856.php for discussion.

@timsong-cpp
Copy link
Contributor

@jensmaurer I can't see what I can't access :) Was just trying to point out what IMO that portion of the comment probably meant, but I think this is getting a bit off-topic...

jensmaurer added a commit to jensmaurer/draft that referenced this issue Jul 21, 2017
jensmaurer added a commit to jensmaurer/draft that referenced this issue Jul 30, 2017
jensmaurer added a commit to jensmaurer/draft that referenced this issue Oct 15, 2017
@jensmaurer
Copy link
Member Author

This is covered by LWG 2506.

@jensmaurer jensmaurer changed the title [intro.races] CWG 2297: Unclear specification of atomic operations [intro.races] CWG 2297, LWG 2506: Unclear specification of atomic operations Apr 13, 2018
@jensmaurer jensmaurer added lwg Issue must be reviewed by LWG. cwg Issue must be reviewed by CWG. not-editorial Issue is not deemed editorial; the editorial issue is kept open for tracking. labels Apr 13, 2018
@jensmaurer jensmaurer removed their assignment Apr 13, 2018
@jensmaurer
Copy link
Member Author

SG1 discussion on LWG 2506 asked for a paper to address "atomic object", "atomic operation", "synchronization operation" etc.

@jensmaurer jensmaurer added sg1 Issue must be reviewed by SG1. and removed cwg Issue must be reviewed by CWG. lwg Issue must be reviewed by LWG. labels Oct 11, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
not-editorial Issue is not deemed editorial; the editorial issue is kept open for tracking. sg1 Issue must be reviewed by SG1.
Projects
None yet
Development

No branches or pull requests

2 participants