Skip to content

Conversation

@RossBrunton
Copy link
Contributor

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.

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.
@RossBrunton RossBrunton marked this pull request as ready for review June 27, 2025 10:44
@llvmbot
Copy link
Member

llvmbot commented Jun 27, 2025

@llvm/pr-subscribers-offload

Author: Ross Brunton (RossBrunton)

Changes

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.


Full diff: https://github.com/llvm/llvm-project/pull/146049.diff

1 Files Affected:

  • (modified) offload/plugins-nextgen/cuda/src/rtl.cpp (+3-1)
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);
 

@RossBrunton RossBrunton merged commit 102cf1b into llvm:main Jun 27, 2025
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants