MAD24(3clc)
π MAD24 π
okay bestie, welcome to MAD24(3clc), straight out of the OpenCL Manual π«Ά and it's lowkey one of the cutest little fast-math gremlins in the whole library, no cap.
β¨ NAME β¨
mad24 β a fast integer function that multiplies 24-bit integers and adds a 32-bit value. it's giving "multiply and add, but make it speed" π
gentype mad24(gentype x, gentype y, gentype z);
πΈ DESCRIPTION πΈ
so here's the tea β: mad24 takes two 24-bit integer values, x and y, multiplies them together, and then adds that 32-bit integer result to the 32-bit integer z. that's it, that's the whole vibe. π
now, the way the 24-bit multiplication actually goes down? that's a whole separate lore drop β go check out mul24(3clc) for the deets on how the 24-bit integer multiplication is performed. iykyk π§
π NOTES π
okay so the fast integer functions? they're the ones you reach for when you're optimizing performance of kernels π₯ like, performance-optimizing era, main character energy.
and about the type name: we say gentype as a generic type name to indicate that the function can take any of these as the type for the arguments:
intint2int3int4int8int16uintuint2uint4uint8uint16
yes bestie, that whole list. every single one. slay π
π SPECIFICATION π
OpenCL Specification[1] β periodt.
π¦ SEE ALSO π¦
integerFunctions(3clc)β your next stop, bestie, go read it π
π AUTHORS π
The Khronos Group β iconic, honestly.
π 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 following conditions:
the condition that this copyright notice and permission notice shall be included in all copies or substantial portions of the Materials.
fr fr, that's the legal stuff and you gotta keep it in there, no skipping π
π NOTES π
- OpenCL Specification β page 256, section 6.12.3 - Integer Functions
and that's the whole page, bestie!! π thank you for coming to my ted talk, brought to you by The Khronos Group, dated 01/14/2021, filed forever under MAD24(3clc). mwah π β¨π«Ά
π¦ 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