From dc67548d9aed486bbe464acd469a93cfc0fe8816 Mon Sep 17 00:00:00 2001 From: Stanley Tsang Date: Tue, 18 Aug 2026 15:51:37 -0600 Subject: [PATCH] (fix) rocthrust: Do not build rocRAND benchmarks when building rocThrust benchmarks (#10956) An oversight from the inclusion of the rocRAND dependency into rocThrust is that they both share common CMake options. When building rocThrust benchmarks, `BUILD_BENCHMARK=ON` must be set. This same CMake option is present in rocRAND. Thus, anytime rocThrust must download/clone rocRAND as a dependency and builds benchmarks, it also causes the local copy of rocRAND to build its benchmarks as well. This, in combination with the recent 5.0.0 version bump of rocRAND in rocThrust's dependencies, triggered a primbench.hpp not found error. FetchContent runs in-process, so rocthrust's BUILD_BENCHMARK=ON leaks into rocrand and causes its benchmarks to build. I've suppressed that in rocThrust via an explicit `set(BUILD_BENCHMARK OFF)` immediatley before `FetchContent_Declare(rocrand)`. Then turn BUILD_BENCHMARK=ON immediately after so that rocThrust's benchmarks build. Ran the rocThrust benchmark build locally. it no longer build the rocRAND benchmark. The rocthrust benchmark build works. - [ ] Look over the contributing guidelines at https://github.com/ROCm/ROCm/blob/develop/CONTRIBUTING.md#pull-requests. JIRA ID: ROCM-29174 --- projects/rocthrust/cmake/Dependencies.cmake | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/projects/rocthrust/cmake/Dependencies.cmake b/projects/rocthrust/cmake/Dependencies.cmake index 6044443c641c..0425fe160b10 100644 --- a/projects/rocthrust/cmake/Dependencies.cmake +++ b/projects/rocthrust/cmake/Dependencies.cmake @@ -443,6 +443,10 @@ if(BUILD_BENCHMARK) if(CMAKE_CXX_COMPILER_LAUNCHER) set(EXTRA_CMAKE_ARGS "${EXTRA_CMAKE_ARGS} -DCMAKE_CXX_COMPILER_LAUNCHER=${CMAKE_CXX_COMPILER_LAUNCHER}") endif() + + # FetchContent runs in-process, so rocthrust's BUILD_BENCHMARK=ON leaks into + # rocrand and causes its benchmarks to build. Suppress that here. + set(BUILD_BENCHMARK OFF) FetchContent_Declare( rocrand @@ -454,6 +458,7 @@ if(BUILD_BENCHMARK) LOG_INSTALL TRUE ) FetchContent_MakeAvailable(rocrand) + set(BUILD_BENCHMARK ON) if(NOT TARGET roc::rocrand) add_library(roc::rocrand ALIAS rocrand) endif()