This is an archive of the discontinued LLVM Phabricator instance.

[OpenCL] Diagnose write_only image3d when extension is disabled
ClosedPublic

Authored by svenvh on Jan 18 2017, 6:56 AM.

Details

Reviewers
yaxunl
Summary

Diagnose write_only image3d when extension is disabled

Prior to OpenCL 2.0, image3d_t can only be used with the write_only
access qualifier when the cl_khr_3d_image_writes extension is enabled,
see e.g. OpenCL 1.1 s6.8b.

Require the extension for write_only image3d_t types and guard uses of
write_only image3d_t in the OpenCL header.

Diff Detail

Event Timeline

svenvh created this revision.Jan 18 2017, 6:56 AM
yaxunl edited edge metadata.Jan 23 2017, 11:00 AM

The tests should be added to SemaOpenCL/extension-version.cl

lib/Sema/SemaType.cpp
6683 ↗(On Diff #84830)

should modify OpenCLImageTypes.def for image types associated with an extension. The diagnostics will be emitted automatically.

svenvh updated this revision to Diff 85575.Jan 24 2017, 5:38 AM
svenvh edited the summary of this revision. (Show Details)

Removed the custom sema check and added the extension to the image type in OpenCLImageTypes.def.

The tests should be added to SemaOpenCL/extension-version.cl

SemaOpenCL/extension-version.cl already has a test for the cl_khr_3d_image_writes extension.

lib/Sema/SemaType.cpp
6683 ↗(On Diff #84830)

That's neat, thanks for pointing it out!

yaxunl accepted this revision.Jan 24 2017, 6:38 AM

LGTM. Thanks!

This revision is now accepted and ready to land.Jan 24 2017, 6:38 AM
Anastasia closed this revision.Jan 25 2017, 4:31 AM

Committed in r293050!