Skip to content

Commit ecacf90

Browse files
committed
Merge branch 'amd-staging' into amd-master-next
Promote till commit '7c5afff964beb6dd13ad4d7e261f5c89a44a3acc' Change-Id: Iad7c19905721ab58b838011bdee21e5a7619b233
2 parents b96194b + 7c5afff commit ecacf90

File tree

187 files changed

+6043
-62538
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

187 files changed

+6043
-62538
lines changed

.gitattributes

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# Set the default behavior, in case people don't have core.autolf set.
2+
* text=auto
3+
4+
# Explicitly declare text files you want to always be normalized and converted
5+
# to have LF line endings on checkout.
6+
*.c text eol=lf
7+
*.cpp text eol=lf
8+
*.cc text eol=lf
9+
*.h text eol=lf
10+
*.hpp text eol=lf
11+
*.txt text eol=lf
12+
13+
# auto remove white space
14+
*.cpp filter=trimspace
15+
*.c filter=trimspace
16+
*.h filter=trimspacecpp
17+
*.hpp filter=trimspace
18+
*.md filter=trimspace
19+

CMakeLists.txt

Lines changed: 35 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,6 @@ project(hip)
3333
# cmake -DBUILD_SHARED_LIBS=OFF -DCMAKE_BUILD_TYPE=Debug -DCMAKE_PREFIX_PATH="$ROCclr_DIR/build;/opt/rocm/" -DCMAKE_INSTALL_PREFIX=</where/to/install/hip> ..
3434
# If you don't specify CMAKE_INSTALL_PREFIX, hip-rocclr runtime will be installed to "/opt/rocm/hip".
3535

36-
set(BUILD_SHARED_LIBS ON CACHE BOOL "Build shared library (.so) or static lib (.a) ")
37-
3836
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
3937

4038
#############################
@@ -50,6 +48,12 @@ else()
5048
set(_pchStatus 0)
5149
endif()
5250

51+
# With HIP project split plan, for interim puropose it is REQUIRED to pass
52+
# HIP_AMD_BACKEND_SOURCE_DIR=<hipamd source dir> as cmake variable_
53+
if(NOT DEFINED HIP_AMD_BACKEND_SOURCE_DIR)
54+
message(FATAL_ERROR "HIP_AMD_BACKEND_SOURCE_DIR not defined ")
55+
endif()
56+
5357
#############################
5458
# Setup config generation
5559
#############################
@@ -63,6 +67,8 @@ endmacro()
6367
#############################
6468
# Setup version information
6569
#############################
70+
# hipconfig is a perl script and is not trivially invokable on Windows.
71+
if(NOT WIN32)
6672
# Determine HIP_BASE_VERSION
6773
set(ENV{HIP_PATH} "")
6874
execute_process(COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/bin/hipconfig --version
@@ -72,11 +78,13 @@ string(REPLACE "." ";" VERSION_LIST ${HIP_BASE_VERSION})
7278
list(GET VERSION_LIST 0 HIP_VERSION_MAJOR)
7379
list(GET VERSION_LIST 1 HIP_VERSION_MINOR)
7480
set(HIP_VERSION_GITDATE 0)
81+
endif()
7582

7683
find_package(Git)
7784

7885
# FIXME: Two different version strings used.
79-
if(GIT_FOUND)
86+
# Below we use UNIX commands, not compatible with Windows.
87+
if(GIT_FOUND AND (NOT WIN32))
8088
# get date information based on UTC
8189
# use the last two digits of year + week number + day in the week as HIP_VERSION_GITDATE
8290
# use the commit date, instead of build date
@@ -210,25 +218,6 @@ message(STATUS "HIP Compiler: " ${HIP_COMPILER})
210218
add_to_config(_buildInfo HIP_RUNTIME)
211219
add_to_config(_buildInfo HIP_COMPILER)
212220

213-
############ If HIP_PLATFORM is amd, HSA_PATH has to be defined ##################
214-
215-
if(HIP_PLATFORM STREQUAL "amd")
216-
# Determine HSA_PATH
217-
if(NOT DEFINED HSA_PATH)
218-
if(NOT DEFINED ENV{HSA_PATH})
219-
set(HSA_PATH "/opt/rocm/hsa" CACHE PATH "Path to which HSA runtime has been installed")
220-
else()
221-
set(HSA_PATH $ENV{HSA_PATH} CACHE PATH "Path to which HSA runtime has been installed")
222-
endif()
223-
endif()
224-
if(IS_ABSOLUTE ${HSA_PATH} AND EXISTS ${HSA_PATH} AND IS_DIRECTORY ${HSA_PATH})
225-
message(STATUS "Looking for HSA runtime in: " ${HSA_PATH})
226-
else()
227-
message(FATAL_ERROR "Don't know where to find HSA runtime. Please specify absolute path using -DHSA_PATH")
228-
endif()
229-
endif()
230-
message(STATUS "HSA runtime in: " ${HSA_PATH})
231-
232221
# Set default build type
233222
if(NOT CMAKE_BUILD_TYPE)
234223
set(CMAKE_BUILD_TYPE "Release")
@@ -280,6 +269,13 @@ if (BUILD_HIPIFY_CLANG)
280269
add_subdirectory(hipify-clang)
281270
endif()
282271

272+
# Workaround for current versioning logic not being compatible with Windows
273+
if(WIN32)
274+
set(HIP_VERSION_MAJOR 0)
275+
set(HIP_VERSION_MINOR 0)
276+
set(HIP_VERSION_GITDATE 0)
277+
endif()
278+
283279
# Generate hip_version.h
284280
set(_versionInfoHeader
285281
"// Auto-generated by cmake\n
@@ -295,11 +291,8 @@ set(_versionInfoHeader
295291
file(WRITE "${PROJECT_BINARY_DIR}/include/hip/hip_version.h" ${_versionInfoHeader})
296292

297293
if(HIP_RUNTIME STREQUAL "rocclr")
298-
add_subdirectory(rocclr)
299-
300-
set(HIP_ROCclr_BUILD_FLAGS "${HIP_ROCclr_BUILD_FLAGS} -fPIC ${ROCclr_CXX_FLAGS} -I${HSA_PATH}/include")
301-
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${HIP_ROCclr_BUILD_FLAGS}")
302-
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${HIP_ROCclr_BUILD_FLAGS}")
294+
set(HIP_COMMON_DIR ${PROJECT_SOURCE_DIR})
295+
add_subdirectory(${HIP_AMD_BACKEND_SOURCE_DIR} src/hipamd)
303296
endif()
304297

305298
# Generate .hipInfo
@@ -329,16 +322,20 @@ install(FILES ${PROJECT_BINARY_DIR}/.hipVersion DESTINATION bin)
329322
execute_process(COMMAND test ${CMAKE_INSTALL_PREFIX} -ef ${CMAKE_CURRENT_SOURCE_DIR}
330323
RESULT_VARIABLE INSTALL_SOURCE)
331324
if(NOT ${INSTALL_SOURCE} EQUAL 0)
332-
if(HIP_RUNTIME STREQUAL "rocclr")
333-
install(DIRECTORY rocclr DESTINATION .)
325+
# Exclude .bat files on Linux.
326+
if(WIN32)
327+
install(DIRECTORY bin DESTINATION . USE_SOURCE_PERMISSIONS)
328+
else()
329+
install(DIRECTORY bin DESTINATION . USE_SOURCE_PERMISSIONS
330+
PATTERN *.bat EXCLUDE)
334331
endif()
335-
install(DIRECTORY bin DESTINATION . USE_SOURCE_PERMISSIONS)
336332

337333
# The following two lines will be removed after upstream updation
338334
install(CODE "MESSAGE(\"Removing ${CMAKE_INSTALL_PREFIX}/include\")")
339335
install(CODE "file(REMOVE_RECURSE ${CMAKE_INSTALL_PREFIX}/include)")
340336

341337
install(DIRECTORY include DESTINATION .)
338+
install(DIRECTORY ${HIP_AMD_BACKEND_SOURCE_DIR}/include/hip/ DESTINATION include/hip/)
342339
install(DIRECTORY cmake DESTINATION .)
343340
endif()
344341

@@ -354,6 +351,8 @@ install(FILES ${PROJECT_BINARY_DIR}/include/hip/hip_version.h
354351
#############################
355352
# hip-config
356353
#############################
354+
# Packaging invokes UNIX commands, which are not available on Windows.
355+
if(NOT WIN32)
357356
include(CMakePackageConfigHelpers)
358357

359358
configure_package_config_file(
@@ -460,6 +459,7 @@ endif()
460459
if(POLICY CMP0037)
461460
cmake_policy(POP)
462461
endif()
462+
endif()
463463

464464
#############################
465465
# Code analysis
@@ -485,16 +485,20 @@ endif()
485485
#############################
486486
# Testing steps
487487
#############################
488+
# HIT is not compatible with Windows
489+
if(NOT WIN32)
488490
set(HIP_ROOT_DIR ${CMAKE_CURRENT_BINARY_DIR})
489491
set(HIP_SRC_PATH ${CMAKE_CURRENT_SOURCE_DIR})
490492
if(HIP_PLATFORM STREQUAL "nvidia")
491493
execute_process(COMMAND "${CMAKE_COMMAND}" -E copy_directory "${HIP_SRC_PATH}/include" "${HIP_ROOT_DIR}/include" RESULT_VARIABLE RUN_HIT ERROR_QUIET)
492494
endif()
495+
execute_process(COMMAND "${CMAKE_COMMAND}" -E copy_directory "${HIP_AMD_BACKEND_SOURCE_DIR}/include/hip/" "${HIP_ROOT_DIR}/include/hip/" RESULT_VARIABLE RUN_HIT ERROR_QUIET)
493496
execute_process(COMMAND "${CMAKE_COMMAND}" -E copy_directory "${HIP_SRC_PATH}/cmake" "${HIP_ROOT_DIR}/cmake" RESULT_VARIABLE RUN_HIT ERROR_QUIET)
494497
if(${RUN_HIT} EQUAL 0)
495498
execute_process(COMMAND "${CMAKE_COMMAND}" -E copy_directory "${HIP_SRC_PATH}/bin" "${HIP_ROOT_DIR}/bin" RESULT_VARIABLE RUN_HIT ERROR_QUIET)
496499
endif()
497500
if(HIP_CATCH_TEST EQUAL "1")
501+
enable_testing()
498502
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/tests/catch)
499503
else()
500504
if(${RUN_HIT} EQUAL 0)
@@ -505,6 +509,7 @@ else()
505509
message(STATUS "Testing targets will not be available. To enable them please ensure that the HIP installation directory is writeable. Use -DCMAKE_INSTALL_PREFIX to specify a suitable location")
506510
endif()
507511
endif()
512+
endif()
508513

509514
#############################
510515
# Code analysis

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,20 +29,20 @@ The HIP repository maintains several branches. The branches that are of importan
2929

3030
HIP releases are typically naming convention for each ROCM release to help differentiate them.
3131

32-
* rocm x.yy: These are the stable releases based on the ROCM release.
32+
* rocm x.yy: These are the stable releases based on the ROCM release.
3333
This type of release is typically made once a month.*
3434

3535
## More Info:
3636
- [Installation](INSTALL.md)
3737
- [HIP FAQ](docs/markdown/hip_faq.md)
3838
- [HIP Kernel Language](docs/markdown/hip_kernel_language.md)
39-
- [HIP Runtime API (Doxygen)](http://rocm-developer-tools.github.io/HIP)
39+
- [HIP Runtime API (Doxygen)](https://github.com/RadeonOpenCompute/ROCm)
4040
- [HIP Porting Guide](docs/markdown/hip_porting_guide.md)
4141
- [HIP Porting Driver Guide](docs/markdown/hip_porting_driver_api.md)
4242
- [HIP Programming Guide](docs/markdown/hip_programming_guide.md)
4343
- [HIP Logging ](docs/markdown/hip_logging.md)
4444
- [HIP Debugging ](docs/markdown/hip_debugging.md)
45-
- [Code Object tooling ] (docs/markdown/obj_tooling.md)
45+
- [Code Object tooling ](docs/markdown/obj_tooling.md)
4646
- [HIP Terminology](docs/markdown/hip_terms2.md) (including Rosetta Stone of GPU computing terms across CUDA/HIP/OpenCL)
4747
- [HIPIFY](https://github.com/ROCm-Developer-Tools/HIPIFY/blob/master/README.md)
4848
- Supported CUDA APIs:

0 commit comments

Comments
 (0)