[OpenCL] Add clang extension for non-portable kernel parameters.
authorAnastasia Stulova <anastasia.stulova@arm.com>
Wed, 5 May 2021 12:18:00 +0000 (13:18 +0100)
committerAnastasia Stulova <anastasia.stulova@arm.com>
Wed, 5 May 2021 13:58:23 +0000 (14:58 +0100)
commite994e74bca49831eb649e7c67955e9de7a1784b6
tree18cdb75bde8bbb950e4937314880eb952fdda2dd
parentf6ef409406d7691bed32d1835809ed4cbb14015b
[OpenCL] Add clang extension for non-portable kernel parameters.

Added __cl_clang_non_portable_kernel_param_types extension that
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.

Currently this only disables the restrictions related to the data
layout. The programmer should ensure the compiler generates the same
layout for host and device or otherwise the argument should only be
accessed on the device side. This extension could be extended to other
case (e.g. permitting size_t) if desired in the future.

Patch by olestrohm (Ole Strohm)!

https://reviews.llvm.org/D101168
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