[PATCH] D140155: [Clang][OpenMP] Allow host call to nohost function with host variant
Gheorghe-Teodor Bercea via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Thu Dec 15 14:28:26 PST 2022
doru1004 added inline comments.
================
Comment at: clang/lib/Sema/SemaOpenMP.cpp:2704
+ VariantFD->getMostRecentDecl());
+ if (!DevTy || *DevTy == OMPDeclareTargetDeclAttr::DT_Host)
+ HasHostFunctionVariant = true;
----------------
ABataev wrote:
> doru1004 wrote:
> > ABataev wrote:
> > > Isuppose it must be `DevTy && *DevTy == OMPDeclareTargetDeclAttr::DT_Host`, no?
> > Correct me if I'm wrong but if there's no device type associated with the function then it is a host function? For the second part of the condition, if there exists a DevTy associated with the function then it has to be DT_Host.
> Ah, I missed it. Can we have just declare variant without device type? Can you add a test for this case?
You mean when the variant function definition does not have a device type declared? That's the case that's currently tested:
```
#pragma omp declare variant(host_function) match(device={kind(host)})
void fun() {}
void host_function() {}
```
But I think you're right I should add another test which tests the other part of the condition when the host_function has a device type.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D140155/new/
https://reviews.llvm.org/D140155
More information about the cfe-commits
mailing list