ATOMIC_INC(3clc)
β¨ 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 ifcl_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 π
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 π
OpenCL Specificationpage279, section6.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
- ubuntu jammy: opencl-1.2-man-doc 1.0~svn33624-5 Β· other
- ubuntu noble: opencl-1.2-man-doc 1.0~svn33624-5 Β· other
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms