Skip to content

Commit

Permalink
Enable support for ROCm 6.x
Browse files Browse the repository at this point in the history
- Handle deprecated HIP memoryType
- Use hip::device in place of explicit HIP_PATH
- Update testing frameworks to support clang 18.0 used by ROCm 6.x
  - Bump cmocka version from 1.1.0 (2016) to 1.1.7 (2023)
  - Bump gtest version from 1.10.0 (2019) to 1.15.2 (2024)
    - Require cmake 3.13
  • Loading branch information
lindstro committed Oct 23, 2024
1 parent fddb5df commit 1323689
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 11 deletions.
7 changes: 2 additions & 5 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,8 @@ if(ZFP_WITH_CUDA)
endif()

if(ZFP_WITH_HIP)
set(HIP_HIPRT_LIBRARY "${HIP_PATH}/../lib/libamdhip64.so")
target_link_libraries(zfp PRIVATE ${HIP_HIPRT_LIBRARY} stdc++)
# For debugging: if use HIP on NVIDIA systems
#find_package(CUDA)
#target_link_libraries(zfp PRIVATE ${CUDA_CUDART_LIBRARY} stdc++)
find_package(hip REQUIRED)
target_link_libraries(zfp PRIVATE hip::device)
endif()

target_compile_definitions(zfp
Expand Down
7 changes: 6 additions & 1 deletion src/share/device.h
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,13 @@
{
bool status = false;
hipPointerAttribute_t atts;
if (hipPointerGetAttributes(&atts, ptr) == hipSuccess)
if (hipPointerGetAttributes(&atts, ptr) == hipSuccess) {
#if HIP_VERSION_MAJOR >= 6
status = (atts.type == hipMemoryTypeDevice);
#else
status = (atts.memoryType == hipMemoryTypeDevice);
#endif
}
// clear last error so other error checking does not pick it up
(void)hipGetLastError();
return status;
Expand Down
6 changes: 3 additions & 3 deletions tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@ if(MINGW)
list(APPEND GTEST_ARGS "-DCMAKE_SH=CMAKE_SH-NOTFOUND")
endif()

# clone cmocka 1.1.0 into /build
list(APPEND CMOCKA_ARGS "-DWITH_STATIC_LIB=ON;-DCMAKE_C_COMPILER=${CMAKE_C_COMPILER};-DUNIT_TESTING=OFF")
# clone cmocka 1.1.7 into /build
list(APPEND CMOCKA_ARGS "-DBUILD_SHARED_LIBS=OFF;-DCMAKE_C_COMPILER=${CMAKE_C_COMPILER};-DUNIT_TESTING=OFF")

include(ExternalProject)
ExternalProject_Add(
cmocka_cloned
GIT_REPOSITORY https://gitlab.com/cmocka/cmocka.git
GIT_TAG cmocka-1.1.0
GIT_TAG cmocka-1.1.7
SOURCE_DIR "${CMAKE_BINARY_DIR}/cmocka-src"
BINARY_DIR "${CMAKE_BINARY_DIR}/cmocka-build"
CMAKE_ARGS "${CMOCKA_ARGS}"
Expand Down
4 changes: 2 additions & 2 deletions tests/CMakeLists.txt.in
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
cmake_minimum_required(VERSION 2.8.7)
cmake_minimum_required(VERSION 3.13)

project(googletest-download NONE)

include(ExternalProject)
ExternalProject_Add(
googletest
GIT_REPOSITORY https://github.com/google/googletest.git
GIT_TAG 703bd9caab50b139428cea1aaff9974ebee5742e
GIT_TAG v1.15.2
SOURCE_DIR "${ZFP_BINARY_DIR}/tests/googletest-src"
BINARY_DIR "${ZFP_BINARY_DIR}/tests/googletest-build"
CONFIGURE_COMMAND ""
Expand Down

0 comments on commit 1323689

Please sign in to comment.