Best way to get to CAS/fetch-and-add on unboxed vectors?

Aleksey Khudyakov alexey.skladnoy at
Thu Nov 21 15:52:06 UTC 2013

On 21 November 2013 16:25, Ryan Newton <rrnewton at> wrote:
> [@Aleksey] Very good point!  I'd missed that vector does the SOA->AOS
> business too.  (I thought that was just Repa & Accelerate.)
> In any case, an unboxed vector of tuples can't actually support atomic CAS
> anyway, so not supporting it is inevitable.
>    It does mean that exposeMutableByteArray can't be a method of the Unbox
> class.  It would need to be another class capturing the subset of vector
> types that are "Atomic" (support concurrent/atomic memory ops).
Data.Vector.Primitive? Uboxed vectors for doubles/ints/etc are just
newtype wrapper
over primitive vectors AFAIR. So we probably only need ability to coerce unboxed
vector to primitive ones..

More information about the Libraries mailing list