ATOMIC_AND(3clc)

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

πŸ’… 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 Β© 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 πŸ“

  1. 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