[clang] [CUDA] Exclude device static locals from CUDADeviceVarODRUsedByHost (PR #245671)
Artem Belevich via cfe-commits
cfe-commits at lists.llvm.org
Thu Nov 26 00:34:11 PST 2026
================
@@ -181,12 +191,36 @@ public:
};
}
+// Lambdas are always implicitly HD. If a static variable defined in the
+// outer kernel/device function is referenced by lambda, that is technically
+// a host referenced device variable. Make sure it doesn't get into
+// CUDADeviceVarODRUsedByHost and not emitted twice.
----------------
Artem-B wrote:
Nit: suggest tightening the comment wording:
```suggestion
// Unannotated lambdas are implicitly __host__ __device__, so referencing a
// static local from an enclosing kernel or device function looks like a
// host-side ODR-use. Verify that it is excluded from
// CUDADeviceVarODRUsedByHost and emitted only once.
```
https://github.com/llvm/llvm-project/pull/245671
More information about the cfe-commits
mailing list