ATOMIC_DEC(3clc)
β¨ NAME β¨
okay so bestie, meet atomic_dec β it's the atomic_dec functions, that's the whole name, short and sweet, no notes π
This page lives in the OpenCL Manual, and here's every single shape this function comes in (all four of them, don't skip any, I know you want to):
int atomic_dec(volatile global(3clc) int *p);
unsigned int atomic_dec(volatile global(3clc) unsigned int *p);
int atomic_dec(volatile local(3clc) int *p);
unsigned int atomic_dec(volatile local(3clc) unsigned int *p);
π¦ DESCRIPTION π¦
So here's the tea, and it's honestly so simple it's iconic:
- Read the 32-bit value stored at the location pointed by
pβ this lil guy is referred to as old, remember that name. - Compute
(old - 1). - Store that result at the location pointed by
p. - The function returns old. Yes, the old one. Not the new one. It's giving post-decrement energy, fr fr.
And for the girlies who need the big numbers: a 64-bit version of this function, atom_dec(3clc), is enabled by cl_khr_int64_base_atomics(3clc). π
π SPECIFICATION π
OpenCL Specification[1]
π SEE ALSO π
π 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 conditions:
The condition is literally this, no cap:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Materials.
(that's the whole permission situation, and yes I kept every word, because legal text is not the place to freestyle π«Ά)
πΈ NOTES πΈ
- OpenCL Specification, page 279, section 6.12.11 - Atomic Functions for 32-bit integers
and that's the whole page bestie, you ate it π
signing off β brought to you by The Khronos Group, dated 01/14/2021, and the page itself is ATOMIC_DEC(3clc). mwah, go decrement something atomically π§β¨
π¦ 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