[llvm] [Offload] Make CUDA Driver Version a string (PR #146049)
Ross Brunton via llvm-commits
llvm-commits at lists.llvm.org
Fri Jun 27 03:21:48 PDT 2025
https://github.com/RossBrunton created https://github.com/llvm/llvm-project/pull/146049
AMD treats this value as a string, so for consistency require this in
NVIDIA as well. This shouldn't change the output of the
`llvm-offload-device-info` tool, but does fix an issue in liboffload
when it tries to query the version.
>From 09076180c6d92845286a8ff0469a26123278e1ac Mon Sep 17 00:00:00 2001
From: Ross Brunton <ross at codeplay.com>
Date: Fri, 27 Jun 2025 11:19:53 +0100
Subject: [PATCH] [Offload] Make CUDA Driver Version a string
AMD treats this value as a string, so for consistency require this in
NVIDIA as well. This shouldn't change the output of the
`llvm-offload-device-info` tool, but does fix an issue in liboffload
when it tries to query the version.
---
offload/plugins-nextgen/cuda/src/rtl.cpp | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/offload/plugins-nextgen/cuda/src/rtl.cpp b/offload/plugins-nextgen/cuda/src/rtl.cpp
index 0e662b038c363..f1164074f9ea9 100644
--- a/offload/plugins-nextgen/cuda/src/rtl.cpp
+++ b/offload/plugins-nextgen/cuda/src/rtl.cpp
@@ -930,7 +930,9 @@ struct CUDADeviceTy : public GenericDeviceTy {
CUresult Res = cuDriverGetVersion(&TmpInt);
if (Res == CUDA_SUCCESS)
- Info.add("CUDA Driver Version", TmpInt);
+ // For consistency with other drivers, store the version as a string
+ // rather than an integer
+ Info.add("CUDA Driver Version", std::to_string(TmpInt));
Info.add("CUDA OpenMP Device Number", DeviceId);
More information about the llvm-commits
mailing list