From ddcdfa839c0750896e6b4cba33dbb586eae03c25 Mon Sep 17 00:00:00 2001 From: Chris Kitching Date: Wed, 18 Oct 2017 08:16:26 +0100 Subject: [PATCH] Propagate the CUDA toolkit directory into the lit tests Allows the tests to actually run... :D [ROCm/hip commit: efa814e38108742d0e55a0a7d46d02ee5bddc0c6] --- projects/hip/hipify-clang/CMakeLists.txt | 5 ++++- projects/hip/tests/hipify-clang/axpy.cu | 2 +- projects/hip/tests/hipify-clang/lit.cfg | 2 ++ projects/hip/tests/hipify-clang/lit.site.cfg.in | 1 + 4 files changed, 8 insertions(+), 2 deletions(-) diff --git a/projects/hip/hipify-clang/CMakeLists.txt b/projects/hip/hipify-clang/CMakeLists.txt index d309aa261c..18939c0210 100644 --- a/projects/hip/hipify-clang/CMakeLists.txt +++ b/projects/hip/hipify-clang/CMakeLists.txt @@ -70,9 +70,12 @@ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DHIPIFY_CLANG_RES=\\\"${LLVM_LIBRARY_DI install(TARGETS hipify-clang DESTINATION bin) if (HIPIFY_CLANG_TESTS) - # tests find_package(PythonInterp 2.7 REQUIRED EXACT) + # Populates CUDA_TOOLKIT_ROOT_DIR, which is then applied to the lit config to give the + # value of --cuda-path for the test runs. + find_package(CUDA REQUIRED) + set(BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}) configure_file( diff --git a/projects/hip/tests/hipify-clang/axpy.cu b/projects/hip/tests/hipify-clang/axpy.cu index 8472e60209..56a854fd0a 100644 --- a/projects/hip/tests/hipify-clang/axpy.cu +++ b/projects/hip/tests/hipify-clang/axpy.cu @@ -1,4 +1,4 @@ -// RUN: hipify "%s" -o=%t -- +// RUN: hipify "%s" -o=%t -- %cuda_args #include diff --git a/projects/hip/tests/hipify-clang/lit.cfg b/projects/hip/tests/hipify-clang/lit.cfg index c57b8ec524..57d9d876b5 100644 --- a/projects/hip/tests/hipify-clang/lit.cfg +++ b/projects/hip/tests/hipify-clang/lit.cfg @@ -46,3 +46,5 @@ if obj_root is not None: config.substitutions.append(("hipify", obj_root+"/hipify-clang")) +# Clang args for CUDA... +config.substitutions.append(("%cuda_args", "-x cuda --cuda-path=%s --cuda-gpu-arch=sm_30" % config.cuda_root)) diff --git a/projects/hip/tests/hipify-clang/lit.site.cfg.in b/projects/hip/tests/hipify-clang/lit.site.cfg.in index 4511316ac7..4e05710065 100644 --- a/projects/hip/tests/hipify-clang/lit.site.cfg.in +++ b/projects/hip/tests/hipify-clang/lit.site.cfg.in @@ -2,6 +2,7 @@ import sys config.llvm_tools_dir = "@LLVM_TOOLS_BINARY_DIR@" config.obj_root = "@BINARY_DIR@" +config.cuda_root = "@CUDA_TOOLKIT_ROOT_DIR@" # Support substitution of the tools and libs dirs with user parameters. This is # used when we can't determine the tool dir at configuration time.