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

Utility operators for atomic variables #8847

Open
LouisJenkinsCS opened this issue Mar 17, 2018 · 1 comment
Open

Utility operators for atomic variables #8847

LouisJenkinsCS opened this issue Mar 17, 2018 · 1 comment

Comments

@LouisJenkinsCS
Copy link
Member

I believe that utility operations, such as +, +=, >, >=, <, <=, etc., should be supported for atomic variables. Something like the following should be supported...

var x : atomic int;
var y : atomic int;
x = 1; // x.write(1)
y = x; // y.write(x.read())
x += 1; // x.fetchAdd(1)
assert(x != y); // assert(x.read() != y.read())

Such things are convenient, even if they can be misleading (I.E x += x is not guaranteed to be atomic as they would result in two separate atomic operations) but it should be up to the user.

@bradcray
Copy link
Member

@ronawho and I have been talking about making atomics a bit more convenient to work with from time to time as well. I think he has a good handle on what we might want to support (better than I do anyway).

bradcray added a commit that referenced this issue Mar 9, 2019
Add future requesting the ability to + reduce atomics

[trivial, not reviewed]

It seems that we should be able to simply do reductions across arrays of atomics, yet this seems not to work without providing some additional helper functions yourself... This may relate somewhat to issue #8847.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants