Skip to content

Commit

Permalink
ROCm 3.7.0 updates
Browse files Browse the repository at this point in the history
  • Loading branch information
skeelyamd committed Aug 21, 2020
1 parent 0d9576a commit a7cb89e
Show file tree
Hide file tree
Showing 179 changed files with 61,820 additions and 1,654 deletions.
418 changes: 306 additions & 112 deletions src/CMakeLists.txt

Large diffs are not rendered by default.

48 changes: 46 additions & 2 deletions src/DEBIAN/post_install
Original file line number Diff line number Diff line change
@@ -1,4 +1,46 @@
#/bin/bash
#!/bin/bash

################################################################################
##
## The University of Illinois/NCSA
## Open Source License (NCSA)
##
## Copyright (c) 2020-2020, Advanced Micro Devices, Inc. All rights reserved.
##
## Developed by:
##
## AMD Research and AMD HSA Software Development
##
## Advanced Micro Devices, Inc.
##
## www.amd.com
##
## Permission is hereby granted, free of charge, to any person obtaining a copy
## of this software and associated documentation files (the "Software"), to
## deal with the Software without restriction, including without limitation
## the rights to use, copy, modify, merge, publish, distribute, sublicense,
## and#or sell copies of the Software, and to permit persons to whom the
## Software is furnished to do so, subject to the following conditions:
##
## - Redistributions of source code must retain the above copyright notice,
## this list of conditions and the following disclaimers.
## - Redistributions in binary form must reproduce the above copyright
## notice, this list of conditions and the following disclaimers in
## the documentation and#or other materials provided with the distribution.
## - Neither the names of Advanced Micro Devices, Inc,
## nor the names of its contributors may be used to endorse or promote
## products derived from this Software without specific prior written
## permission.
##
## THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
## IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
## FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
## THE CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
## OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
## ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
## DEALINGS WITH THE SOFTWARE.
##
################################################################################

set -e

Expand All @@ -9,7 +51,9 @@ do_ldconfig() {
case "$1" in
configure)
do_ldconfig
ln -sf ../hsa/include/hsa @CPACK_PACKAGING_INSTALL_PREFIX@/include/hsa
# Workaround for CPACK directory symlink handling error.
mkdir -p @CPACK_PACKAGING_INSTALL_PREFIX@/hsa/include
ln -sf ../../include/hsa @CPACK_PACKAGING_INSTALL_PREFIX@/hsa/include/hsa
;;
abort-upgrade|abort-remove|abort-deconfigure)
echo "$1"
Expand Down
45 changes: 44 additions & 1 deletion src/DEBIAN/pre_remove
Original file line number Diff line number Diff line change
@@ -1,5 +1,47 @@
#!/bin/bash

################################################################################
##
## The University of Illinois/NCSA
## Open Source License (NCSA)
##
## Copyright (c) 2020-2020, Advanced Micro Devices, Inc. All rights reserved.
##
## Developed by:
##
## AMD Research and AMD HSA Software Development
##
## Advanced Micro Devices, Inc.
##
## www.amd.com
##
## Permission is hereby granted, free of charge, to any person obtaining a copy
## of this software and associated documentation files (the "Software"), to
## deal with the Software without restriction, including without limitation
## the rights to use, copy, modify, merge, publish, distribute, sublicense,
## and#or sell copies of the Software, and to permit persons to whom the
## Software is furnished to do so, subject to the following conditions:
##
## - Redistributions of source code must retain the above copyright notice,
## this list of conditions and the following disclaimers.
## - Redistributions in binary form must reproduce the above copyright
## notice, this list of conditions and the following disclaimers in
## the documentation and#or other materials provided with the distribution.
## - Neither the names of Advanced Micro Devices, Inc,
## nor the names of its contributors may be used to endorse or promote
## products derived from this Software without specific prior written
## permission.
##
## THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
## IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
## FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
## THE CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
## OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
## ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
## DEALINGS WITH THE SOFTWARE.
##
################################################################################

set -e

rm_ldconfig() {
Expand All @@ -9,7 +51,8 @@ rm_ldconfig() {
case "$1" in
remove)
rm_ldconfig
rm -rf @CPACK_PACKAGING_INSTALL_PREFIX@/include/hsa
# Workaround for CPACK directory symlink handling error.
rm -rf @CPACK_PACKAGING_INSTALL_PREFIX@/hsa/include/hsa
;;
purge)
;;
Expand Down
2 changes: 1 addition & 1 deletion src/LICENSE.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ ROCR-Runtime LICENSE
The University of Illinois/NCSA
Open Source License (NCSA)

Copyright (c) 2014-2016, Advanced Micro Devices, Inc. All rights reserved.
Copyright (c) 2014-2020, Advanced Micro Devices, Inc. All rights reserved.

Developed by:

Expand Down
72 changes: 61 additions & 11 deletions src/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,19 +41,56 @@ can be obtained from the ROCT-Thunk-Interface repository, available here:

https://github.com/RadeonOpenCompute/ROCT-Thunk-Interface

Specify the directory containing libhsakmt.so.1 and hsakmt.h using the cmake variables, HSAKMT_LIB_PATH and HSAKMT_INC_PATH. These can be specified either on the command line
or via standard cmake configuration tools such as ccmake or cmake-gui.
As of ROCm release 3.7 libhsakmt development packages now include a cmake
package config file. The runtime will now locate libhsakmt via find_package if
libhsakmt is installed to a standard location. For installations that do not
use ROCm standard paths set cmake variables CMAKE_PREFIX_PATH or hsakmt_DIR to
override find_package search paths.

For example, from the top level ROCR repository execute:
As of ROCm release 3.7 the runtime includes an optional image support module
(previously hsa-ext-rocr-dev). By default this module is included in builds of
the runtime. The image module may be excluded the runtime by setting
cmake variable IMAGE_SUPPORT to OFF.

When building the optional image module additional build dependencies are
required. An amdgcn compatible clang and device library must be installed
to build the image module. The latest version of these requirements can be
obtained from the ROCm package repository
(see: https://rocmdocs.amd.com/en/latest/Installation_Guide/Installation-Guide.html)
The latest source for these projects may be found here:

https://github.com/RadeonOpenCompute/llvm-project

https://github.com/RadeonOpenCompute/ROCm-Device-Libs

Additionally xxd must be installed.

The runtime optionally supports use of the cmake user package registry. By
default the registry is not modified. Set cmake variable
EXPORT_TO_USER_PACKAGE_REGISTRY to ON to enable updating the package registry.

For example, to build, install, and produce packages on a system with standard
ROCm packages installed, execute the following from src/:

mkdir build
cd build
cmake -DHSAKMT_INC_PATH:STRING=<path to directory holding hsakmt.h> \
-DHSAKMT_LIB_PATH:STRING=<path to directory holding libhsakmt.so.1> \
..
cmake -DCMAKE_INSTALL_PATH=/opt/rocm ..
make

alternately using ccmake:
make install
make package

Example with a custom installation path, build dependency path, and options:

...
cmake -DIMAGE_SUPPORT=OFF \
-DEXPORT_TO_USER_PACKAGE_REGISTRY=ON \
-DCMAKE_VERBOSE_MAKEFILE=1 \
-DCMAKE_PREFIX_PATH=<alternate path(s) to build dependencies> \
-DCMAKE_INSTALL_PATH=<custom install path for this build> \
..
...

Alternately ccmake and cmake-gui are supported:

mkdir build
cd build
Expand All @@ -64,6 +101,21 @@ alternately using ccmake:
press g to generate and exit
make

#### Building against the runtime

The runtime provides a cmake package config file, installed by default to
/opt/rocm/lib/cmake/hsa-runtime64. The runtime exports cmake target
hsa-runtime64 in namespace hsa-runtime64. A cmake project (Foo) using the
runtime may locate, include, and link the runtime with the following template:

Add /opt/rocm to CMAKE_PREFIX_PATH.

find_package(hsa-runtime64 1.0 REQUIRED)
...
add_library(Foo ...)
...
target_link_library(Foo PRIVATE hsa-runtime64::hsa-runtime64)

#### Specs

http://www.hsafoundation.com/standards/
Expand Down Expand Up @@ -147,9 +199,7 @@ The device specific layer contains implementations of the C++ interface classes

#### Known Issues

* Max total coarse grain region limit is 8GB.
* hsa_agent_get_exception_policies is not implemented.
* Image import/export/copy/fill only support image created with memory from host accessible region.
* hsa_system_get_extension_table is not implemented for HSA_EXTENSION_AMD_PROFILER.

#### Disclaimer
Expand All @@ -158,4 +208,4 @@ The information contained herein is for informational purposes only, and is subj

AMD, the AMD Arrow logo, and combinations thereof are trademarks of Advanced Micro Devices, Inc. Other product names used in this publication are for identification purposes only and may be trademarks of their respective companies.

Copyright (c) 2014-2017 Advanced Micro Devices, Inc. All rights reserved.
Copyright (c) 2014-2020 Advanced Micro Devices, Inc. All rights reserved.
42 changes: 42 additions & 0 deletions src/RPM/rpm_post
Original file line number Diff line number Diff line change
@@ -1 +1,43 @@
################################################################################
##
## The University of Illinois/NCSA
## Open Source License (NCSA)
##
## Copyright (c) 2016-2020, Advanced Micro Devices, Inc. All rights reserved.
##
## Developed by:
##
## AMD Research and AMD HSA Software Development
##
## Advanced Micro Devices, Inc.
##
## www.amd.com
##
## Permission is hereby granted, free of charge, to any person obtaining a copy
## of this software and associated documentation files (the "Software"), to
## deal with the Software without restriction, including without limitation
## the rights to use, copy, modify, merge, publish, distribute, sublicense,
## and#or sell copies of the Software, and to permit persons to whom the
## Software is furnished to do so, subject to the following conditions:
##
## - Redistributions of source code must retain the above copyright notice,
## this list of conditions and the following disclaimers.
## - Redistributions in binary form must reproduce the above copyright
## notice, this list of conditions and the following disclaimers in
## the documentation and#or other materials provided with the distribution.
## - Neither the names of Advanced Micro Devices, Inc,
## nor the names of its contributors may be used to endorse or promote
## products derived from this Software without specific prior written
## permission.
##
## THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
## IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
## FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
## THE CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
## OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
## ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
## DEALINGS WITH THE SOFTWARE.
##
################################################################################

echo /opt/rocm/hsa/lib > /etc/ld.so.conf.d/hsa-rocr-dev.conf && ldconfig
44 changes: 43 additions & 1 deletion src/RPM/rpm_postun
Original file line number Diff line number Diff line change
@@ -1,3 +1,45 @@
if [ $1 -eq 0]; then
################################################################################
##
## The University of Illinois/NCSA
## Open Source License (NCSA)
##
## Copyright (c) 2016-2020, Advanced Micro Devices, Inc. All rights reserved.
##
## Developed by:
##
## AMD Research and AMD HSA Software Development
##
## Advanced Micro Devices, Inc.
##
## www.amd.com
##
## Permission is hereby granted, free of charge, to any person obtaining a copy
## of this software and associated documentation files (the "Software"), to
## deal with the Software without restriction, including without limitation
## the rights to use, copy, modify, merge, publish, distribute, sublicense,
## and#or sell copies of the Software, and to permit persons to whom the
## Software is furnished to do so, subject to the following conditions:
##
## - Redistributions of source code must retain the above copyright notice,
## this list of conditions and the following disclaimers.
## - Redistributions in binary form must reproduce the above copyright
## notice, this list of conditions and the following disclaimers in
## the documentation and#or other materials provided with the distribution.
## - Neither the names of Advanced Micro Devices, Inc,
## nor the names of its contributors may be used to endorse or promote
## products derived from this Software without specific prior written
## permission.
##
## THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
## IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
## FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
## THE CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
## OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
## ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
## DEALINGS WITH THE SOFTWARE.
##
################################################################################

if [ $1 -eq 0 ]; then
rm -f /etc/ld.so.conf.d/hsa-rocr-dev.conf && ldconfig
fi
6 changes: 3 additions & 3 deletions src/cmake_modules/FindLibElf.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ int main() {
mark_as_advanced(LIBELF_INCLUDE_DIRS LIBELF_LIBRARIES ELF_GETSHDRSTRNDX)

if(LIBELF_FOUND)
add_library(elf UNKNOWN IMPORTED)
set_property(TARGET elf PROPERTY IMPORTED_LOCATION ${LIBELF_LIBRARIES})
set_property(TARGET elf PROPERTY INTERFACE_INCLUDE_DIRECTORIES ${LIBELF_INCLUDE_DIRS})
add_library(elf::elf UNKNOWN IMPORTED)
set_property(TARGET elf::elf PROPERTY IMPORTED_LOCATION ${LIBELF_LIBRARIES})
set_property(TARGET elf::elf PROPERTY INTERFACE_INCLUDE_DIRECTORIES ${LIBELF_INCLUDE_DIRS})
endif()
48 changes: 19 additions & 29 deletions src/cmake_modules/hsa_common.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
## The University of Illinois/NCSA
## Open Source License (NCSA)
##
## Copyright (c) 2014-2016, Advanced Micro Devices, Inc. All rights reserved.
## Copyright (c) 2014-2020, Advanced Micro Devices, Inc. All rights reserved.
##
## Developed by:
##
Expand Down Expand Up @@ -51,31 +51,21 @@ if(CMAKE_SIZEOF_VOID_P EQUAL 8)
set(ONLY64STR "64")
endif()

if(UNIX)
set(PS ":")
set(CMAKE_CXX_FLAGS "-Wall -std=c++11 ${EXTRA_CFLAGS}")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fpic")
if (CMAKE_COMPILER_IS_GNUCXX)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wl,--unresolved-symbols=ignore-in-shared-libs")
endif ()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-strict-aliasing")
if ( CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64" )
set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -m64 -msse -msse2" )
elseif ( CMAKE_SYSTEM_PROCESSOR STREQUAL "x86" )
set ( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -m32" )
endif ()
if ( "${CMAKE_BUILD_TYPE}" STREQUAL Debug )
set ( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O0 -ggdb" )
endif ()
add_definitions(-D __STDC_LIMIT_MACROS)
add_definitions(-D __STDC_CONSTANT_MACROS)
add_definitions(-D __STDC_FORMAT_MACROS)
add_definitions (-DLITTLEENDIAN_CPU=1)
else()
set (PS "\;")
endif()

if(MSVC)
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /MT")
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /MTd")
endif()
set(HSA_COMMON_CXX_FLAGS "-Wall" "-std=c++11")
set(HSA_COMMON_CXX_FLAGS ${HSA_COMMON_CXX_FLAGS} "-fPIC")
if (CMAKE_COMPILER_IS_GNUCXX)
set(HSA_COMMON_CXX_FLAGS ${HSA_COMMON_CXX_FLAGS} "-Wl,--unresolved-symbols=ignore-in-shared-libs")
endif ()
set(HSA_COMMON_CXX_FLAGS ${HSA_COMMON_CXX_FLAGS} "-fno-strict-aliasing")
if ( CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64")
set( HSA_COMMON_CXX_FLAGS ${HSA_COMMON_CXX_FLAGS} "-m64" "-msse" "-msse2")
elseif ( CMAKE_SYSTEM_PROCESSOR STREQUAL "x86" )
set ( HSA_COMMON_CXX_FLAGS ${HSA_COMMON_CXX_FLAGS} "-m32")
endif ()
if ( "${CMAKE_BUILD_TYPE}" STREQUAL Debug )
set ( HSA_COMMON_CXX_FLAGS ${HSA_COMMON_CXX_FLAGS} "-O0" "-ggdb")
endif ()
set( HSA_COMMON_DEFS "__STDC_LIMIT_MACROS")
set( HSA_COMMON_DEFS ${HSA_COMMON_DEFS} "__STDC_CONSTANT_MACROS")
set( HSA_COMMON_DEFS ${HSA_COMMON_DEFS} "__STDC_FORMAT_MACROS")
set( HSA_COMMON_DEFS ${HSA_COMMON_DEFS} "LITTLEENDIAN_CPU=1")
2 changes: 1 addition & 1 deletion src/cmake_modules/utils.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
## The University of Illinois/NCSA
## Open Source License (NCSA)
##
## Copyright (c) 2014-2017, Advanced Micro Devices, Inc. All rights reserved.
## Copyright (c) 2014-2020, Advanced Micro Devices, Inc. All rights reserved.
##
## Developed by:
##
Expand Down
Loading

0 comments on commit a7cb89e

Please sign in to comment.