add support for indexing in @atomic macro#54707
add support for indexing in @atomic macro#54707oscardssmith merged 17 commits intoJuliaLang:masterfrom
@atomic macro#54707Conversation
|
other than the comment above this looks good! (it is missing an implementation of getindex_atomic which we need because the regular getindex doesn't have a place to pass an order) |
|
@oscardssmith I'm not sure about the semantics of the suggested function getindex_atomic(mem::GenericMemory, i::Int, order=default_access_order(mem))
memref = memoryref(mem, i, @_boundscheck)
return memoryrefget(memref, i, order, @_boundscheck)
endbut there's nothing atomic about the function, except the |
|
The point is just that (but probably restricted to The reason we need this function is for the user to be able to provide a stricter order than |
190287c to
c7f721c
Compare
|
@oscardssmith thanks for the clarification; Alongside
I added some converts Please have a look and comment! I'll write/update docstrings once the code is approved. |
(modify|swap|replace)index! for GenericMemory@atomic macro
|
This looks great to me! We definitely need more tests (and review from @vtjnash to make sure that all of the default orders etc are correct). |
|
the default orderings are the ones from the existing cases of |
|
@vtjnash could you have a look at the proposed changes? @oscardssmith what kind of docs should be written? To me the docstring of the atomic macro is already too long, asking rather for a paragraph in the atomics part of the manual. |
|
I think this does need some docs under the but I agree with you that the docstring is already pretty long, but I kind of think that it is necessary to at least list the transforms that the macro does. |
cabf062 to
9760b73
Compare
|
@oscardssmith @vtjnash I've updated docstrings and added NEWS entry. Please let me know if something else needs to be done/changed (i.e. please review :). To me it seems ready to merge! |
|
Would be nice to check that |
|
@vchuravy I was actually thinking about spinning this functionality into a small package for julia-1.11, but merging into Atomix.jl would be even better. My only hesitation is that this package has not seen any activity in 2 years and was mostly developed by the brilliant tkf who left the community. Is it worth the effort? |
|
Atomix is actively used and @maleadt or I have commit privileges. |
|
@oscardssmith @vtjnash please let me know what else need to be done here. @nsajko, since you have access to lables I think that |
|
IMO this is ready to merge, but I do want @vtjnash to have a last lock |
|
Thanks so much for doing this! |
|
Awesome! |
Following the discussion in #54642
Implemented:
modifyindex_atomic!,swapindex_atomic!,replaceindex_atomic!forGenericMemorygetindex_atomic,setindex_atomic!,setindexonce_atomic!forGenericMemory@atomicmacros@atomicmacros[ ] update Atomics section of the manual (?)@oscardssmith @vtjnash
New
@atomictransformations implemented here: