Skip to content

Commit b388186

Browse files
stanleytsang-amdyungshengtuNaraendaSaiyang-Zhang
authored
Cherry-pick build fixes for rocThrust + libhipcxx for ROCm 7.1.1 (#2465)
Do not merge until PM approval given. ## Motivation We have discovered an issue with the rocThrust version that comes with ROCm 7.1. In particular, once libhipcxx is installed on a system, rocThrust will include libhipcxx headers. Unfortunately, the version of rocThrust is not aligned with the 2.7.0 libhipcxx version and seems to use CCCL includes from >=2.8.x. Hence, any include of rocThrust will fail once libhipcxx is installed on a ROCm 7.1 system. Fixing this in rocThrust should be rather easy by disabling the hip/std includes for an incompatible libhipcxx version. ## Technical Details This PR combines #2430, #1769, and #1770 ## Test Plan Running CI tests now. ## Test Result <!-- Briefly summarize test outcomes. --> ## Submission Checklist - [ ] Look over the contributing guidelines at https://github.com/ROCm/ROCm/blob/develop/CONTRIBUTING.md#pull-requests. --------- Co-authored-by: Yung-sheng Tu <[email protected]> Co-authored-by: Nara <[email protected]> Co-authored-by: Saiyang Zhang <[email protected]>
1 parent a50e146 commit b388186

30 files changed

+173
-136
lines changed

.clang-format

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -227,3 +227,8 @@ StatementMacros: [
227227
]
228228
TabWidth: 2
229229
UseTab: Never
230+
WhitespaceSensitiveMacros: [
231+
'THRUST_HAS_INCLUDE',
232+
'_THRUST_LIBCXX_INCLUDE',
233+
'_THRUST_STD_INCLUDE'
234+
]

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# Copyright 2019-2025 Advanced Micro Devices, Inc.
33
# ########################################################################
44

5-
cmake_minimum_required(VERSION 3.10.2 FATAL_ERROR)
5+
cmake_minimum_required(VERSION 3.16 FATAL_ERROR)
66

77
# --------------------------------------
88
# Update these variables at release time

cmake/DownloadProject.CMakeLists.cmake.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Distributed under the OSI-approved MIT License. See accompanying
22
# file LICENSE or https://github.com/Crascit/DownloadProject for details.
33

4-
cmake_minimum_required(VERSION 3.10.2 FATAL_ERROR)
4+
cmake_minimum_required(VERSION 3.16 FATAL_ERROR)
55

66
project(${DL_ARGS_PROJ}-download NONE)
77

extra/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# Copyright 2019-2025 Advanced Micro Devices, Inc.
33
# ########################################################################
44

5-
cmake_minimum_required(VERSION 3.10.2 FATAL_ERROR)
5+
cmake_minimum_required(VERSION 3.16 FATAL_ERROR)
66

77
# This project includes tests that should be run after
88
# rocThrust is installed from package or using `make install`

test/test_event.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ TEST(EventTests, test_event_when_all)
162162

163163
ASSERT_EQ(e0_stream, e8.stream().native_handle());
164164

165-
e8.wait();
165+
TEST_EVENT_WAIT(e8);
166166

167167
ASSERT_EQ(false, e0.ready());
168168
ASSERT_EQ(false, e1.ready());
@@ -173,8 +173,7 @@ TEST(EventTests, test_event_when_all)
173173
ASSERT_EQ(false, e6.ready());
174174
ASSERT_EQ(false, e7.ready());
175175

176-
// // FIXME: Temporarily disabled due to observed failure in AMD CI.
177-
// ASSERT_EQ(true, e8.ready());
176+
ASSERT_EQ(true, e8.ready());
178177
}
179178

180179
///////////////////////////////////////////////////////////////////////////////

testing/cmake/check_namespace.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
# manually with:
66
# cmake -D "Thrust_SOURCE_DIR=<thrust project root>" -P check_namespace.cmake
77

8-
cmake_minimum_required(VERSION 3.15)
8+
cmake_minimum_required(VERSION 3.16)
99

1010
set(exclusions
1111
# This defines the macros and must have bare namespace declarations:

testing/event.cu

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ THRUST_HOST void test_event_when_all()
154154

155155
ASSERT_EQUAL(e0_stream, e8.stream().native_handle());
156156

157-
e8.wait();
157+
TEST_EVENT_WAIT(e8);
158158

159159
ASSERT_EQUAL(false, e0.ready());
160160
ASSERT_EQUAL(false, e1.ready());

testing/unittest/util_async.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,10 @@ THRUST_HOST void test_event_wait(Event&& e, std::string const& filename = "unkno
4040
ASSERT_EQUAL_WITH_FILE_AND_LINE(true, e.valid_stream(), filename, lineno);
4141

4242
e.wait();
43-
e.wait();
43+
while (!e.ready())
44+
{
45+
e.wait();
46+
}
4447

4548
ASSERT_EQUAL_WITH_FILE_AND_LINE(true, e.valid_stream(), filename, lineno);
4649
ASSERT_EQUAL_WITH_FILE_AND_LINE(true, e.ready(), filename, lineno);

thrust/detail/alignment.h

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -33,14 +33,8 @@
3333
#include _THRUST_STD_INCLUDE(type_traits) // For `std::alignment_of`.
3434

3535
#if _THRUST_HAS_DEVICE_SYSTEM_STD
36-
# if THRUST_DEVICE_SYSTEM == THRUST_DEVICE_SYSTEM_CUDA
37-
# include <cuda/cmath>
38-
# else
39-
# include <hip/cmath>
40-
# endif
41-
#endif
42-
43-
#if !_THRUST_HAS_DEVICE_SYSTEM_STD
36+
# include _THRUST_LIBCXX_INCLUDE(cmath)
37+
#else
4438
# include <rocprim/detail/various.hpp>
4539
#endif
4640

@@ -87,11 +81,7 @@ THRUST_HOST_DEVICE T aligned_reinterpret_cast(U u)
8781
THRUST_HOST_DEVICE inline _THRUST_STD::size_t aligned_storage_size(_THRUST_STD::size_t n, _THRUST_STD::size_t align)
8882
{
8983
#if _THRUST_HAS_DEVICE_SYSTEM_STD
90-
# if THRUST_DEVICE_SYSTEM == THRUST_DEVICE_SYSTEM_CUDA
91-
return ::cuda::ceil_div(n, align) * align;
92-
# else
93-
return ::hip::ceil_div(n, align) * align;
94-
# endif
84+
return _THRUST_LIBCXX::ceil_div(n, align) * align;
9585
#else
9686
return ::rocprim::detail::ceiling_div(n, align) * align;
9787
#endif

thrust/detail/attributes.h

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
//===----------------------------------------------------------------------===//
2+
//
3+
// Part of libcu++, the C++ Standard Library for your entire system,
4+
// under the Apache License v2.0 with LLVM Exceptions.
5+
// See https://llvm.org/LICENSE.txt for license information.
6+
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7+
// SPDX-FileCopyrightText: Copyright (c) 2024 NVIDIA CORPORATION & AFFILIATES.
8+
//
9+
//===----------------------------------------------------------------------===//
10+
11+
#ifndef DETAIL_ATTRIBUTES_H
12+
#define DETAIL_ATTRIBUTES_H
13+
14+
#include <thrust/detail/config.h>
15+
#if _THRUST_HAS_DEVICE_SYSTEM_STD
16+
17+
// clang-format off
18+
# include _THRUST_STD_INCLUDE(__cccl/attributes.h)
19+
// clang-format on
20+
21+
# define THRUST_DECLSPEC_EMPTY_BASES _CCCL_DECLSPEC_EMPTY_BASES
22+
23+
#else // !_THRUST_HAS_DEVICE_SYSTEM_STD
24+
25+
# ifdef __has_declspec_attribute
26+
# define THRUST_HAS_DECLSPEC_ATTRIBUTE(__x) __has_declspec_attribute(__x)
27+
# else // ^^^ __has_declspec_attribute ^^^ / vvv !__has_declspec_attribute vvv
28+
# define THRUST_HAS_DECLSPEC_ATTRIBUTE(__x) 0
29+
# endif // !__has_declspec_attribute
30+
31+
// MSVC needs extra help with empty base classes
32+
# if THRUST_HOST_COMPILER == THRUST_HOST_COMPILER_MSVC || THRUST_HAS_DECLSPEC_ATTRIBUTE(empty_bases)
33+
# define THRUST_DECLSPEC_EMPTY_BASES __declspec(empty_bases)
34+
# else // !THRUST_HOST_COMPILER == THRUST_HOST_COMPILER_MSVC
35+
# define THRUST_DECLSPEC_EMPTY_BASES
36+
# endif // THRUST_HOST_COMPILER == THRUST_HOST_COMPILER_MSVC
37+
38+
#endif // _THRUST_HAS_DEVICE_SYSTEM_STD
39+
40+
#endif // DETAIL_ATTRIBUTES_H

0 commit comments

Comments
 (0)