Skip to content

Commit a1795d8

Browse files
committed
remove the macro dispatch eariler than rocm 6.2
1 parent 28dbcbe commit a1795d8

19 files changed

Lines changed: 19 additions & 152 deletions

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,7 @@ if(GINKGO_BUILD_HIP)
231231
# HIP VERSION does not use the exact version number as ROCm. Need to wait for ROCm 7.1.1 to set proper range for ROCm 7.1.0
232232
message(
233233
STATUS
234-
"Disable custom thrust namespace for hip 7.1 because hip does not adapt the custom namespace fully."
234+
"Disable custom thrust namespace after hip 7.1 because hip does not adapt the custom namespace fully."
235235
)
236236
set(GINKGO_HIP_CUSTOM_THRUST_NAMESPACE OFF)
237237
else()

hip/base/exception.hip.cpp

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,14 @@
1-
// SPDX-FileCopyrightText: 2017 - 2024 The Ginkgo authors
1+
// SPDX-FileCopyrightText: 2017 - 2026 The Ginkgo authors
22
//
33
// SPDX-License-Identifier: BSD-3-Clause
44

55
#include "ginkgo/core/base/exception.hpp"
66

77
#include <string>
88

9-
10-
#if HIP_VERSION >= 50200000
119
#include <hipblas/hipblas.h>
1210
#include <hiprand/hiprand.h>
1311
#include <hipsparse/hipsparse.h>
14-
#else
15-
#include <hipblas.h>
16-
#include <hiprand.h>
17-
#include <hipsparse.h>
18-
#endif
19-
2012

2113
#include <ginkgo/core/base/types.hpp>
2214

@@ -97,10 +89,8 @@ std::string HipsparseError::get_error(int64 error_code)
9789
GKO_REGISTER_HIPSPARSE_ERROR(HIPSPARSE_STATUS_INTERNAL_ERROR);
9890
GKO_REGISTER_HIPSPARSE_ERROR(HIPSPARSE_STATUS_MATRIX_TYPE_NOT_SUPPORTED);
9991
GKO_REGISTER_HIPSPARSE_ERROR(HIPSPARSE_STATUS_ZERO_PIVOT);
100-
#if HIP_VERSION >= 50200000
10192
GKO_REGISTER_HIPSPARSE_ERROR(HIPSPARSE_STATUS_NOT_SUPPORTED);
10293
GKO_REGISTER_HIPSPARSE_ERROR(HIPSPARSE_STATUS_INSUFFICIENT_RESOURCES);
103-
#endif
10494
return "Unknown error";
10595

10696
#undef GKO_REGISTER_HIPSPARSE_ERROR

hip/base/hipblas_bindings.hip.hpp

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,12 @@
1-
// SPDX-FileCopyrightText: 2017 - 2025 The Ginkgo authors
1+
// SPDX-FileCopyrightText: 2017 - 2026 The Ginkgo authors
22
//
33
// SPDX-License-Identifier: BSD-3-Clause
44

55
#ifndef GKO_HIP_BASE_HIPBLAS_BINDINGS_HIP_HPP_
66
#define GKO_HIP_BASE_HIPBLAS_BINDINGS_HIP_HPP_
77

88

9-
#if HIP_VERSION >= 50200000
109
#include <hipblas/hipblas.h>
11-
#else
12-
#include <hipblas.h>
13-
#endif
14-
1510

1611
#include <ginkgo/core/base/exception_helpers.hpp>
1712
#include <ginkgo/core/base/executor.hpp>

hip/base/hipblas_handle.hpp

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,12 @@
1-
// SPDX-FileCopyrightText: 2017 - 2024 The Ginkgo authors
1+
// SPDX-FileCopyrightText: 2017 - 2026 The Ginkgo authors
22
//
33
// SPDX-License-Identifier: BSD-3-Clause
44

55
#ifndef GKO_HIP_BASE_HIPBLAS_HANDLE_HPP_
66
#define GKO_HIP_BASE_HIPBLAS_HANDLE_HPP_
77

88

9-
#if HIP_VERSION >= 50200000
109
#include <hipblas/hipblas.h>
11-
#else
12-
#include <hipblas.h>
13-
#endif
1410

1511
#include <ginkgo/core/base/exception_helpers.hpp>
1612

hip/base/hiprand_bindings.hip.hpp

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,12 @@
1-
// SPDX-FileCopyrightText: 2017 - 2024 The Ginkgo authors
1+
// SPDX-FileCopyrightText: 2017 - 2026 The Ginkgo authors
22
//
33
// SPDX-License-Identifier: BSD-3-Clause
44

55
#ifndef GKO_HIP_BASE_HIPRAND_BINDINGS_HIP_HPP_
66
#define GKO_HIP_BASE_HIPRAND_BINDINGS_HIP_HPP_
77

88

9-
#if HIP_VERSION >= 50200000
109
#include <hiprand/hiprand.h>
11-
#else
12-
#include <hiprand.h>
13-
#endif
14-
1510

1611
#include <ginkgo/core/base/exception_helpers.hpp>
1712

hip/base/hipsparse_bindings.hip.hpp

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,12 @@
1-
// SPDX-FileCopyrightText: 2017 - 2024 The Ginkgo authors
1+
// SPDX-FileCopyrightText: 2017 - 2026 The Ginkgo authors
22
//
33
// SPDX-License-Identifier: BSD-3-Clause
44

55
#ifndef GKO_HIP_BASE_HIPSPARSE_BINDINGS_HIP_HPP_
66
#define GKO_HIP_BASE_HIPSPARSE_BINDINGS_HIP_HPP_
77

88

9-
#if HIP_VERSION >= 50200000
109
#include <hipsparse/hipsparse.h>
11-
#else
12-
#include <hipsparse.h>
13-
#endif
14-
1510

1611
#include <ginkgo/core/base/exception_helpers.hpp>
1712
#include <ginkgo/core/base/executor.hpp>

hip/base/hipsparse_block_bindings.hip.hpp

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,12 @@
1-
// SPDX-FileCopyrightText: 2017 - 2024 The Ginkgo authors
1+
// SPDX-FileCopyrightText: 2017 - 2026 The Ginkgo authors
22
//
33
// SPDX-License-Identifier: BSD-3-Clause
44

55
#ifndef GKO_HIP_BASE_HIPSPARSE_BLOCK_BINDINGS_HIP_HPP_
66
#define GKO_HIP_BASE_HIPSPARSE_BLOCK_BINDINGS_HIP_HPP_
77

88

9-
#if HIP_VERSION >= 50200000
109
#include <hipsparse/hipsparse.h>
11-
#else
12-
#include <hipsparse.h>
13-
#endif
14-
1510

1611
#include <ginkgo/core/base/exception_helpers.hpp>
1712

hip/base/hipsparse_handle.hpp

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,12 @@
1-
// SPDX-FileCopyrightText: 2017 - 2024 The Ginkgo authors
1+
// SPDX-FileCopyrightText: 2017 - 2026 The Ginkgo authors
22
//
33
// SPDX-License-Identifier: BSD-3-Clause
44

55
#ifndef GKO_HIP_BASE_HIPSPARSE_HANDLE_HPP_
66
#define GKO_HIP_BASE_HIPSPARSE_HANDLE_HPP_
77

88

9-
#if HIP_VERSION >= 50200000
109
#include <hipsparse/hipsparse.h>
11-
#else
12-
#include <hipsparse.h>
13-
#endif
1410

1511
#include <ginkgo/core/base/exception_helpers.hpp>
1612

hip/base/memory.hip.cpp

Lines changed: 1 addition & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// SPDX-FileCopyrightText: 2017 - 2025 The Ginkgo authors
1+
// SPDX-FileCopyrightText: 2017 - 2026 The Ginkgo authors
22
//
33
// SPDX-License-Identifier: BSD-3-Clause
44

@@ -65,9 +65,6 @@ void HipAllocator::deallocate(void* dev_ptr)
6565
}
6666

6767

68-
#if HIP_VERSION >= 50200000
69-
70-
7168
HipAsyncAllocator::HipAsyncAllocator(hipStream_t stream) : stream_{stream} {}
7269

7370

@@ -86,35 +83,6 @@ void HipAsyncAllocator::deallocate(void* ptr)
8683
}
8784

8885

89-
#else // Fall back to regular allocation
90-
91-
92-
HipAsyncAllocator::HipAsyncAllocator(hipStream_t stream) : stream_{stream}
93-
{
94-
#if GKO_VERBOSE_LEVEL >= 1
95-
std::cerr << "This version of HIP does not support hipMallocAsync, "
96-
"please use HipAllocator instead of HipAsyncAllocator.\n";
97-
#endif
98-
}
99-
100-
101-
void* HipAsyncAllocator::allocate(size_type num_bytes)
102-
{
103-
void* ptr{};
104-
GKO_ASSERT_NO_HIP_ALLOCATION_ERRORS(hipMalloc(&ptr, num_bytes), num_bytes);
105-
return ptr;
106-
}
107-
108-
109-
void HipAsyncAllocator::deallocate(void* ptr)
110-
{
111-
GKO_EXIT_ON_HIP_ERROR(hipFree(ptr));
112-
}
113-
114-
115-
#endif
116-
117-
11886
bool HipAsyncAllocator::check_environment(int device_id,
11987
hipStream_t stream) const
12088
{

hip/base/pointer_mode_guard.hip.hpp

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// SPDX-FileCopyrightText: 2017 - 2024 The Ginkgo authors
1+
// SPDX-FileCopyrightText: 2017 - 2026 The Ginkgo authors
22
//
33
// SPDX-License-Identifier: BSD-3-Clause
44

@@ -8,15 +8,8 @@
88

99
#include <exception>
1010

11-
12-
#if HIP_VERSION >= 50200000
1311
#include <hipblas/hipblas.h>
1412
#include <hipsparse/hipsparse.h>
15-
#else
16-
#include <hipblas.h>
17-
#include <hipsparse.h>
18-
#endif
19-
2013

2114
#include <ginkgo/core/base/exception_helpers.hpp>
2215
#include <ginkgo/core/base/executor.hpp>

0 commit comments

Comments
 (0)