ATOMIC_AND(3clc)
π NAME π
okay so bestie, welcome to the OpenCL Manual page for atomic_and β yes it's from the 3clc manual, yes it's giving β¨atomic_and functionsβ¨, and yes we're gonna read every single signature together, no skimming π«Ά
int atomic_and(volatile global(3clc) int *p, int val);
unsigned int atomic_and(volatile global(3clc) unsigned int *p,
unsigned int val);
int atomic_and(volatile local(3clc) int *p, int val);
unsigned int atomic_and(volatile local(3clc) unsigned int *p,
unsigned int val);
like. four whole flavors. global and local, signed and unsigned. she's versatile π
πΈ DESCRIPTION πΈ
So here's the tea π β you go read the 32-bit value sitting at the location that p points to. That value? We're calling her old. Iconic name, no notes.
Then you compute (old & val) β bitwise AND, the way that it just works β and you store that result back at the location pointed by p.
And the return value? She gives you back old. the original. the pre-glow-up. π
lowkey important: this is atomic, so the read-compute-write is one whole vibe, not three separate ones π«Ά
Oh and ALSO β there's a 64-bit version of this function, atom_and(3clc), and it's enabled by cl_khr_int64_extended_atomics(3clc). So if you're out here wanting the big girl bits, that's your extension bestie π§
π SPECIFICATION π
OpenCL Specification[1] β that's the source of truth, periodt π
π SEE ALSO π
go read those too, they're all in the same friend group π
π«Ά AUTHORS π«Ά
The Khronos Group β the literal main characters of this whole thing π
Β©οΈ 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 above copyright notice and this 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 π (yes, actual page number, actual section number, go look it up bestie)
The Khronos Group Β· 01/14/2021 Β· ATOMIC_AND(3clc)
and that's the whole page!! you ate that reading assignment fr fr, go forth and bitwise-AND responsibly πβ¨ππ¦
π¦ 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