VSTORE_HALF(3clc)
π vstore_half β the OpenCL manual page, but make it make sense π
okay bestie, gather round, because today we're talking about vstore_half from the OpenCL Manual (that's the 3clc section, iykyk). It converts a float to a half and writes it to a pointer to memory. That's the whole vibe. Let's get into it π«Ά
β¨ NAME β¨
vstore_half β convert float to half and write it to a pointer to memory. literally that's it, that's the job π
Here's the full roster of signatures, all of them, no skips:
void vstore_half(float data, size_t offset, __global half *p);
void vstore_half_rte(float data, size_t offset, __global half *p);
void vstore_half_rtz(float data, size_t offset, __global half *p);
void vstore_half_rtp(float data, size_t offset, __global half *p);
void vstore_half_rtn(float data, size_t offset, __global half *p);
void vstore_half(float data, size_t offset, __local half *p);
void vstore_half_rte(float data, size_t offset, __local half *p);
void vstore_half_rtz(float data, size_t offset, __local half *p);
void vstore_half_rtp(float data, size_t offset, __local half *p);
void vstore_half_rtn(float data, size_t offset, __local half *p);
void vstore_half(float data, size_t offset, __private half *p);
void vstore_half_rte(float data, size_t offset, __private half *p);
void vstore_half_rtz(float data, size_t offset, __private half *p);
void vstore_half_rtp(float data, size_t offset, __private half *p);
void vstore_half_rtn(float data, size_t offset, __private half *p);
and listen β if the optional double is supported, you may use double instead of float. slay, more precision, we love that for you πΈ
π DESCRIPTION π
so here's the tea, bestie. the float value (or double, if the optional double is supported) that you hand over as data gets converted into a half value first, using the appropriate rounding mode. then that half value gets written to the address computed as (p + offset).
β οΈ and this part is NOT optional: the address computed as (p + offset) must be 16-bit aligned. no cap. misalign it and you're in undefined territory.
vstore_half uses the current rounding mode. and the default current rounding mode? round to nearest even. that's the starting vibe unless you say otherwise π
π¦ NOTES π¦
- Vector Data Load and Store Functions let you read and write vector types from a pointer to memory. iconic behaviour honestly.
- the generic type
gentypeis used to indicate the built-in data typeschar,uchar,short,ushort,int,uint,long,ulong,float, ordouble. - the generic type name
gentypenrepresents n-element vectors ofgentypeelements. the suffix n also shows up in the function names (i.e.vloadn,vstoren, etc.), where n =2,3,4,8, or16. - π the results of vector data load and store functions are undefined if the address being read from or written to is not correctly aligned. like, do not do that. please.
- the pointer argument
pcan be a pointer toglobal(3clc),local(3clc), orprivate(3clc)memory for store functions. - the pointer argument
pcan be a pointer to__global,__local,constant(3clc)or__privatememory for load functions.
β SPECIFICATION β
OpenCL Specification[1] β yes, the actual spec, go read it, it's giving authority π
π SEE ALSO π
π AUTHORS π
The Khronos Group π«Ά
π 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 condition that this copyright notice and permission notice shall be included in all copies or substantial portions of the Materials.
πΈ NOTES πΈ
- OpenCL Specification β page 267, section 6.12.7 - Vector Data Load and Store Functions
and that's the whole page bestie, we ate and left no crumbs π
cute little sign-off for you: this one's brought to you by The Khronos Group, dated 01/14/2021, and it lives at the page name VSTORE_HALF(3clc). go forth and align your pointers, fr fr πβ¨
π¦ 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