cl_khr_byte_addressable_store

Enable extension to remove restrictions on byte-addressable stores.

#pragma OPENCL EXTENSION cl_khr_byte_addressable_store : enable

Description

The OpenCL extension cl_khr_byte_addressable_store removes certain restrictions on built-in types char, uchar, char2, uchar2, short, and half. An application that wants to be able to write to elements of a pointer (or struct) that are of type char, uchar, char2, uchar2, short, ushort, and half will need to include the #pragma OPENCL EXTENSION cl_khr_byte_addressable_store : enable directive before any code that performs writes that may not be supported.

Example

In this example the last two lines will compile and work correctly if the cl_khr_byte_addressable_store extension is supported.

__kernel void do_proc (__global char *pA, short b, __global short *pB) { char x[100]; __private char *px = x; int id = (int)get_global_id(0); short f; f = pB[id] + b; px[1] = pA[1]; // no longer an error. pB[id] = b; // no longer an error. }

Specification

OpenCL Specification

Also see

EXTENSION

Copyright © 2007-2009 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.