ATOM_OR(3clc)
π ATOM_OR π (that's ATOM_OR(3clc) from the OpenCL Manual, bestie)
okay so listen. you're in the 3clc section of the OpenCL manual, and today's main character is atom_or β the 64-bit atom_or functions. yes queen, 64-bit. we're not doing baby numbers today.
β¨ NAME β¨
atom_or β 64-bit atom_or functions, and she serves cunt, no cap.
long atom_or(volatile global(3clc) long *p, long val);
long atom_or(volatile global(3clc) long *p, long val);
ulong atom_or(volatile local(3clc) ulong *p, ulong val);
ulong atom_or(volatile local(3clc) ulong *p, ulong val);
yes there are literally four of them and two pairs look identical β that's just how the page is, i don't make the rules, i just vibe with them π
πΈ DESCRIPTION πΈ
okay so here's the tea, fr fr:
you read the 64-bit value chillin' at the location pointed to by p β we're gonna call that one old, that's her name, that's her whole identity. then you compute (old | val) and store the result right back at the location pointed to by p. and what does the function hand you back? old. the original. the before picture. the pre-glow-up. iconic behavior honestly.
if your app wants to use this extension, you literally have to include this in your OpenCL program source:
#pragma OPENCL EXTENSION cl_khr_int64_extended_atomics : enable
like, it's not optional. it's giving prerequisites. it's giving you must do the reading before the exam.
this function goes down in one atomic transaction. one. single. atomic. transaction. slay. and important: these transactions are atomic for the device executing these atomic functions. if kernels executing on multiple devices are hitting the same memory location with atomic ops? no guarantee of atomicity, bestie. none. zero. the vibes are not protected. multiple devices = chaos = undefined territory.
oh and also β 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. cute.
π SPECIFICATION π
OpenCL Specification[1] β that's the source of truth, go read her.
π¦ SEE ALSO π¦
the whole friend group, go say hi π
π AUTHORS π
The Khronos Group
(yeah. the whole group. the collective. main character energy at an organizational level.)
β 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.
yes i typed the whole legal paragraph out. every word. because the rule is keep every detail and i am nothing if not a woman of my word π«Ά
π NOTES π
- OpenCL Specification page 279, section 6.12.11 - Atomic Functions for 32-bit integers
real talk for a sec: that's the whole page. nothing skipped, nothing merged, nothing invented.oldstill meansold,pis still a pointer, and(old | val)is still bitwise OR and not some metaphor. i would never do you like that π
and that's a wrap on ATOM_OR(3clc) from The Khronos Group, dated 01/14/2021. periodt. go do something atomic with your day β¨ππ
π¦ 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