[PATCH] D112230: [OpenCL] Add support of __opencl_c_device_enqueue feature macro.

Anton Zabaznov via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Oct 21 09:01:05 PDT 2021


azabaznov created this revision.
azabaznov added reviewers: Anastasia, yaxunl, svenvh.
Herald added a subscriber: ldrumm.
azabaznov requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

This feature requires support of __opencl_c_generic_address_space,
so diagnostics for that is provided as well.

The main problem with device enqueue feature is that block literal for block
with no captures emitted in global address space. This is not correct if feature
for program scope, global variables are not supported. This patch:

- Disables generation blocks with constant address space (yet) if feature for program scope global variables is not supported,

since such blocks always have no captures. Global blocks are not allowed in any other address space then constant
if feature for program scope global variables is not supported.

- For local blocks without captures, generate block literal is local scope with use of generic address space.

This is achieved adding checks during code generation and not treating block literal with no captures as constant expressions.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D112230

Files:
  clang/include/clang/Basic/DiagnosticSemaKinds.td
  clang/include/clang/Sema/Sema.h
  clang/lib/AST/ExprConstant.cpp
  clang/lib/Basic/OpenCLOptions.cpp
  clang/lib/Basic/TargetInfo.cpp
  clang/lib/CodeGen/CGBlocks.cpp
  clang/lib/CodeGen/CGOpenCLRuntime.cpp
  clang/lib/CodeGen/CGOpenCLRuntime.h
  clang/lib/Headers/opencl-c-base.h
  clang/lib/Headers/opencl-c.h
  clang/lib/Sema/Sema.cpp
  clang/lib/Sema/SemaDecl.cpp
  clang/test/CodeGenOpenCL/address-spaces-mangling.cl
  clang/test/CodeGenOpenCL/address-spaces.cl
  clang/test/CodeGenOpenCL/blocks.cl
  clang/test/CodeGenOpenCL/blocks_no_global_literal.cl
  clang/test/Frontend/opencl.cl
  clang/test/Misc/opencl-c-3.0.incorrect_options.cl
  clang/test/SemaOpenCL/constant-blocks-unsupported-cl3.0.cl
  clang/test/SemaOpenCL/invalid-block.cl
  clang/test/SemaOpenCL/invalid-device-enqueue-types-cl3.0.cl
  clang/test/SemaOpenCL/invalid-pipes-cl1.2.cl
  clang/test/SemaOpenCL/storageclass.cl

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D112230.381286.patch
Type: text/x-patch
Size: 29874 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20211021/dacaef96/attachment-0001.bin>


More information about the cfe-commits mailing list