Skip to content

Commit

Permalink
5.5 cherry pick (#274)
Browse files Browse the repository at this point in the history
* HIP SDK compatibility (#266)

* HIP SDK compatibility

* Update cmake_path function for rmake.py

* Updating copyright year

* Fix toolchain-windows.cmake for HIP SDK (#270)

* HIP SDK compatibility

* Update cmake_path function for rmake.py

* Updating copyright year

* Update toolchain-windows.cmake for HIP SDK support

* Take python3 by default

* Update changelog for 5.5 cherry pick
  • Loading branch information
stanleytsang-amd authored Mar 6, 2023
1 parent 8019cce commit 92ce6aa
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 23 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ Full documentation for rocThrust is available at [https://rocthrust.readthedocs.
- Updated to match upstream Thrust 1.17.2
### Fixed
- set_difference and set_intersection no longer hang if the number of items is above `UINT_MAX`. Previously, the unit tests for set_difference and set_intersection failed the `TestSetDifferenceWithBigIndexes`.
- Windows HIP SDK support

## rocThrust 2.16.0 for ROCm 5.3
### Added
Expand Down
11 changes: 9 additions & 2 deletions rmake.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/usr/bin/python3
"""Copyright 2020-2021 Advanced Micro Devices, Inc.
"""Copyright 2020-2023 Advanced Micro Devices, Inc.
Manage build and installation"""

import re
Expand Down Expand Up @@ -72,6 +72,12 @@ def delete_dir(dir_path) :
linux_path = pathlib.Path(dir_path).absolute()
#print( linux_path )
run_cmd( "rm" , f"-rf {linux_path}")

def cmake_path(os_path):
if OS_info["ID"] == "windows":
return os_path.replace("\\", "/")
else:
return os.path.realpath(os_path)

def config_cmd():
global args
Expand All @@ -85,7 +91,8 @@ def config_cmd():
cmake_platform_opts = []
if (OS_info["ID"] == 'windows'):
# we don't have ROCM on windows but have hip, ROCM can be downloaded if required
rocm_path = os.getenv( 'ROCM_PATH', "C:/hipsdk/rocm-cmake-master") #C:/hip") # rocm/Utils/cmake-rocm4.2.0"
raw_rocm_path = cmake_path(os.getenv('HIP_PATH', "C:/hip"))
rocm_path = f'"{raw_rocm_path}"' # guard against spaces in path
cmake_executable = "cmake.exe"
toolchain = os.path.join( src_path, "toolchain-windows.cmake" )
#set CPACK_PACKAGING_INSTALL_PREFIX= defined as blank as it is appended to end of path for archive creation
Expand Down
31 changes: 10 additions & 21 deletions toolchain-windows.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -3,47 +3,36 @@
# Ninja doesn't support platform
#set(CMAKE_GENERATOR_PLATFORM x64)

if (DEFINED ENV{HIP_DIR})
if (DEFINED ENV{HIP_PATH})
file(TO_CMAKE_PATH "$ENV{HIP_PATH}" HIP_DIR)
set(rocm_bin "${HIP_DIR}/bin")
elseif (DEFINED ENV{HIP_DIR})
file(TO_CMAKE_PATH "$ENV{HIP_DIR}" HIP_DIR)
set(rocm_bin "${HIP_DIR}/bin")
else()
set(HIP_DIR "C:/hip")
set(rocm_bin "C:/hip/bin")
endif()

#set(CMAKE_CXX_COMPILER "${rocm_bin}/hipcc.bat")
#set(CMAKE_C_COMPILER "${rocm_bin}/hipcc.bat")
set(CMAKE_CXX_COMPILER "${rocm_bin}/clang++.exe")
set(CMAKE_C_COMPILER "${rocm_bin}/clang.exe")

#set(CMAKE_CXX_LINKER "${rocm_bin}/hipcc.bat" )

# TODO remove, just to speed up slow cmake
set(CMAKE_C_COMPILER_WORKS 1)
set(CMAKE_CXX_COMPILER_WORKS 1)
#
if (NOT python)
set(python "python3") # take default for windows
endif()

#set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -IC:/hip/include -IC:/hip/lib/clang/12.0.0 -DWIN32 -D_CRT_SECURE_NO_WARNINGS")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -I${HIP_DIR}/include -DWIN32 -D_CRT_SECURE_NO_WARNINGS")
# our usage flags
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DWIN32 -D_CRT_SECURE_NO_WARNINGS")

# flags for clang direct use
#set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14 -fms-extensions -fms-compatibility")
# -Wno-ignored-attributes to avoid warning: __declspec attribute 'dllexport' is not supported [-Wignored-attributes] which is used by msvc compiler
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14 -fms-extensions -fms-compatibility -Wno-ignored-attributes")

# flags for clang direct use with hip
# -x hip causes linker error
#set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -x hip -IC:/hip/include/hip -D__HIP_PLATFORM_HCC__ -D__HIP_ROCclr__ -DHIP_CLANG_HCC_COMPAT_MODE=1")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -I${HIP_DIR}/include/hip -D__HIP_PLATFORM_HCC__ -D__HIP_ROCclr__ -DHIP_CLANG_HCC_COMPAT_MODE=1")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D__HIP_PLATFORM_AMD__ -D__HIP_ROCclr__ -DHIP_CLANG_HCC_COMPAT_MODE=1")

if (DEFINED ENV{VCPKG_PATH})
file(TO_CMAKE_PATH "$ENV{VCPKG_PATH}" VCPKG_PATH)
else()
set(VCPKG_PATH "C:/github/vcpkg")
endif()
include("${VCPKG_PATH}/scripts/buildsystems/vcpkg.cmake")
# set(GTEST_DIR "C:/rocm/Utils/GTestMSVC")
# set(GTEST_INCLUDE_DIR "${GTEST_DIR}/include")
# set(GTEST_LIBRARY "${GTEST_DIR}/lib/Release/gtest.lib")
# set(GTEST_MAIN_LIBRARY "${GTEST_DIR}/lib/Release/gtest_main.lib")
# set(GTEST_LIBRARIES "${GTEST_DIR}/lib/Release/gtest.lib;${GTEST_DIR}/lib/Release/gtest_main.lib")

0 comments on commit 92ce6aa

Please sign in to comment.