[all-commits] [llvm/llvm-project] 7f46c3: [OpenMP][NFC] Remove unnecessary argument

Johannes Doerfert via All-commits all-commits at lists.llvm.org
Fri Apr 3 23:58:32 PDT 2020


  Branch: refs/heads/feature/declare_variant_begin
  Home:   https://github.com/llvm/llvm-project
  Commit: 7f46c38128e7d80df1a0d43d3bbcb390ab70068a
      https://github.com/llvm/llvm-project/commit/7f46c38128e7d80df1a0d43d3bbcb390ab70068a
  Author: Johannes Doerfert <johannes at jdoerfert.de>
  Date:   2020-04-03 (Fri, 03 Apr 2020)

  Changed paths:
    M clang/include/clang/Sema/Sema.h
    M clang/lib/Sema/SemaExpr.cpp
    M clang/lib/Sema/SemaOpenMP.cpp

  Log Message:
  -----------
  [OpenMP][NFC] Remove unnecessary argument


  Commit: ba52c8466bf950d34581c696737e5b5d83c1ac5c
      https://github.com/llvm/llvm-project/commit/ba52c8466bf950d34581c696737e5b5d83c1ac5c
  Author: Johannes Doerfert <johannes at jdoerfert.de>
  Date:   2020-04-04 (Sat, 04 Apr 2020)

  Changed paths:
    M clang/include/clang/AST/ASTFwd.h
    M clang/include/clang/AST/ASTTypeTraits.h
    M clang/include/clang/AST/OpenMPClause.h
    M clang/include/clang/AST/RecursiveASTVisitor.h
    M clang/include/clang/Basic/Attr.td
    M clang/include/clang/Basic/OpenMPKinds.def
    M clang/include/clang/Basic/OpenMPKinds.h
    M clang/lib/AST/ASTTypeTraits.cpp
    M clang/lib/AST/AttrImpl.cpp
    M clang/lib/AST/OpenMPClause.cpp
    M clang/lib/AST/StmtProfile.cpp
    M clang/lib/AST/TextNodeDumper.cpp
    M clang/lib/ASTMatchers/CMakeLists.txt
    M clang/lib/ASTMatchers/Dynamic/Marshallers.h
    M clang/lib/Analysis/CMakeLists.txt
    M clang/lib/Basic/OpenMPKinds.cpp
    M clang/lib/CodeGen/CGOpenMPRuntimeNVPTX.cpp
    M clang/lib/Parse/ParseOpenMP.cpp
    M clang/lib/Sema/SemaOpenMP.cpp
    M clang/lib/Sema/TreeTransform.h
    M clang/lib/Serialization/ASTReader.cpp
    M clang/lib/Serialization/ASTWriter.cpp
    M clang/lib/StaticAnalyzer/Checkers/CMakeLists.txt
    M clang/lib/StaticAnalyzer/Core/CMakeLists.txt
    M clang/tools/libclang/CIndex.cpp
    M clang/unittests/ASTMatchers/ASTMatchersNarrowingTest.cpp
    M llvm/include/llvm/Frontend/OpenMP/OMPConstants.h
    M llvm/include/llvm/Frontend/OpenMP/OMPKinds.def
    M llvm/lib/Frontend/OpenMP/OMPConstants.cpp

  Log Message:
  -----------
  [OpenMP][NFCI] Move OpenMP clause information to `lib/Frontend/OpenMP`

Summary:
This is a cleanup and normalization patch that also enables reuse with
Flang later on. A follow up will clean up and move the directive ->
clauses mapping.

Reviewers: lebedev.ri, JonChesterfield, ABataev, fghanim

Reviewed By: fghanim

Subscribers: yaxunl, jholewinski, mgorny, hiraditya, bollu, guansong, arphaman, jfb, cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D77112


  Commit: 2a636ffac1a7d92754cd323b5ba43e7b3a14a5d5
      https://github.com/llvm/llvm-project/commit/2a636ffac1a7d92754cd323b5ba43e7b3a14a5d5
  Author: Johannes Doerfert <johannes at jdoerfert.de>
  Date:   2020-04-04 (Sat, 04 Apr 2020)

  Changed paths:
    M clang/include/clang/ASTMatchers/ASTMatchers.h
    M clang/include/clang/Basic/OpenMPKinds.def
    M clang/include/clang/Basic/OpenMPKinds.h
    M clang/lib/ASTMatchers/Dynamic/CMakeLists.txt
    M clang/lib/Basic/OpenMPKinds.cpp
    M clang/lib/Tooling/CMakeLists.txt
    M clang/lib/Tooling/Transformer/CMakeLists.txt
    M clang/unittests/AST/CMakeLists.txt
    M clang/unittests/ASTMatchers/CMakeLists.txt
    M clang/unittests/ASTMatchers/Dynamic/CMakeLists.txt
    M clang/unittests/Analysis/CMakeLists.txt
    M clang/unittests/Rename/CMakeLists.txt
    M clang/unittests/Sema/CMakeLists.txt
    M clang/unittests/StaticAnalyzer/CMakeLists.txt
    M clang/unittests/Tooling/CMakeLists.txt
    M llvm/include/llvm/Frontend/OpenMP/OMPConstants.h
    M llvm/include/llvm/Frontend/OpenMP/OMPKinds.def
    M llvm/lib/Frontend/OpenMP/OMPConstants.cpp

  Log Message:
  -----------
  [OpenMP][NFC] Move and simplify directive -> allowed clause mapping

Summary:
Move the listing of allowed clauses per OpenMP directive to the new
macro file in `llvm/Frontend/OpenMP`. Also, use a single generic macro
that specifies the directive and one allowed clause explicitly instead
of a dedicated macro per directive.

We save 800 loc and boilerplate for all new directives/clauses with no
functional change. We also need to include the macro file only once and
not once per directive.

Depends on D77112.

Reviewers: lebedev.ri, JonChesterfield, ABataev

Subscribers: hiraditya, bollu, guansong, jfb, cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D77113


  Commit: 7d29ad378f36284da426cc3c7d775bc208748bf4
      https://github.com/llvm/llvm-project/commit/7d29ad378f36284da426cc3c7d775bc208748bf4
  Author: Johannes Doerfert <johannes at jdoerfert.de>
  Date:   2020-04-04 (Sat, 04 Apr 2020)

  Changed paths:
    M clang/include/clang/AST/ASTContext.h
    M clang/include/clang/Sema/Sema.h
    M clang/lib/AST/ASTContext.cpp
    M clang/lib/Sema/SemaDecl.cpp
    M clang/lib/Sema/SemaOpenMP.cpp
    A clang/test/AST/ast-dump-openmp-begin-declare-variant_10.c
    A clang/test/AST/ast-dump-openmp-begin-declare-variant_11.c
    A clang/test/AST/ast-dump-openmp-begin-declare-variant_12.c
    M clang/test/AST/ast-dump-openmp-begin-declare-variant_2.c
    M clang/test/AST/ast-dump-openmp-begin-declare-variant_3.c
    M clang/test/AST/ast-dump-openmp-begin-declare-variant_4.c
    M clang/test/AST/ast-dump-openmp-begin-declare-variant_5.c
    M clang/test/AST/ast-dump-openmp-begin-declare-variant_6.c
    M clang/test/AST/ast-dump-openmp-begin-declare-variant_7.c
    M clang/test/AST/ast-dump-openmp-begin-declare-variant_8.c
    M clang/test/AST/ast-dump-openmp-begin-declare-variant_9.c
    M clang/test/AST/ast-dump-openmp-begin-declare-variant_addr_1.c
    A clang/test/AST/ast-dump-openmp-begin-declare-variant_namespace_1.cpp

  Log Message:
  -----------
  [OpenMP] Try to find an existing base for `omp begin/end declare variant`

Summary:
If we have a function definition in `omp begin/end declare variant` it
is a specialization of a base function with the same name and
"compatible" type. Before, we just created a declaration for the base.
With this patch we try to find an existing declaration first and only
create a new one if we did not find any with a compatible type. This is
preferable as we can tolerate slight mismatches, especially if the
specialized version is "more constrained", e.g., constexpr.

Reviewers: kiranchandramohan, ABataev, RaviNarayanaswamy, gtbercea, grokos, sdmitriev, JonChesterfield, hfinkel, fghanim, aaron.ballman

Subscribers: yaxunl, bollu, guansong, openmp-commits, cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D77252


  Commit: d1fe2040b09288e1fc582fe87911ee5d4edc7aa0
      https://github.com/llvm/llvm-project/commit/d1fe2040b09288e1fc582fe87911ee5d4edc7aa0
  Author: Johannes Doerfert <johannes at jdoerfert.de>
  Date:   2020-04-04 (Sat, 04 Apr 2020)

  Changed paths:
    M clang/lib/Sema/SemaTemplateInstantiate.cpp
    A clang/test/AST/ast-dump-openmp-begin-declare-variant_template_1.cpp

  Log Message:
  -----------
  [OpenMP] Specialize OpenMP calls after template instantiation

Summary:
As with regular calls, we want to specialize a call that went through
template instantiation if it has an applicable OpenMP declare variant.

Depends on D77113.

Reviewers: kiranchandramohan, ABataev, RaviNarayanaswamy, gtbercea, grokos, sdmitriev, JonChesterfield, hfinkel, fghanim, aaron.ballman

Subscribers: yaxunl, bollu, guansong, cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D77290


  Commit: 544ffda5ec21371d3fdace2c11378993e56f6b5b
      https://github.com/llvm/llvm-project/commit/544ffda5ec21371d3fdace2c11378993e56f6b5b
  Author: Johannes Doerfert <johannes at jdoerfert.de>
  Date:   2020-04-04 (Sat, 04 Apr 2020)

  Changed paths:
    M clang/lib/AST/ASTContext.cpp
    M clang/lib/AST/ItaniumMangle.cpp

  Log Message:
  -----------
  [WIP][OpenMP] Do not crash if no auxiliary target was given


  Commit: ddd878365b31d31264cb46fdd4e2f0f708ab8548
      https://github.com/llvm/llvm-project/commit/ddd878365b31d31264cb46fdd4e2f0f708ab8548
  Author: Johannes Doerfert <johannes at jdoerfert.de>
  Date:   2020-04-04 (Sat, 04 Apr 2020)

  Changed paths:
    M clang/include/clang/AST/OpenMPClause.h
    M clang/include/clang/Basic/AttrDocs.td
    M clang/include/clang/Basic/DiagnosticParseKinds.td
    M clang/lib/AST/OpenMPClause.cpp
    M clang/lib/Parse/ParseOpenMP.cpp
    M clang/lib/Sema/SemaOpenMP.cpp
    A clang/test/AST/ast-dump-openmp-declare-variant-extensions-messages.c
    A clang/test/AST/ast-dump-openmp-declare-variant-extensions.c
    M clang/test/OpenMP/declare_variant_ast_print.c
    M clang/test/OpenMP/declare_variant_messages.c
    M llvm/include/llvm/Frontend/OpenMP/OMPContext.h
    M llvm/include/llvm/Frontend/OpenMP/OMPKinds.def
    M llvm/lib/Frontend/OpenMP/OMPContext.cpp

  Log Message:
  -----------
  [OpenMP] Add match_{all,any,none} declare variant selector extensions.

Summary:
By default, all traits in the OpenMP context selector have to match for
it to be acceptable. Though, we sometimes want a single property out of
multiple to match (=any) or no match at all (=none). We offer these
choices as extensions via
  `implementation={extension(match_{all,any,none})}`
to the user. The choice will affect the entire context selector not only
the traits following the match property.

The first user will be D75788. There we can replace
```
  #pragma omp begin declare variant match(device={arch(nvptx64)})
  #define __CUDA__

  #include <__clang_cuda_cmath.h>

  // TODO: Hack until we support an extension to the match clause that allows "or".
  #undef __CLANG_CUDA_CMATH_H__

  #undef __CUDA__
  #pragma omp end declare variant

  #pragma omp begin declare variant match(device={arch(nvptx)})
  #define __CUDA__

  #include <__clang_cuda_cmath.h>

  #undef __CUDA__
  #pragma omp end declare variant
```
with the much simpler
```
  #pragma omp begin declare variant match(device={arch(nvptx, nvptx64)}, implementation={extension(match_any)})
  #define __CUDA__

  #include <__clang_cuda_cmath.h>

  #undef __CUDA__
  #pragma omp end declare variant
```

Reviewers: mikerice, kiranchandramohan, ABataev, RaviNarayanaswamy, gtbercea, grokos, sdmitriev, JonChesterfield, hfinkel, fghanim, aaron.ballman

Subscribers: yaxunl, hiraditya, bollu, guansong, cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D77414


  Commit: 06aecc71870f2c65d35614d74e4b8701fac2919e
      https://github.com/llvm/llvm-project/commit/06aecc71870f2c65d35614d74e4b8701fac2919e
  Author: Johannes Doerfert <johannes at jdoerfert.de>
  Date:   2020-04-04 (Sat, 04 Apr 2020)

  Changed paths:
    M clang/lib/Driver/ToolChains/Clang.cpp
    M clang/lib/Headers/CMakeLists.txt
    M clang/lib/Headers/__clang_cuda_cmath.h
    M clang/lib/Headers/__clang_cuda_device_functions.h
    M clang/lib/Headers/__clang_cuda_math.h
    M clang/lib/Headers/__clang_cuda_math_forward_declares.h
    A clang/lib/Headers/openmp_wrappers/__clang_openmp_device_functions.h
    R clang/lib/Headers/openmp_wrappers/__clang_openmp_math.h
    R clang/lib/Headers/openmp_wrappers/__clang_openmp_math_declares.h
    M clang/lib/Headers/openmp_wrappers/cmath
    M clang/lib/Headers/openmp_wrappers/math.h
    A clang/lib/Headers/openmp_wrappers/time.h
    A clang/test/Headers/Inputs/include/climits
    M clang/test/Headers/Inputs/include/cmath
    M clang/test/Headers/Inputs/include/cstdlib
    M clang/test/Headers/Inputs/include/math.h
    M clang/test/Headers/Inputs/include/stdlib.h
    M clang/test/Headers/nvptx_device_cmath_functions.c
    M clang/test/Headers/nvptx_device_cmath_functions.cpp
    M clang/test/Headers/nvptx_device_cmath_functions_cxx17.cpp
    A clang/test/Headers/nvptx_device_math_complex.c
    M clang/test/Headers/nvptx_device_math_functions.c
    M clang/test/Headers/nvptx_device_math_functions.cpp
    M clang/test/Headers/nvptx_device_math_functions_cxx17.cpp
    A clang/test/Headers/nvptx_device_math_macro.cpp
    A clang/test/Headers/nvptx_device_math_modf.cpp
    A clang/test/Headers/nvptx_device_math_sin.c
    A clang/test/Headers/nvptx_device_math_sin.cpp
    A clang/test/Headers/nvptx_device_math_sin_cos.cpp
    A clang/test/Headers/nvptx_device_math_sincos.cpp

  Log Message:
  -----------
  [OpenMP] Provide math functions in OpenMP device code via OpenMP variants

Summary:
For OpenMP target regions to piggy back on the CUDA/AMDGPU/... implementation of math functions,
we include the appropriate definitions inside of an `omp begin/end declare variant match(device={arch(nvptx)})` scope.
This way, the vendor specific math functions will become specialized versions of the system math functions.
When a system math function is called and specialized version is available the selection logic introduced in D75779
instead call the specialized version. In contrast to the code path we used so far, the system header is actually included.
This means functions without specialized versions are available and so are macro definitions.

This should address PR42061, PR42798, and PR42799.

Reviewers: kiranchandramohan, ABataev, RaviNarayanaswamy, gtbercea, grokos, sdmitriev, JonChesterfield, hfinkel, fghanim, aaron.ballman

Subscribers: tpr, tra, mgorny, bollu, guansong, openmp-commits, cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D75788


Compare: https://github.com/llvm/llvm-project/compare/7f46c38128e7%5E...06aecc71870f


More information about the All-commits mailing list