VSTOREA_HALFN(3clc)

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

πŸ’– VSTOREA_HALFN β€” the 3clc girlies' guide πŸ’–

okay so bestie, welcome to vstorea_halfn from the OpenCL Manual. she converts your float vector into a half vector and writes it out to memory. it's giving glow-up energy for your data fr fr πŸ¦‹βœ¨


✨ NAME ✨

vstorea_halfn β€” Convert float vector to half vector and write to a pointer to memory. that's it. that's the whole job. πŸ’…


🌸 SYNOPSIS 🌸

void vstorea_halfn(floatn data, size_t offset, __global half *p);

void vstorea_halfn_rte(floatn data, size_t offset, __global half *p);

void vstorea_halfn_rtz(floatn data, size_t offset, __global half *p);

void vstorea_halfn_rtp(floatn data, size_t offset, __global half *p);

void vstorea_halfn_rtn(floatn data, size_t offset, __global half *p);

void vstorea_halfn(floatn data, size_t offset, __local half *p);

void vstorea_halfn_rte(floatn data, size_t offset, __local half *p);

void vstorea_halfn_rtz(floatn data, size_t offset, __local half *p);

void vstorea_halfn_rtp(floatn data, size_t offset, __local half *p);

void vstorea_halfn_rtn(floatn data, size_t offset, __local half *p);

void vstorea_halfn(floatn data, size_t offset, __private half *p);

void vstorea_halfn_rte(floatn data, size_t offset, __private half *p);

void vstorea_halfn_rtz(floatn data, size_t offset, __private half *p);

void vstorea_halfn_rtp(floatn data, size_t offset, __private half *p);

void vstorea_halfn_rtn(floatn data, size_t offset, __private half *p);

and like… if the optional double is supported, you may use doublen instead of floatn. she's flexible, we love that for her. πŸ’œ


πŸŽ€ DESCRIPTION πŸŽ€

so the floatn value (or doublen if optional double is supported, iykyk) that's given by data gets converted into a halfn value, using the appropriate rounding mode. slay.

for n = 1, 2, 4, 8 and 16, the halfn value is written to the address computed as (p + (offset * n)). and the address computed as (p + (offset * n)) must be aligned to sizeof (halfn) bytes. no cap, alignment is not optional bestie πŸ™ˆ

for n = 3, the half3 value is written to the address computed as (p + (offset * 4)). and the address computed as (p + (offset * 4)) must be aligned to sizeof (half) * 4 bytes. yes the math changes for 3, that's just how half3 rolls. ⭐

vstorea_halfn uses the default rounding mode. the default rounding mode is round to the nearest even. periodt. πŸ‘‘

heads up bestie: an application that wants to use half and halfn types will need to include the #pragma OPENCL EXTENSION cl_khr_fp16(3clc) : enable directive. do NOT forget it, it's literally the vibe check your kernel has to pass πŸ’€

πŸ¦‹ NOTES πŸ¦‹

Vector Data Load and Store Functions allow you to read and write vector types from a pointer to memory. main character functionality tbh.

the generic type gentype is used to indicate the built-in data types char, uchar, short, ushort, int, uint, long, ulong, float, or double.

the generic type name gentypen represents n-element vectors of gentype elements. the suffix n is also used in the function names (i.e. vloadn, vstoren, etc.), where n = 2, 3, 4, 8, or 16.

⚠️ warning, fr fr: the results of vector data load and store functions are undefined if the address being read from or written to is not correctly aligned. not "kinda weird", not "a little off" β€” undefined. respect the alignment bestie 😭

the pointer argument p can be a pointer to global(3clc), local(3clc), or private(3clc) memory for store functions. and the pointer argument p can be a pointer to __global, __local, constant(3clc) or __private memory for load functions. store girls get three options, load girls get four, we don't make the rules. 🧚

vstorea_half3 writes x, y, z components from a 3-component vector to address (p + (offset * 4)). iconic.


🌈 SPECIFICATION 🌈

OpenCL Specification[1] πŸ’–


πŸ’œ SEE ALSO πŸ’œ

go read that one next, it's the whole friend group 🫢


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


πŸ’… NOTES (yes, again, this is the footnote one) πŸ’…

  1. OpenCL Specification page 267, section 6.12.7 - Vector Data Load and Store Functions πŸ“–

and that's the whole page bestie!! πŸŽ€ this one's from The Khronos Group, dated 01/14/2021, and it lives in the 3clc manual section. love u, go align your pointers, mwah πŸ’–πŸ¦‹βœ¨

πŸ“¦ where this page comes from