CL_KHR_INT64_EXTENDE(3clc)

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

πŸ’… 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 β€” compute min (old, val)
  • atom_max β€” compute max (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 Β© 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 πŸ“

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