ATOM_DEC(3clc)
π ATOM_DEC β the OpenCL manual page, but make it make sense π
okay bestie, you found the ATOM_DEC(3clc) page from the OpenCL Manual and honestly? it's a little dry. so let me give you the group-chat translation, no details skipped, pinky promise. π«Ά
β¨ NAME β¨
atom_dec β the 64-bit atom_dec functions. yes that's the whole name section, she's brief and she knows it. π
long atom_dec(volatile global(3clc) long *p, long val);
long atom_dec(volatile global(3clc) long *p, long val);
ulong atom_dec(volatile local(3clc) ulong *p, ulong val);
ulong atom_dec(volatile local(3clc) ulong *p, ulong val);
(yes, those first two lines are literally identical, and yes, the last two are too. i did not touch them. they are sacred. π)
πΈ DESCRIPTION πΈ
so here's the vibe: you read the 64-bit value sitting at the location p points to β we're calling that value old, that's its name, it's iconic β then you compute (old - 1) and store the result right back at the location p points to. and the function hands you back old. decrement core, return the before-picture. periodt. π
if your app wants to use this extension, you're gonna need to drop this line into your OpenCL program source: c #pragma OPENCL EXTENSION cl_khr_int64_base_atomics : enable no pragma, no party. π
this whole thing happens in one atomic transaction. and here's the part where we get serious for a sec, bestie, because it matters: these transactions are atomic for the device executing these atomic functions. that's it. if kernels running on multiple devices are doing atomic operations on the same memory location, there is no guarantee of atomicity. none. zero. don't assume it. π
also lowkey important: atomic operations on 64-bit integers and 32-bit integers (and float) are also atomic with regard to each other. so they all play nice in the same sandbox. β¨
π SPECIFICATION π
OpenCL Specification[1]
π SEE ALSO π
go read those too, bestie, cross-referencing is self-care. π¦
π«Ά 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 condition that this copyright notice and permission notice shall be included in all copies or substantial portions of the Materials.
π NOTES π
- OpenCL Specification β page 279, section 6.12.11 β Atomic Functions for 32-bit integers
and that's the whole page, bestie, every crumb of it. π
signing off with love from The Khronos Group, dated 01/14/2021 β ATOM_DEC(3clc), she ate and left no crumbs π
β¨
π¦ 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