Description
The following table describes the list of supported functions that allow you
to read and write vector types from a pointer to memory.
We use the generic type gentype
to indicate the built-in data types
char
, uchar
, short
, ushort
, int
, uint
, long
, ulong
, float
or double
.
We use the generic type name gentypen
to represent n-element vectors
of gentype
elements.
We use the type name halfn
to represent n-element vectors of half
elements^{37}.
The suffix n is also used in the function names (i.e. vloadn,
vstoren etc.), where n = 2, 3, 4, 8 or 16.
[37] The halfn
type is only defined by the cl_khr_fp16 extension
described in section 9.4 of the OpenCL 2.0 Extension
Specification.
Function |
Description |
gentypen vloadn(size_t offset, const gentype *p) |
Return |
void vstoren(gentypen data, size_t offset, gentype *p) |
Write |
float vload_half(size_t offset, const half *p) |
Read |
floatn vload_halfn(size_t offset, const half *p) |
Read |
void vstore_half(float data, size_t offset, half *p) |
The vstore_half uses the default rounding mode. The default rounding mode is round to nearest even. |
void vstore_halfn(floatn data, size_t offset, half *p) |
The vstore_halfn uses the default rounding mode. The default rounding mode is round to nearest even. |
void vstore_half(double data, size_t offset, half *p) |
The vstore_half uses the default rounding mode. The default rounding mode is round to nearest even. |
void vstore_halfn(doublen data, size_t offset, half *p) |
The vstore_halfn uses the default rounding mode. The default rounding mode is round to nearest even. |
floatn vloada_halfn(size_t offset, const half *p) |
For n = 2, 4, 8 and 16, read For n = 3, vloada_half3 reads a |
void vstorea_halfn(floatn data, size_t offset, half *p) |
The For n = 2, 4, 8 and 16, the For n = 3, the vstorea_halfn uses the default rounding mode. The default rounding mode is round to nearest even. |
void vstorea_halfn(doublen data, size_t offset, half *p) |
The For n = 2, 4, 8 or 16, the For n = 3, the vstorea_halfn uses the default rounding mode. The default rounding mode is round to nearest even. |
[38] vload3 and vload_half3 read (x,y,z) components from address
(p + (offset * 3))
into a 3-component vector.
vstore3 and vstore_half3 write (x,y,z) components from a
3-component vector to address (p + (offset * 3))
. In addition,
vloada_half3 reads (x,y,z) components from address
(p + (offset * 4))
into a 3-component vector and vstorea_half3
writes (x,y,z) components from a 3-component vector to address (p
+ (offset * 4))
. Whether vloada_half3 and vstorea_half3 read/write
padding data between the third vector element and the next alignment boundary is
implementation defined. vloada_ and vstorea_ variants are provided to access
data that is aligned to the size of the vector, and are intended to enable
performance on hardware that can take advantage of the increased alignment.
The results of vector data load and store functions are undefined if the
address being read from or written to is not correctly aligned as described
in https://www.khronos.org/registry/OpenCL/specs/2.2/html/OpenCL_C.html#table-vector-loadstore.
The pointer argument p can be a pointer to global
, local
, or private
memory for store functions described in https://www.khronos.org/registry/OpenCL/specs/2.2/html/OpenCL_C.html#table-vector-loadstore.
The pointer argument p can be a pointer to global
, local
, constant
, or
private
memory for load functions described in https://www.khronos.org/registry/OpenCL/specs/2.2/html/OpenCL_C.html#table-vector-loadstore.
The vector data load and store functions variants that take pointer arguments which point to the generic address space are also supported. |
See Also
No cross-references are available
Document Notes
For more information, see the OpenCL C Specification
This page is extracted from the OpenCL C Specification. Fixes and changes should be made to the Specification, not directly.
Copyright
Copyright (c) 2014-2020 Khronos Group. This work is licensed under a Creative Commons Attribution 4.0 International License.