[PATCH] D101843: [OpenCL] Add clang extension for bitfields

Anastasia Stulova via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue May 4 09:23:13 PDT 2021


Anastasia created this revision.
Anastasia added reviewers: svenvh, olestrohm.
Herald added subscribers: ebevhan, kerbowa, yaxunl, nhaehnle, jvesely, jholewinski.
Anastasia requested review of this revision.

Bitfields result in struct/union layout that is implementation dependent and therefore it was excluded from OpenCL originally for portability reasons. In kernel prameters use of bitfields can result in functionality issues.

However, use of bitfields has been desirable feature for some applications, there was a discussion about allowing this in the next standards (https://github.com/KhronosGroup/OpenCL-Docs/issues/301) but regardless to that clang can expose this functionality as a compiler extension for the application that can take advanatge of it at the price of reduced portability.

This addresses PR45339!


https://reviews.llvm.org/D101843

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/SemaOpenCL/unsupported.cl

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D101843.342769.patch
Type: text/x-patch
Size: 5554 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20210504/de01ffeb/attachment.bin>


More information about the cfe-commits mailing list