[all-commits] [llvm/llvm-project] a19eb1: [OpenMP] Add match_{all, any, none} declare variant ...

Johannes Doerfert via All-commits all-commits at lists.llvm.org
Tue Apr 7 21:41:48 PDT 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: a19eb1de726c1ccbf60dca6a1fbcd49b3157282f
      https://github.com/llvm/llvm-project/commit/a19eb1de726c1ccbf60dca6a1fbcd49b3157282f
  Author: Johannes Doerfert <johannes at jdoerfert.de>
  Date:   2020-04-07 (Tue, 07 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.

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
```

Reviewed By: mikerice

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




More information about the All-commits mailing list