-
Notifications
You must be signed in to change notification settings - Fork 414
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
Should we support convenience operators for methods on atomics #16238
Comments
With my user shoes on, I'd say what we should do is to embrace symmetry and support all of the existing I view CAS as just an operation that's peculiar to the type but for which there's no corresponding |
C++ supports this, but rust does not "due to the general opinion being that atomics should force you to think about memory ordering and related semantics." -- rust-lang/rust#7423. I think rust always requires users to specify memory orders and doesn't default to SeqCst, but we do so I don't think that argument aligns with Chapel. Wanting users to be able to more easily see atomic operations are happening resonates with me, but I think there's also productivity benefits to providing them. Plus the rest of our atomics interface is modeled after C/C++. I'm on board with adding operator overloads personally, but I understand the argument against them. I don't think we'd want want to add arbitrary operators for atomics and implement them with CAS. I think we just want to support operators for the methods we implement ( |
Huh, not sure how I didn't find this when we were talking about it before, but #8847 was an existing issue for this. |
The atomic updates we support are simply the intersection of the The lack of direct architectural support for |
Some methods on atomic variables have direct analogs in Chapel's operators. For example
myAtomic.add(i)
feels essentially the same asmyAtomic += i
. This issue asks whether we could/should support such convenience operators for atomic methods for which it makes sense (ones for which it doesn't would be things like the CAS-style operators, I expect.The text was updated successfully, but these errors were encountered: