This is an archive of the discontinued LLVM Phabricator instance.

[SYCL] Re-use OpenCL sampler in SYCL device mode
Needs ReviewPublic

Authored by Fznamznon on Jun 24 2019, 5:31 AM.

Details

Reviewers
bader
Anastasia
Summary

sampler_t type name is replaced with __ocl_sampler_t to avoid
potential collisions with user types.
Selectively enabled a few OpenCL diagnostics for sampler type as some
diagnostics trigger on SYCL use cases.

For instance, OpenCL kernel in SYCL mode initializes lambda captures with
the kernel argument values. This initialization code for sampler emits
errors because OpenCL disallows sampler on the right hand side of the
binary operators - these are supposed to be used only by built-in
functions.

Another potential issue is the lambda object itself -
captured sampler is a member of the lambda object and OpenCL doesn't
allow composite types with samplers. SPIR-V produced from SYCL should be
okay as lambda object can be removed by standard LLVM transformation
passes.

Patch by Alexey Bader <alexey.bader@intel.com>

Event Timeline

Fznamznon created this revision.Jun 24 2019, 5:31 AM

For instance, OpenCL kernel in SYCL mode initializes lambda captures with
the kernel argument values. This initialization code for sampler emits
errors because OpenCL disallows sampler on the right hand side of the
binary operators - these are supposed to be used only by built-in
functions.

Confused - is this already implemented anywhere? Also how about regular use of samplers in binary operators?

Another potential issue is the lambda object itself -
captured sampler is a member of the lambda object and OpenCL doesn't
allow composite types with samplers. SPIR-V produced from SYCL should be
okay as lambda object can be removed by standard LLVM transformation
passes.

Can you elaborate on this please.

clang/lib/Sema/SemaType.cpp
4622

Does this belong to sampler too?

clang/test/SemaSYCL/ocl_sampler.cpp
3

It would be nice not to replicate testing completely. Would it work to run relevant OpenCL tests in SYCL mode?

nliber added a subscriber: nliber.Dec 20 2019, 1:28 PM
nliber removed a subscriber: nliber.