CL_KHR_INT64_EXTENDE(3clc)
π CL_KHR_INT64_EXTENDE (3clc) π
okay so bestie, this page is from the OpenCL Manual and it's all about one lil' optional extension that makes your atomics go 64-bit. it's giving very niche, very powerful, very iykyk. let's get into it π«Ά
πΈ NAME πΈ
cl_khr_int64_extended_atomics β an optional extension that implements atomic operations on 64-bit signed and unsigned integers to locations in __global and __local memory. β¨
and here's the incantation that turns it on:
#pragma OPENCL EXTENSION cl_khr_int64_extended_atomics : enable
π DESCRIPTION π
so if your application wants to use this extension, you literally have to include the #pragma OPENCL EXTENSION cl_khr_int64_extended_atomics : enable directive in the OpenCL program source. no pragma, no party. that's the rule π
the atomic functions that cl_khr_int64_extended_atomics supports are the ones listed below, and bestie, all of them are performed in one atomic transaction. one. transaction. periodt π
atom_minβ computemin (old, val)atom_maxβ computemax (old, val)atom_andβ compute(old & val)atom_orβ compute(old | val)atom_xorβ compute(old ^ val)
(and yes, each one has its own page too: atom_min(3clc), atom_max(3clc), atom_and(3clc), atom_or(3clc), atom_xor(3clc) β go read them, they're cute πΈ)
β οΈ okay important: these transactions are atomic for the device executing these atomic functions. there is no guarantee of atomicity if the atomic operations to the same memory location are being performed by kernels executing on multiple devices. π so like, one device at a time, bestie, don't be messy.
and one more lil' glow-up: atomic operations on 64-bit integers and 32-bit integers (and float) are also atomic w.r.t. each other. π₯
π SPECIFICATION π
OpenCL Specification[1] β that's the whole vibe. go look it up. π«
π SEE ALSO π
π«Ά AUTHORS π«Ά
The Khronos Group β absolute icons, no cap π
βοΈ COPYRIGHT βοΈ
Copyright Β© 2007-2011 The Khronos Group Inc.
okay the legal girlies wrote this part and we are NOT paraphrasing legal text, so here it is word for word, slay: π
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 10, section 9.3 - 64-bit Atomics
and that's the whole page, bestie!! π this one came from The Khronos Group, dated 01/14/2021, and it lives in the manual as CL_KHR_INT64_EXTENDE(3clc). go forth and atomically min/max/and/or/xor your way to greatness πβπ
π¦ 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