ATOMIC_OR(3clc)
π ATOMIC_OR β the OpenCL Manual, bestie edition π
okay so this is ATOMIC_OR(3clc) from the OpenCL Manual, and it's literally about one little function that does one little thing and does it flawlessly. main character energy fr fr β¨
β¨ NAME β¨
atomic_or β the atomic_or functions. that's it, that's the name, she's iconic π
int atomic_or(volatile global(3clc) int *p, int val);
unsigned int atomic_or(volatile global(3clc) unsigned int *p,
unsigned int val);
int atomic_or(volatile local(3clc) int *p, int val);
unsigned int atomic_or(volatile local(3clc) unsigned int *p,
unsigned int val);
likeβ¦ four flavors of the same slay. pick your address space, pick your signedness, go off π
πΈ DESCRIPTION πΈ
so here's the vibe. you point her at a location with p, she reads the 32-bit value sitting there β we call that one old, cute β then she computes (old | val) and stores that result right back at the location pointed to by p. and then? she returns old. the original. the before pic. not the glow-up, the pre-glow-up. periodt π
also!! there's a 64-bit version of this function, atom_or(3clc) β and heads up, that one is only enabled by cl_khr_int64_extended_atomics(3clc). so no extension, no 64-bit, no cap π§
π SPECIFICATION π
OpenCL Specification[1] β yeah that's the whole section, she's brief and she knows it π
π¦ SEE ALSO π¦
go read those too, iykyk π«Ά
π AUTHORS π
The Khronos Group. absolute legends, no notes π₯
π 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 above copyright notice and this permission notice shall be included in all copies or substantial portions of the Materials.
bestie this is a legal notice so i'm keeping it verbatim β no edits, no remix, it's giving "read the terms" energy π but like, respectfully.
π NOTES π
- OpenCL Specification, page 279, section 6.12.11 - Atomic Functions for 32-bit integers
and that's the whole page, we ate and left no crumbs π
shoutout to The Khronos Group, 01/14/2021, from the ATOMIC_OR(3clc) era β bye bestie, go atomically OR something ππ
π¦ 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