MAD24(3clc)

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

πŸ’– 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:

  • int
  • int2
  • int3
  • int4
  • int8
  • int16
  • uint
  • uint2
  • uint4
  • uint8
  • uint16

yes bestie, that whole list. every single one. slay πŸ‘‘


πŸ“œ SPECIFICATION πŸ“œ

OpenCL Specification[1] β€” periodt.


πŸ¦‹ SEE ALSO πŸ¦‹


πŸ‘‘ AUTHORS πŸ‘‘

The Khronos Group β€” iconic, honestly.


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 🌈

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