VSTOREA_HALFN(3clc)
π 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 usehalfandhalfntypes will need to include the#pragma OPENCL EXTENSION cl_khr_fp16(3clc) : enabledirective. 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 π
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) π
OpenCL Specificationpage 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
- 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