MAX(3clc)

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

πŸ’– MAX (3clc) πŸ’–

bestie. sit down. we're reading the OpenCL Manual page for max and honestly? it's giving short-and-sweet icon behavior. no cap, this one is genuinely easy. let's go 🫢


✨ NAME ✨

max β€” returns the greater of two values. that's it. that's the whole gig. slay πŸ’…

here are the signatures, exactly as they live in the spec, do not touch them:

gentype max(gentype x, gentype y);

gentypef max(gentypef x, float y);

gentyped max(gentyped x, double y);

gentype max (gentype x, half y)      //
if half extension enabled

🌸 DESCRIPTION 🌸

so max returns y if x < y, otherwise it returns x. literally just "which one's bigger, bestie" energy. the greater one walks away with the crown πŸ‘‘

⚠️ but listen β€” if x and y are infinite or NaN, the return values are undefined. undefined!! not "we'll figure it out", not "it'll be fine", undefined. do not come crying to me when your NaN does NaN things 😭

πŸŽ€ NOTES πŸŽ€

okay this is the part where the spec explains its own nickname system, and it's actually kind of cute once you get it:

  • the generic type name gentype is used to indicate that the function can take float, float2, float3, float4, float8, float16, double, double2, double3, double4, double8, or double16 as the type for the arguments. so gentype = "any of these, pick your fighter" 🌈
  • the generic type name gentypef is used to indicate that the function can take float, float2, float3, float4, float8, or float16 as the type for the arguments. the f is for float, obviously, keep up πŸ’–
  • the generic type name gentyped is used to indicate that the function can take double, double2, double3, double4, double8, or double16 as the type for the arguments. and the d is for double. symmetry, we love her ✨

also, important vibe check: the built-in common functions are implemented using the round to nearest even rounding mode. remember that, it matters, iykyk 🧚

and if extended with cl_khr_fp16(3clc), generic type name gentype may indicate half and half{2|3|4|8|16} as arguments and return values. so half girlies are welcome too, but only with the extension enabled πŸ”₯


πŸ“œ SPECIFICATION πŸ“œ

OpenCL Specification[1]


πŸ‘€ SEE ALSO πŸ‘€

go read that one next, it's the friend group this function runs with πŸ¦‹


πŸ’œ AUTHORS πŸ’œ

The Khronos Group

(the legends themselves, no cap πŸ‘‘)


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 above copyright notice and this permission notice shall be included in all copies or substantial portions of the Materials.

the lawyers made me say it, but fr fr it's a very chill license. free to use, just keep the notice. periodt πŸŽ€

πŸ“ NOTES (the footnote kind) πŸ“

  1. OpenCL Specification page 260, section 6.12.4 - Common Functions

and that's the whole page, bestie, you ate it πŸ’…βœ¨ this was OpenCL Manual, MAX(3clc), courtesy of The Khronos Group, dated 01/14/2021. mwah, go call max on something 🫢🌸

πŸ“¦ where this page comes from