[PATCH] D77414: [OpenMP] Add match_{all,any,none} declare variant selector extensions.
Johannes Doerfert via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Fri Apr 3 10:15:12 PDT 2020
jdoerfert created this revision.
jdoerfert added reviewers: mikerice, kiranchandramohan, ABataev, RaviNarayanaswamy, gtbercea, grokos, sdmitriev, JonChesterfield, hfinkel, fghanim, aaron.ballman.
Herald added subscribers: guansong, bollu, hiraditya, yaxunl.
Herald added a project: clang.
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 <https://reviews.llvm.org/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
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D77414
Files:
clang/include/clang/Basic/AttrDocs.td
clang/include/clang/Basic/DiagnosticParseKinds.td
clang/lib/Parse/ParseOpenMP.cpp
clang/test/AST/ast-dump-openmp-declare-variant-extensions-messages.c
clang/test/AST/ast-dump-openmp-declare-variant-extensions.c
clang/test/OpenMP/declare_variant_ast_print.c
clang/test/OpenMP/declare_variant_messages.c
llvm/include/llvm/Frontend/OpenMP/OMPKinds.def
llvm/lib/Frontend/OpenMP/OMPContext.cpp
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D77414.254847.patch
Type: text/x-patch
Size: 41286 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20200403/f3b2e729/attachment-0001.bin>
More information about the cfe-commits
mailing list