[PATCH] D156184: [OpenMP] Add the `ompx_attribute` clause for target directives

Johannes Doerfert via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 24 16:03:24 PDT 2023


jdoerfert created this revision.
jdoerfert added reviewers: jhuber6, ggeorgakoudis, koparasy, tianshilei1992, tra, arsenm.
Herald added subscribers: sunshaoce, mattd, gchakrabarti, asavonic, kerbowa, arphaman, guansong, bollu, tpr, yaxunl, jvesely.
Herald added a reviewer: aaron.ballman.
Herald added a project: All.
jdoerfert requested review of this revision.
Herald added subscribers: llvm-commits, wangpc, jplehr, sstefan1, wdng, jholewinski.
Herald added a project: LLVM.

CUDA and HIP have kernel attributes to tune the code generation (in the
backend). To reuse this functionality for OpenMP target regions we
introduce the `ompx_attribute` clause that takes these kernel
attributes and emits code as if they had been attached to the kernel
fuction (which is implicitly generated).

To limit the impact, we only support three kernel attributes:
`amdgpu_waves_per_eu`, for AMDGPU
`amdgpu_flat_work_group_size`, for AMDGPU
`launch_bounds`, for NVPTX

The existing implementations of those attributes are used for error
checking and code generation. `ompx_attribute` can be attached to any
executable target region and it can hold more than one kernel attribute.


https://reviews.llvm.org/D156184

Files:
  clang/include/clang/AST/OpenMPClause.h
  clang/include/clang/AST/RecursiveASTVisitor.h
  clang/include/clang/Basic/DiagnosticGroups.td
  clang/include/clang/Basic/DiagnosticParseKinds.td
  clang/include/clang/Parse/Parser.h
  clang/include/clang/Sema/Sema.h
  clang/lib/AST/ExprConstant.cpp
  clang/lib/AST/OpenMPClause.cpp
  clang/lib/AST/StmtProfile.cpp
  clang/lib/CodeGen/CGOpenMPRuntime.cpp
  clang/lib/CodeGen/CodeGenModule.h
  clang/lib/CodeGen/Targets/AMDGPU.cpp
  clang/lib/CodeGen/Targets/NVPTX.cpp
  clang/lib/Parse/ParseOpenMP.cpp
  clang/lib/Sema/SemaDeclAttr.cpp
  clang/lib/Sema/SemaOpenMP.cpp
  clang/lib/Sema/TreeTransform.h
  clang/lib/Serialization/ASTReader.cpp
  clang/lib/Serialization/ASTWriter.cpp
  clang/test/OpenMP/ompx_attributes_codegen.cpp
  clang/test/OpenMP/ompx_attributes_messages.cpp
  clang/tools/libclang/CIndex.cpp
  llvm/include/llvm/Frontend/OpenMP/OMP.td

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D156184.543738.patch
Type: text/x-patch
Size: 48629 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230724/c53ce353/attachment.bin>


More information about the llvm-commits mailing list