VSTORE_HALF(3clc)

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

πŸ’– 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 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 also shows up in the function names (i.e. vloadn, vstoren, etc.), where n = 2, 3, 4, 8, or 16.
  • πŸ’€ 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 p can be a pointer to global(3clc), local(3clc), or private(3clc) memory for store functions.
  • the pointer argument p can be a pointer to __global, __local, constant(3clc) or __private memory 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 Β© 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 🌸

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