https://github.com/AlexVlx created 
https://github.com/llvm/llvm-project/pull/171043

#165519 added support for launching kernels from the device side. This is only 
available in CUDA at the moment. We have to explicitly check whether we are 
compiling for HIP to guard against this path being exercised, since the CUDA 
and HIP languages rely on the same `CUDAIsDevice` bit to check for device side 
compilation, and it is not possible to disambiguate otherwise.

>From c145482119e3f3f93dce9f8f013bd78b7de7fb4b Mon Sep 17 00:00:00 2001
From: Alex Voicu <[email protected]>
Date: Sun, 7 Dec 2025 15:02:20 +0000
Subject: [PATCH] Disable device-side kernel launches for HIP

---
 clang/lib/CodeGen/CGExprCXX.cpp | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/clang/lib/CodeGen/CGExprCXX.cpp b/clang/lib/CodeGen/CGExprCXX.cpp
index ce2ed9026fa1f..3f4f61db8d3a4 100644
--- a/clang/lib/CodeGen/CGExprCXX.cpp
+++ b/clang/lib/CodeGen/CGExprCXX.cpp
@@ -504,7 +504,8 @@ RValue CodeGenFunction::EmitCUDAKernelCallExpr(const 
CUDAKernelCallExpr *E,
                                                ReturnValueSlot ReturnValue,
                                                llvm::CallBase **CallOrInvoke) {
   // Emit as a device kernel call if CUDA device code is to be generated.
-  if (getLangOpts().CUDAIsDevice)
+  // TODO: implement for HIP
+  if (!getLangOpts().HIP && getLangOpts().CUDAIsDevice)
     return CGM.getCUDARuntime().EmitCUDADeviceKernelCallExpr(
         *this, E, ReturnValue, CallOrInvoke);
   return CGM.getCUDARuntime().EmitCUDAKernelCallExpr(*this, E, ReturnValue,

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

Reply via email to