[llvm] [Offload][UnitTests] Fix incorrect CUDA path variable in CMake helper (PR #151820)
Leandro Lacerda via llvm-commits
llvm-commits at lists.llvm.org
Sat Aug 2 06:52:21 PDT 2025
https://github.com/leandrolcampos created https://github.com/llvm/llvm-project/pull/151820
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.
>From 7c02f0ec27c3a2f557fa3df297016825596cbf02 Mon Sep 17 00:00:00 2001
From: Leandro Augusto Lacerda Campos <leandrolcampos at yahoo.com.br>
Date: Sat, 2 Aug 2025 10:47:34 -0300
Subject: [PATCH] Use correct CUDA path variable in device code build
---
offload/unittests/CMakeLists.txt | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
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}
)
More information about the llvm-commits
mailing list