forked from OSchip/llvm-project
954ba21f85
I. Current implementation of images is not conformant to spec in the following points: 1. It makes no distinction with respect to access qualifiers and therefore allows to use images with different access type interchangeably. The following code would compile just fine: void write_image(write_only image2d_t img); kernel void foo(read_only image2d_t img) { write_image(img); } // Accepted code which is disallowed according to s6.13.14. 2. It discards access qualifier on generated code, which leads to generated code for the above example: call void @write_image(%opencl.image2d_t* %img); In OpenCL2.0 however we can have different calls into write_image with read_only and wite_only images. Also generally following compiler steps have no easy way to take different path depending on the image access: linking to the right implementation of image types, performing IR opts and backend codegen differently. 3. Image types are language keywords and can't be redeclared s6.1.9, which can happen currently as they are just typedef names. 4. Default access qualifier read_only is to be added if not provided explicitly. II. This patch corrects the above points as follows: 1. All images are encapsulated into a separate .def file that is inserted in different points where image handling is required. This avoid a lot of code repetition as all images are handled the same way in the code with no distinction of their exact type. 2. The Cartesian product of image types and image access qualifiers is added to the builtin types. This simplifies a lot handling of access type mismatch as no operations are allowed by default on distinct Builtin types. Also spec intended access qualifier as special type qualifier that are combined with an image type to form a distinct type (see statement above - images can't be created w/o access qualifiers). 3. Improves testing of images in Clang. Author: Anastasia Stulova Reviewers: bader, mgrang. Subscribers: pxli168, pekka.jaaskelainen, yaxunl. Differential Revision: http://reviews.llvm.org/D17821 llvm-svn: 265783 |
||
---|---|---|
.. | ||
address-spaces-conversions-cl2.0.cl | ||
address-spaces.cl | ||
amdgpu-num-register-attrs.cl | ||
array-parameters.cl | ||
bool-vectors.cl | ||
builtin.cl | ||
builtins-amdgcn.cl | ||
cond.cl | ||
endian-attr.cl | ||
event_t.cl | ||
event_t_overload.cl | ||
extension-fp64-cl1.1.cl | ||
extension-fp64.cl | ||
extern.cl | ||
func_ptr.cl | ||
half.cl | ||
images.cl | ||
init.cl | ||
invalid-access-qualifier.cl | ||
invalid-block.cl | ||
invalid-constant.cl | ||
invalid-image.cl | ||
invalid-kernel-attrs.cl | ||
invalid-kernel-parameters.cl | ||
invalid-kernel.cl | ||
invalid-logical-ops-1.1.cl | ||
invalid-logical-ops-1.2.cl | ||
invalid-pipe-builtin-cl2.0.cl | ||
invalid-pipes-cl2.0.cl | ||
lit.local.cfg | ||
nosvm.cl | ||
null_literal.cl | ||
optional-core-fp64-cl1.2.cl | ||
optional-core-fp64-cl2.0.cl | ||
pipes-1.2-negative.cl | ||
sampler_t.cl | ||
sampler_t_overload.cl | ||
shifts.cl | ||
sizeof.cl | ||
storageclass-cl20.cl | ||
storageclass.cl | ||
str_literals.cl | ||
unroll-hint.cl | ||
unsupported.cl | ||
vec_compare.cl | ||
vec_step.cl | ||
vector_conv_invalid.cl | ||
vector_inc_dec_ops.cl | ||
vector_literals_const.cl | ||
vector_literals_invalid.cl | ||
warn-missing-prototypes.cl |