[PATCH] D101168: [C++4OpenCL] Add clang extension for unsafe kernel parameters

Ole Strohm via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Apr 23 08:13:34 PDT 2021


olestrohm created this revision.
olestrohm added reviewers: Anastasia, svenvh.
olestrohm added a project: clang.
Herald added subscribers: ldrumm, kerbowa, jfb, yaxunl, nhaehnle, jvesely, jholewinski.
olestrohm requested review of this revision.
Herald added a subscriber: cfe-commits.

This feature allows using non-portable types as kernel parameters. This allows bypassing the portability guarantees from the restrictions specified
in C++ for OpenCL v1.0 s2.4 <https://www.khronos.org/opencl/assets/CXX_for_OpenCL.html#kernel_function>.

Currently this only disables the restrictions related to layout, as a programmer using the same compiler for host and device should get the same representation.
This could be extended to other things (like `size_t`) if desired in the future, but I think it's unlikely that someone would want that.

Previous discussion about the extension in https://bugs.llvm.org/show_bug.cgi?id=50081


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D101168

Files:
  clang/docs/LanguageExtensions.rst
  clang/include/clang/Basic/OpenCLExtensions.def
  clang/lib/Basic/Targets/AMDGPU.h
  clang/lib/Basic/Targets/NVPTX.h
  clang/lib/Sema/SemaDecl.cpp
  clang/test/Misc/amdgcn.languageOptsOpenCL.cl
  clang/test/Misc/nvptx.languageOptsOpenCL.cl
  clang/test/Misc/r600.languageOptsOpenCL.cl
  clang/test/SemaOpenCLCXX/invalid-kernel.clcpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D101168.340033.patch
Type: text/x-patch
Size: 9783 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20210423/a2a7c3cb/attachment-0001.bin>


More information about the cfe-commits mailing list