VLOADA_HALFN(3clc)
β¨ VLOADA_HALFN β¨
okay bestie, welcome to the vloada_halfn page of the OpenCL Manual β yes it's a 3clc page, yes it's giving very "buried in section 6.12.7" energy, and yes we're gonna make it cute anyway π
πΈ NAME πΈ
vloada_halfn β read a half float vector from a pointer to memory. literally that's the whole job. queen behavior.
floatn vloada_halfn(size_t offset, const __global half *p);
floatn vloada_halfn(size_t offset, const __local half *p);
floatn vloada_halfn(size_t offset, const __constant half *p);
floatn vloada_halfn(size_t offset, const __private half *p);
π¦ DESCRIPTION π¦
so for n = 1, 2, 4, 8 and 16, you read sizeof(halfn) bytes of data from the address (p + (offset * n)). The data you read gets interpreted as a halfn value. Then β plot twist β that halfn value read gets converted to a floatn value, and that's the floatn value you get back. glow up conversion fr fr β¨
the address computed as(p + (offset * n))must be aligned tosizeof(halfn)bytes. no cap. misalignment is not a vibe.
and for n = 3, it's a lil different because 3 is the chaotic sibling: vloada_half3 reads a half3 from address (p + (offset * 4)) and returns a float3. and the address computed as (p + (offset * 4)) must be aligned to sizeof (half) * 4 bytes. yes the space between sizeof and (half) is staying, that's just how the original said it and we respect her π
π NOTES π
Vector Data Load and Store Functions let you read and write vector types from a pointer to memory. that's the whole point of them, bestie. iconic.
The generic type gentype is used to indicate the built-in data types char, uchar, short, ushort, int, uint, long, ulong, float, or double. pick your fighter.
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.
π the drama: the results of vector data load and store functions are undefined if the address being read from or written to is not correctly aligned. so like... don't do that. i'm serious. it's giving undefined behavior and not in a cute way π
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. she's versatile, she contains multitudes.
In addition vloada_half3 reads x, y, z components from address (p + (offset * 4)) into a 3-component vector. only three, not four β the fourth one is simply not invited to the party π
π SPECIFICATION π
OpenCL Specification[1]
π SEE ALSO π
vectorDataLoadandStoreFunctions(3clc)
π«Ά 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 following condition: the above copyright notice and this 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 π this one's from The Khronos Group, dated 01/14/2021, and it lives under the manual name VLOADA_HALFN(3clc) β go forth, align your pointers, and slay β¨ππ¦
π¦ 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