Skip to content

[Offload][UnitTests] Fix incorrect CUDA path variable in CMake helper#151820

Merged
jhuber6 merged 1 commit into
llvm:mainfrom
leandrolcampos:FixCudaPath
Aug 2, 2025
Merged

[Offload][UnitTests] Fix incorrect CUDA path variable in CMake helper#151820
jhuber6 merged 1 commit into
llvm:mainfrom
leandrolcampos:FixCudaPath

Conversation

@leandrolcampos

Copy link
Copy Markdown
Contributor

This PR fixes a minor bug in the add_offload_test_device_code CMake helper function in offload/unittests/CMakeLists.txt.

The function was discovering the local CUDA Toolkit path and storing it in the cuda_path variable but was then using the incorrect CUDA_ROOT variable in the add_custom_command call for the NVPTX target.

This change corrects the command to use the intended cuda_path variable.

@llvmbot llvmbot added the offload label Aug 2, 2025
@llvmbot

llvmbot commented Aug 2, 2025

Copy link
Copy Markdown
Member

@llvm/pr-subscribers-offload

Author: Leandro Lacerda (leandrolcampos)

Changes

This PR fixes a minor bug in the add_offload_test_device_code CMake helper function in offload/unittests/CMakeLists.txt.

The function was discovering the local CUDA Toolkit path and storing it in the cuda_path variable but was then using the incorrect CUDA_ROOT variable in the add_custom_command call for the NVPTX target.

This change corrects the command to use the intended cuda_path variable.


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

1 Files Affected:

  • (modified) offload/unittests/CMakeLists.txt (+1-1)
diff --git a/offload/unittests/CMakeLists.txt b/offload/unittests/CMakeLists.txt
index 6d165ffd4c53a..24826a1dcb756 100644
--- a/offload/unittests/CMakeLists.txt
+++ b/offload/unittests/CMakeLists.txt
@@ -40,7 +40,7 @@ function(add_offload_test_device_code test_filename test_name)
         OUTPUT ${output_file}
         COMMAND ${CMAKE_C_COMPILER}
         --target=nvptx64-nvidia-cuda -march=${nvptx_arch}
-        -nogpulib --cuda-path=${CUDA_ROOT} -flto ${ARGN}
+        -nogpulib --cuda-path=${cuda_path} -flto ${ARGN}
         ${SRC_PATH} -o ${output_file}
         DEPENDS ${SRC_PATH}
       )

@jhuber6 jhuber6 merged commit acdc01b into llvm:main Aug 2, 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