Skip to content

Commit d48f284

Browse files
Merge pull request #62 from ROCm-Developer-Tools/develop
merge develop into mainline
2 parents e8a4f17 + d65e8f0 commit d48f284

26 files changed

+1702
-102
lines changed

amd/hipcc/.github/dependabot.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# To get started with Dependabot version updates, you'll need to specify which
2+
# package ecosystems to update and where the package manifests are located.
3+
# Please see the documentation for all configuration options:
4+
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
5+
6+
version: 2
7+
updates:
8+
- package-ecosystem: "pip" # See documentation for possible values
9+
directory: "/docs/.sphinx" # Location of package manifests
10+
open-pull-requests-limit: 10
11+
schedule:
12+
interval: "daily"

amd/hipcc/.gitignore

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# Merge files created by git.
2+
*.orig
3+
# Reject files created by patch.
4+
*.rej
5+
6+
# Nested build directory.
7+
/build*
8+
9+
# documentation artifacts
10+
build/
11+
_build/
12+
_images/
13+
_static/
14+
_templates/
15+
_toc.yml
16+
docBin/
17+
_doxygen/

amd/hipcc/.jenkins/Jenkinsfile

Lines changed: 44 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -15,24 +15,18 @@ def hipBuildTest(String backendLabel) {
1515
env.HIP_DIR = "${WORKSPACE}" + "/hip"
1616
}
1717

18-
// Clone hipamd repository
19-
dir("${WORKSPACE}/hipamd") {
18+
// Clone clr repository
19+
dir("${WORKSPACE}/clr") {
2020
git branch: 'develop',
21-
url: 'https://github.com/ROCm-Developer-Tools/hipamd'
21+
credentialsId: 'branch-credentials',
22+
url: 'https://github.com/ROCm-Developer-Tools/clr'
23+
env.CLR_DIR = "${WORKSPACE}" + "/clr"
2224
}
2325

24-
// Clone vdi and opencl for only amd backend server
25-
if (backendLabel =~ /.*amd.*/) {
26-
dir("${WORKSPACE}/ROCm-OpenCL-Runtime") {
27-
git branch:'develop',
28-
url: 'https://github.com/RadeonOpenCompute/ROCm-OpenCL-Runtime'
29-
env.OPENCL_DIR = "${WORKSPACE}" + "/ROCm-OpenCL-Runtime"
30-
}
31-
dir("${WORKSPACE}/ROCclr") {
32-
git branch:'develop',
33-
url: 'https://github.com/ROCm-Developer-Tools/ROCclr'
34-
env.ROCclr_DIR = "${WORKSPACE}" + "/ROCclr"
35-
}
26+
// Clone hip-tests repository
27+
dir("${WORKSPACE}/hip-tests") {
28+
git branch: 'develop',
29+
url: 'https://github.com/ROCm-Developer-Tools/hip-tests'
3630
}
3731
}
3832

@@ -50,43 +44,61 @@ def hipBuildTest(String backendLabel) {
5044
}
5145
}
5246

53-
stage("Build - Catch2 framework") {
54-
// Running the build on hipamd workspace
55-
dir("${WORKSPACE}/hipamd") {
47+
stage("BUILD HIP - ${backendLabel}") {
48+
// Running the build on clr workspace
49+
dir("${WORKSPACE}/clr") {
5650
sh """#!/usr/bin/env bash
5751
set -x
52+
rm -rf build
5853
mkdir -p build
5954
cd build
6055
# Check if backend label contains string "amd" or backend host is a server with amd gpu
6156
if [[ $backendLabel =~ amd ]]; then
62-
cmake -DHIP_CATCH_TEST=1 -DHIP_PATH=\$PWD/install -DHIPCC_BIN_DIR=\$HIPCC_DIR/build -DHIP_COMMON_DIR=\$HIP_DIR -DAMD_OPENCL_PATH=\$OPENCL_DIR -DROCCLR_PATH=\$ROCclr_DIR -DCMAKE_PREFIX_PATH="/opt/rocm/" -DCMAKE_INSTALL_PREFIX=\$PWD/install ..
57+
cmake -DHIPCC_BIN_DIR=\$HIPCC_DIR/bin -DCLR_BUILD_HIP=ON -DHIP_PATH=\$PWD/install -DHIP_COMMON_DIR=\$HIP_DIR -DCMAKE_PREFIX_PATH="/opt/rocm/" -DCMAKE_INSTALL_PREFIX=\$PWD/install ..
6358
else
64-
export HIP_PLATFORM=nvidia
65-
export HIP_COMPILER=nvcc
66-
export HIP_RUNTIME=cuda
67-
cmake -DHIP_CATCH_TEST=1 -DHIP_PATH=\$PWD/install -DHIPCC_BIN_DIR=\$HIPCC_DIR/build -DHIP_COMMON_DIR=$HIP_DIR -DCMAKE_INSTALL_PREFIX=\$PWD/install ..
59+
cmake -DHIPCC_BIN_DIR=\$HIPCC_DIR/bin -DCLR_BUILD_HIP=ON -DHIP_PLATFORM=nvidia -DHIP_COMMON_DIR=\$HIP_DIR -DCMAKE_INSTALL_PREFIX=\$PWD/install ..
6860
fi
61+
make -j\$(nproc)
6962
make install -j\$(nproc)
70-
if [[ $backendLabel =~ amd ]]; then
71-
make build_tests -j\$(nproc)
72-
else
73-
HIP_COMPILER=nvcc HIP_PLATFORM=nvidia make build_tests -j\$(nproc)
74-
fi
7563
"""
7664
}
7765
}
7866

79-
stage('HIP Unit Tests - Catch2 framework') {
80-
dir("${WORKSPACE}/hipamd/build") {
67+
stage("BUILD HIP TESTS - ${backendLabel}") {
68+
// Running the build on HIP TESTS workspace
69+
dir("${WORKSPACE}/hip-tests") {
70+
env.HIP_PATH = "${CLR_DIR}" + "/build/install"
8171
sh """#!/usr/bin/env bash
8272
set -x
73+
rm -rf build
74+
mkdir -p build
75+
cd build
76+
echo "testing $HIP_PATH"
8377
# Check if backend label contains string "amd" or backend host is a server with amd gpu
8478
if [[ $backendLabel =~ amd ]]; then
85-
LLVM_PATH=/opt/rocm/llvm ctest -E 'Unit_hiprtc_saxpy'
79+
cmake -DHIP_PLATFORM=amd ../catch
80+
else
81+
export HIP_PLATFORM=nvidia
82+
cmake -DHIP_PLATFORM=nvidia ../catch
83+
fi
84+
make -j\$(nproc) build_tests
85+
"""
86+
}
87+
}
88+
89+
timeout(time: 1, unit: 'HOURS') {
90+
stage("TEST - ${backendLabel}") {
91+
dir("${WORKSPACE}/hip-tests") {
92+
sh """#!/usr/bin/env bash
93+
set -x
94+
cd build
95+
if [[ $backendLabel =~ amd ]]; then
96+
ctest --overwrite BuildDirectory=. --output-junit hiptest_output_catch_amd.xml
8697
else
87-
make test
98+
ctest --overwrite BuildDirectory=. --output-junit hiptest_output_catch_nvidia.xml -E 'Unit_hipMemcpyHtoD_Positive_Synchronization_Behavior|Unit_hipMemcpy_Positive_Synchronization_Behavior|Unit_hipFreeNegativeHost'
8899
fi
89100
"""
101+
}
90102
}
91103
}
92104
}

amd/hipcc/.readthedocs.yaml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# Read the Docs configuration file
2+
# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details
3+
4+
version: 2
5+
6+
sphinx:
7+
configuration: docs/conf.py
8+
9+
formats: [htmlzip]
10+
11+
python:
12+
version: "3.8"
13+
install:
14+
- requirements: docs/.sphinx/requirements.txt

amd/hipcc/CMakeLists.txt

Lines changed: 121 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,129 @@
1-
cmake_minimum_required(VERSION 3.16.3)
2-
project (hipcc.bin)
1+
cmake_minimum_required(VERSION 3.13.4)
2+
3+
project(hipcc VERSION "1.0.0" LANGUAGES C CXX)
4+
set(hipcc_NAME "${PROJECT_NAME}")
5+
6+
include(CMakePackageConfigHelpers)
7+
include(GNUInstallDirs)
8+
9+
find_package(ROCM QUIET)
10+
if(ROCM_FOUND)
11+
include(ROCMSetupVersion)
12+
rocm_setup_version(VERSION "${hipcc_VERSION}")
13+
endif()
314

4-
# Specify the C++ standard
515
set(CMAKE_CXX_STANDARD 17)
616
set(CMAKE_CXX_STANDARD_REQUIRED True)
717

8-
set (LINK_LIBS libstdc++fs.so)
9-
add_executable(hipcc.bin src/hipBin.cpp)
10-
if (NOT WIN32) # C++17 does not require the std lib linking
11-
target_link_libraries(hipcc.bin ${LINK_LIBS} ) # for hipcc.bin
18+
set(ADDITIONAL_SHARED_LIBRARIES_TO_LINK
19+
libstdc++fs.so)
20+
21+
set(HIPCC_BIN
22+
hipcc.bin)
23+
set(HIPCC_SOURCES
24+
src/hipBin.cpp)
25+
26+
set(HIPCONFIG_BIN
27+
hipconfig.bin)
28+
set(HIPCONFIG_SOURCES
29+
src/hipBin.cpp)
30+
31+
add_executable(${HIPCC_BIN} ${HIPCC_SOURCES})
32+
if(NOT WIN32)
33+
# C++17 does not require std lib linking.
34+
target_link_libraries(${HIPCC_BIN} ${ADDITIONAL_SHARED_LIBRARIES_TO_LINK})
35+
endif()
36+
37+
add_executable(${HIPCONFIG_BIN} ${HIPCONFIG_SOURCES})
38+
if(NOT WIN32)
39+
# C++17 does not require std lib linking.
40+
target_link_libraries(${HIPCONFIG_BIN} ${ADDITIONAL_SHARED_LIBRARIES_TO_LINK})
41+
endif()
42+
43+
# Copy scripts and batch files to build directory.
44+
file(COPY ${CMAKE_SOURCE_DIR}/bin/ DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
45+
46+
set(CPACK_GENERATOR "DEB;RPM;ZIP" CACHE STRING "Default packaging generators")
47+
set(CPACK_PACKAGE_CONTACT "ROCm Compiler Support <[email protected]>")
48+
set(CPACK_PACKAGE_DESCRIPTION "HIP Compiler Driver")
49+
set(CPACK_PACKAGE_NAME "${PROJECT_NAME}")
50+
set(CPACK_PACKAGE_VENDOR "Advanced Micro Devices, Inc.")
51+
set(CPACK_PACKAGE_VERSION_MAJOR "${hipcc_VERSION_MAJOR}")
52+
set(CPACK_PACKAGE_VERSION_MINOR "${hipcc_VERSION_MINOR}")
53+
set(CPACK_PACKAGE_VERSION_PATCH "${hipcc_VERSION_PATCH}")
54+
set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/LICENSE.txt")
55+
56+
# Debian-specific packaging variables.
57+
set(CPACK_DEBIAN_FILE_NAME "DEB-DEFAULT")
58+
set(CPACK_DEBIAN_PACKAGE_DEPENDS "perl (>= 5.0), libfile-basedir-perl, hip-dev, rocm-core, rocm-llvm")
59+
set(CPACK_DEBIAN_PACKAGE_HOMEPAGE "https://github.com/ROCm-Developer-Tools/HIPCC")
60+
if(DEFINED ENV{CPACK_DEBIAN_PACKAGE_RELEASE})
61+
set(CPACK_DEBIAN_PACKAGE_RELEASE $ENV{CPACK_DEBIAN_PACKAGE_RELEASE})
62+
else()
63+
set(CPACK_DEBIAN_PACKAGE_RELEASE "local")
64+
endif()
65+
66+
# RPM-specific packaging variables.
67+
set(CPACK_RPM_FILE_NAME "RPM-DEFAULT")
68+
set(CPACK_RPM_PACKAGE_LICENSE "MIT")
69+
set(CPACK_RPM_PACKAGE_REQUIRES "perl >= 5.0, perl-File-BaseDir, hip-devel, rocm-core, rocm-llvm")
70+
set(CPACK_RPM_PACKAGE_AUTOREQROV 0)
71+
if(DEFINED ENV{CPACK_RPM_PACKAGE_RELEASE})
72+
set(CPACK_RPM_PACKAGE_RELEASE $ENV{CPACK_RPM_PACKAGE_RELEASE})
73+
else()
74+
set(CPACK_RPM_PACKAGE_RELEASE "local")
75+
endif()
76+
if(CPACK_RPM_PACKAGE_RELEASE)
77+
set(CPACK_RPM_PACKAGE_RELEASE_DIST ON)
78+
endif()
79+
80+
# ROCM versioning.
81+
set(ROCM_VERSION_FOR_PACKAGE "")
82+
if(DEFINED ENV{ROCM_LIBPATCH_VERSION})
83+
set(ROCM_VERSION_FOR_PACKAGE $ENV{ROCM_LIBPATCH_VERSION})
84+
elseif(DEFINED ENV{ROCM_VERSION})
85+
string(REGEX REPLACE "." "" ROCM_VERSION_FOR_PACKAGE $ENV{ROCM_VERSION})
86+
else()
87+
set(ROCM_VERSION_FOR_PACKAGE "99999")
1288
endif()
89+
set(CPACK_PACKAGE_VERSION "${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}.${ROCM_VERSION_FOR_PACKAGE}")
90+
91+
# Exclude Windows specific BAT scripts from install/packaging for Linux.
92+
if (NOT WIN32)
93+
set(exclusion_pattern "*.bat")
94+
else ()
95+
set(exclusion_pattern "")
96+
endif()
97+
98+
install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/bin
99+
DESTINATION .
100+
USE_SOURCE_PERMISSIONS
101+
DIRECTORY_PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE
102+
FILES_MATCHING
103+
PATTERN "*"
104+
PATTERN ${exclusion_pattern} EXCLUDE )
105+
106+
install(FILES
107+
"LICENSE.txt"
108+
"README.md"
109+
COMPONENT ${hipcc_NAME}
110+
DESTINATION ${CMAKE_INSTALL_DOCDIR})
111+
112+
install(TARGETS ${HIPCC_BIN}
113+
COMPONENT ${hipcc_NAME}
114+
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
115+
116+
install(TARGETS ${HIPCONFIG_BIN}
117+
COMPONENT ${hipcc_NAME}
118+
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
13119

14-
project (hipconfig.bin)
15-
add_executable(hipconfig.bin src/hipBin.cpp)
16-
if (NOT WIN32) # C++17 does not require the std lib linking
17-
target_link_libraries(hipconfig.bin ${LINK_LIBS} ) # for hipconfig.bin
120+
# TODO: WIN32 check need to be removed if backward
121+
# compatibility is required for WIN32.
122+
option(HIPCC_BACKWARD_COMPATIBILITY "Enable HIPCC backward compatibility" ON)
123+
if(NOT WIN32)
124+
if(HIPCC_BACKWARD_COMPATIBILITY)
125+
include(hipcc-backward-compat.cmake)
126+
endif()
18127
endif()
19128

20-
set(HIP_VERSION_MAJOR 4 PARENT_SCOPE)
21-
set(HIP_VERSION_MINOR 4 PARENT_SCOPE)
22-
set(HIP_VERSION_PATCH 4 PARENT_SCOPE)
129+
include(CPack)

amd/hipcc/README.md

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,11 @@
55
<!-- toc -->
66

77
- [hipcc](#hipcc)
8+
* [Documentation](#documentation)
89
* [Environment Variables](#envVar)
910
* [Usage](#hipcc-usage)
1011
* [Building](#building)
1112
* [Testing](#testing)
12-
* [Linux](#linux)
13-
* [Windows](#windows)
1413

1514
<!-- tocstop -->
1615

@@ -20,6 +19,18 @@
2019

2120
`hipcc` will pass-through options to the target compiler. The tools calling hipcc must ensure the compiler options are appropriate for the target compiler.
2221

22+
## Documentation
23+
24+
Run the steps below to build documentation locally.
25+
26+
```
27+
cd docs
28+
29+
pip3 install -r .sphinx/requirements.txt
30+
31+
python3 -m sphinx -T -E -b html -d _build/doctrees -D language=en . _build/html
32+
```
33+
2334
### <a name="envVar"></a> Environment Variables
2435

2536
The environment variable HIP_PLATFORM may be used to specify amd/nvidia:
@@ -63,4 +74,4 @@ The hipcc and hipconfig executables are created in the current build folder. The
6374

6475
### <a name="testing"></a> hipcc: testing
6576

66-
Currently hipcc/hipconfig executables are tested by building and executing HIP tests. Seperate tests for hipcc/hipconfig is currently not planned.
77+
Currently hipcc/hipconfig executables are tested by building and executing HIP tests. Separate tests for hipcc/hipconfig is currently not planned.

0 commit comments

Comments
 (0)