================
@@ -52,16 +52,85 @@ bool SemaCUDA::PopForceHostDevice() {
 ExprResult SemaCUDA::ActOnExecConfigExpr(Scope *S, SourceLocation LLLLoc,
                                          MultiExprArg ExecConfig,
                                          SourceLocation GGGLoc) {
-  FunctionDecl *ConfigDecl = getASTContext().getcudaConfigureCallDecl();
+  bool IsDeviceKernelCall = false;
+  switch (CurrentTarget()) {
+  case CUDAFunctionTarget::Global:
+  case CUDAFunctionTarget::Device:
+    IsDeviceKernelCall = true;
+    break;
+  case CUDAFunctionTarget::HostDevice:
+    if (getLangOpts().CUDAIsDevice) {
+      // Under the device compilation, config call under an HD function should
+      // be treated as a device kernel call. But, for implicit HD ones (such as
+      // lambdas), need to check whether RDC is enabled or not.
+      IsDeviceKernelCall = true;
+      if (!getLangOpts().GPURelocatableDeviceCode) {
+        FunctionDecl *Caller = 
SemaRef.getCurFunctionDecl(/*AllowLambda=*/true);
+        if (Caller && isImplicitHostDeviceFunction(Caller))
+          IsDeviceKernelCall = false;
+      }
+    }
+    break;
+  default:
+    break;
+  }
+
+  if (IsDeviceKernelCall && !getLangOpts().GPURelocatableDeviceCode)
----------------
yxsamliu wrote:

Can we emit a diag for HIP that this is not supported. And add a lit test. 
Thanks.

https://github.com/llvm/llvm-project/pull/165519
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to