ATOMIC_DEC(3clc)

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

✨ NAME ✨

okay so bestie, meet atomic_dec β€” it's the atomic_dec functions, that's the whole name, short and sweet, no notes πŸ’…

This page lives in the OpenCL Manual, and here's every single shape this function comes in (all four of them, don't skip any, I know you want to):

int atomic_dec(volatile global(3clc) int *p);

unsigned int atomic_dec(volatile global(3clc) unsigned int *p);

int atomic_dec(volatile local(3clc) int *p);

unsigned int atomic_dec(volatile local(3clc) unsigned int *p);

πŸ¦‹ DESCRIPTION πŸ¦‹

So here's the tea, and it's honestly so simple it's iconic:

  • Read the 32-bit value stored at the location pointed by p β€” this lil guy is referred to as old, remember that name.
  • Compute (old - 1).
  • Store that result at the location pointed by p.
  • The function returns old. Yes, the old one. Not the new one. It's giving post-decrement energy, fr fr.

And for the girlies who need the big numbers: a 64-bit version of this function, atom_dec(3clc), is enabled by cl_khr_int64_base_atomics(3clc). πŸ‘‘


🌈 SPECIFICATION 🌈

OpenCL Specification[1]


πŸ’œ SEE ALSO πŸ’œ


πŸŽ€ AUTHORS πŸŽ€

The Khronos Group


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 conditions:

The condition is literally this, no cap:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Materials.

(that's the whole permission situation, and yes I kept every word, because legal text is not the place to freestyle 🫢)


🌸 NOTES 🌸

  1. OpenCL Specification, page 279, section 6.12.11 - Atomic Functions for 32-bit integers

and that's the whole page bestie, you ate it πŸ’–

signing off β€” brought to you by The Khronos Group, dated 01/14/2021, and the page itself is ATOMIC_DEC(3clc). mwah, go decrement something atomically 🧚✨

πŸ“¦ where this page comes from