Software Archive
Read-only legacy content
17061 Discussions

Is it possible to vectorize atomic operation on MIC?

Yuan_Y_
Beginner
293 Views

Hi all,

I use gcc built-in function such as __sync_fetch_and_add in my program for atomic operations. Is it posibble to vectorize these atomic operations?

Thanks.

0 Kudos
1 Reply
jimdempseyatthecove
Honored Contributor III
293 Views

__sync_fetch_and_add uses:

LOCK; XADD regValue, [location]

LOCK prefix is not supported for PADDB/PADDW/PADD
Additionally, the destination must be an XMM register.

You could use a CMPXCHG16B (or CMPXCHG8B) as a DCAS. This will get you partway to where you want to go.

Jim Dempsey

0 Kudos
Reply