[flang-commits] [flang] [llvm] [flang][CUDA] Support module-scope variables in `global` kernels under `-gpu=mem:unified` (PR #196228)

via flang-commits flang-commits at lists.llvm.org
Wed May 6 20:36:52 PDT 2026


github-actions[bot] wrote:

<!--LLVM CODE FORMAT COMMENT: {clang-format}-->


:warning: C/C++ code formatter, clang-format found issues in your code. :warning:

<details>
<summary>
You can test this locally with the following command:
</summary>

``````````bash
git-clang-format --diff origin/main HEAD --extensions h,cpp -- flang-rt/lib/cuda/registration.cpp flang/include/flang/Runtime/CUDA/registration.h flang/lib/Optimizer/Transforms/CUDA/CUFAddConstructor.cpp flang/lib/Optimizer/Transforms/CUDA/CUFDeviceGlobal.cpp --diff_from_common_commit
``````````

:warning:
The reproduction instructions above might return results for more than one PR
in a stack if you are using a stacked PR workflow. You can limit the results by
changing `origin/main` to the base branch/commit you want to compare against.
:warning:

</details>

<details>
<summary>
View the diff from clang-format here.
</summary>

``````````diff
diff --git a/flang-rt/lib/cuda/registration.cpp b/flang-rt/lib/cuda/registration.cpp
index 1cfab3d2b..4d8764b81 100644
--- a/flang-rt/lib/cuda/registration.cpp
+++ b/flang-rt/lib/cuda/registration.cpp
@@ -31,8 +31,8 @@ extern void __cudaRegisterManagedVar(void **fatCubinHandle,
 // device-side reference of the same name resolves to the host pointer at
 // module-load time. Used for -gpu=mem:unified so kernel accesses go through
 // the host storage and HMM/ATS handles migration. Exported from libcudart.
-extern void __cudaRegisterHostVar(void **fatCubinHandle, const char *deviceName,
-    char *hostVar, size_t size);
+extern void __cudaRegisterHostVar(
+    void **fatCubinHandle, const char *deviceName, char *hostVar, size_t size);
 extern char __cudaInitModule(void **fatCubinHandle);
 
 void *RTDECL(CUFRegisterModule)(void *data) {

``````````

</details>


https://github.com/llvm/llvm-project/pull/196228


More information about the flang-commits mailing list