[PATCH] D60455: [SYCL] Add support for SYCL device attributes

Mariya Podchishchaeva via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Apr 9 10:44:43 PDT 2019


Fznamznon added a comment.

In D60455#1459935 <https://reviews.llvm.org/D60455#1459935>, @Anastasia wrote:

> I was just wondering since SYCL is intended to be a single source C++ for OpenCL and this attribute is for internal use is it possible to just reuse existing OpenCL kernel attribute?
>
> I have raised a couple of related questions on the earlier RFC btw but there hasn't been any follow up since then I believe.


Good point. But in SYCL actually two types of functions that can be compiled for device: SYCL kernels and device functions. SYCL kernels are analog for OpenCL kernels, these are some functions that can be called from host. SYCL kernels should also have OpenCL kernel attribute to be OpenCL kernels. But if SYCL kernel calls any function - this function is compiled for device and called a “device function”. We need to detect it in compiler. And "device function" cannot be called from host and cannot be OpenCL kernel. I think there is no attribute for SYCL "device functions" in OpenCL because there is no "device functions".
So, I think I can reuse OpenCL kernel attribute (possible with __kernel keyword) for SYCL kernels but I still need SYCLDevice attribute to mark "device functions".
What do you think about it?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D60455/new/

https://reviews.llvm.org/D60455





More information about the cfe-commits mailing list