ATOMIC_MIN(3clc)
π ATOMIC_MIN β the OpenCL manual page, bestie edition π
okay so you opened ATOMIC_MIN(3clc) from the OpenCL Manual and you're like "what is this tiny little guy" β bestie it's an atomic min and it's lowkey iconic. let's get into it π«Ά
β¨ NAME β¨
atomic_min β the atomic_min functions. yes, plural, there's four of them, and they are all right here, no cap.
int atomic_min(volatile global(3clc) int *p, int val);
unsigned int atomic_min(volatile global(3clc) unsigned int *p,
unsigned int val);
int atomic_min(volatile local(3clc) int *p, int val);
unsigned int atomic_min(volatile local(3clc) unsigned int *p,
unsigned int val);
look at that. global(3clc) and local(3clc) versions, signed and unsigned. four whole flavors, all slaying π
πΈ DESCRIPTION πΈ
okay so here's the tea. you hand it a pointer p, and it goes and reads the 32-bit value chillin' at that location β that value gets called old, that's its whole name, periodt.
then it computes commonMin(3clc) (old, val) β the smaller of the two β and stores that result back at the location p is pointing to. and then, as a lil treat, the function returns old. the original one. the one from before. she remembers where she came from π
ngl the "returns old" part is the whole vibe β it tells you what the value used to be, which is exactly what you want when you're doing atomic-y concurrency things. main character behavior fr fr.
and guess what β there's a 64-bit version of this function, called atom_min(3clc), and it's enabled by cl_khr_int64_extended_atomics(3clc). so if you need the big girl version, that's the extension you're looking for. iykyk β¨
π SPECIFICATION π
OpenCL Specification[1] β that's the one, that's the source, go read her π
π¦ SEE ALSO π¦
go click around, the whole atomic family is there and they're all adorable π₯
π AUTHORS π
The Khronos Group β the icons themselves, we love them, 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 condition that this copyright notice and permission notice shall be included in all copies or substantial portions of the Materials.
(translation: use it, remix it, ship it, just keep the receipt π)
π NOTES π
- OpenCL Specification β page 279, section 6.12.11 - Atomic Functions for 32-bit integers. that's your homework, bestie, page 279, section 6.12.11, go get her π
aaaaand that's the whole page!! this one is from The Khronos Group, dated 01/14/2021, and it's filed under ATOMIC_MIN(3clc) in the OpenCL Manual. go forth and atomically minimize things, you've got this ππ
β¨
π¦ 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