ATOMIC_INC(3clc)

πŸ“¦
version 1.0~svn33624 Β· 3 versions
, in ubuntu jammy, ubuntu noble

✨ ATOMIC_INC ✨

okay bestie, welcome to the ATOMIC_INC(3clc)</p> page of the OpenCL Manual β€” yes it's a whole vibe, yes it's short, and yes it slays. 🫢


πŸ’– NAME πŸ’–

atomic_inc β€” the atomic_inc functions. literally what it says on the tin, no cap.

int atomic_inc(volatile global(3clc) int *p);

unsigned int atomic_inc(volatile global(3clc) unsigned int *p);

int atomic_inc(volatile local(3clc) int *p);

unsigned int atomic_inc(volatile local(3clc) unsigned int *p);

look at those four icons. global and local, signed and unsigned, all four of them. πŸ‘‘


πŸ¦‹ DESCRIPTION πŸ¦‹

okay so here's the tea, and it's actually so simple it's giving main character energy:

  • read the 32-bit value (the original calls it old) that's sitting at the location pointed to by p
  • compute (old + 1)
  • store that result back at the location pointed to by p
  • and then β€” plot twist β€” the function returns old 🌸

so it increments your thing but hands you back the before picture. iykyk. it's giving "you get the receipt, not the new fit."

also!! there's a 64-bit version of this function, atom_inc(3clc), and it only shows up if cl_khr_int64_base_atomics(3clc) is enabled. so if you were wondering where the 64-bit one went... it's behind that extension door. πŸšͺ✨

πŸ“œ SPECIFICATION πŸ“œ

OpenCL Specification[1]

(the footnote down below has the deets, don't worry)


πŸ”₯ SEE ALSO πŸ”₯

go read those too, bestie, they're the whole friend group 🫢


πŸ’… AUTHORS πŸ’…

The Khronos Group


Copyright Β© 2007-2011 The Khronos Group Inc.

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and/or associated documentation files (the "Materials"), to deal in the Materials without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Materials, and to permit persons to whom the Materials are furnished to do so, subject to the following condition: the copyright notice above and this permission notice shall be included in all copies or substantial portions of the Materials. πŸ’œ


🌈 NOTES 🌈

  1. OpenCL Specification page 279, section 6.12.11 β€” Atomic Functions for 32-bit integers

and that's the whole page!! short, sweet, atomic. 🌸✨

this lil beauty is brought to you by The Khronos Group, dated 01/14/2021, and yes it really is page ATOMIC_INC(3clc) of the OpenCL Manual. periodt. πŸ’…πŸŽ€πŸ¦‹

πŸ“¦ where this page comes from