SWDEV-273235 - Initial support for Windows CMake
This change refactors the current ROCclr cmake build to accomodate a
more modular approach. This allows easier support for multiple compiler
and/or multiple runtime backends.
Currently supported compilers:
HSAIL - enabled by ROCCLR_ENABLE_HSAIL (defaults to OFF)
LC - enabled by ROCCLR_ENABLE_LC (defaults to ON)
Currently supported runtimes:
HSA - enabled by ROCCLR_ENABLE_HSA (defaults to ON)
PAL - enabled by ROCCLR_ENABLE_PAL (defaults to OFF)
Any configuration is supported as long as at least one compiler and one
runtime is enabled.
Since ROCclr clients can configure it differently, one cannot reuse the
same ROCclr build artifacts between different clients. To assure this,
this patch assumes that ROCclr will be built as part of the clients
project.
Change-Id: Id4a5c43634296802b8ae87d1ad5984968391ccaf
Tá an tiomantas seo le fáil i:
tiomanta ag
Maneesh Gupta
tuismitheoir
1b832c0182
tiomantas
7f0c18457d
@@ -20,317 +20,11 @@
|
||||
|
||||
cmake_minimum_required(VERSION 3.5)
|
||||
|
||||
project(ROCclr VERSION "1.0.0" LANGUAGES C CXX)
|
||||
project(ROCclr)
|
||||
|
||||
include(CMakePackageConfigHelpers)
|
||||
|
||||
#decide whether .so is to be build or .a
|
||||
set(BUILD_SHARED_LIBS ON CACHE BOOL "Build shared library (.so) or not.")
|
||||
|
||||
#example command:
|
||||
|
||||
#cmake -DOPENCL_DIR=/path to/opencl ..
|
||||
|
||||
set(ROCCLR_CONFIG_NAME ROCclrConfig.cmake)
|
||||
set(ROCCLR_TARGETS_NAME rocclr-targets.cmake)
|
||||
set(ROCCLR_VERSION_NAME rocclr-config-version.cmake)
|
||||
set(ROCCLR_PACKAGE_PREFIX lib/cmake/rocclr)
|
||||
set(ROCCLR_PREFIX_CODE)
|
||||
set(ROCCLR_TARGETS_PATH
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/${ROCCLR_PACKAGE_PREFIX}/${ROCCLR_TARGETS_NAME}")
|
||||
set(ROCCLR_VERSION_PATH
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/${ROCCLR_PACKAGE_PREFIX}/${ROCCLR_VERSION_NAME}")
|
||||
|
||||
# Generate the build-tree package.
|
||||
configure_file("cmake/${ROCCLR_CONFIG_NAME}.in"
|
||||
"${ROCCLR_PACKAGE_PREFIX}/${ROCCLR_CONFIG_NAME}"
|
||||
@ONLY)
|
||||
|
||||
write_basic_package_version_file("${ROCCLR_VERSION_PATH}"
|
||||
VERSION "${ROCclr_VERSION}"
|
||||
COMPATIBILITY SameMajorVersion)
|
||||
|
||||
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/cmake" "${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules")
|
||||
|
||||
# FIXME: Handling legacy custom boolean matching "yes" or "no"
|
||||
if(DEFINED USE_COMGR_LIBRARY)
|
||||
if(${USE_COMGR_LIBRARY} MATCHES "yes")
|
||||
set(USE_COMGR_LIBRARY ON)
|
||||
elseif(${USE_COMGR_LIBRARY} MATCHES "no")
|
||||
set(USE_COMGR_LIBRARY OFF)
|
||||
endif()
|
||||
if (${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_CURRENT_SOURCE_DIR})
|
||||
message(AUTHOR_WARNING "ROCclr is being built as a standalone project. This isn't supported anymore.")
|
||||
endif()
|
||||
|
||||
option(USE_COMGR_LIBRARY "Use comgr library" ON)
|
||||
|
||||
find_package(amd_comgr REQUIRED CONFIG
|
||||
PATHS
|
||||
/opt/rocm/
|
||||
PATH_SUFFIXES
|
||||
cmake/amd_comgr
|
||||
lib/cmake/amd_comgr
|
||||
)
|
||||
message(STATUS "Code Object Manager found at ${amd_comgr_DIR}.")
|
||||
|
||||
find_package(hsa-runtime64 1.3 REQUIRED CONFIG
|
||||
PATHS
|
||||
/opt/rocm/
|
||||
PATH_SUFFIXES
|
||||
cmake/hsa-runtime64
|
||||
lib/cmake/hsa-runtime64
|
||||
lib64/cmake/hsa-runtime64
|
||||
)
|
||||
message(STATUS "HSA Runtime found at ${hsa-runtime64_DIR}.")
|
||||
|
||||
if( NOT OPENCL_DIR )
|
||||
find_path(OPENCL_INCLUDE_DIR
|
||||
NAMES OpenCL/cl.h CL/cl.h
|
||||
PATH_SUFFIXES include opencl/include inc include/x86_64 include/x64
|
||||
PATHS /opt/rocm
|
||||
DOC "OpenCL include header OpenCL/cl.h or CL/cl.h"
|
||||
)
|
||||
|
||||
if( NOT OPENCL_INCLUDE_DIR )
|
||||
unset(OPENCL_INCLUDE_DIR CACHE)
|
||||
set(OPENCL_INCLUDE_DIR "" CACHE PATH "" FORCE )
|
||||
endif()
|
||||
message(STATUS "Opencl found at ${OPENCL_INCLUDE_DIR}.")
|
||||
endif()
|
||||
|
||||
|
||||
|
||||
set(THREADS_PREFER_PTHREAD_FLAG ON)
|
||||
find_package(Threads REQUIRED)
|
||||
|
||||
set(CMAKE_CXX_STANDARD 14)
|
||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||
set(CMAKE_CXX_EXTENSIONS OFF)
|
||||
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
|
||||
|
||||
if((CMAKE_CXX_COMPILER_ID STREQUAL "GNU") OR
|
||||
(CMAKE_CXX_COMPILER_ID MATCHES "Clang"))
|
||||
add_definitions(
|
||||
# Enabling -Wextra or -pedantic will cause
|
||||
# thousands of warnings. Keep things simple for now.
|
||||
-Wall
|
||||
# Makefile build adds -fno-strict-aliasing instead.
|
||||
-Wno-strict-aliasing
|
||||
# This one seems impossible to fix for now.
|
||||
# There are hundreds of instances of unused vars/functions
|
||||
# throughout the code base.
|
||||
-Wno-unused-variable)
|
||||
endif()
|
||||
|
||||
add_definitions(-D__x86_64__ -DOPENCL_MAJOR=2 -DOPENCL_MINOR=1 -DCL_TARGET_OPENCL_VERSION=220 -DATI_OS_LINUX -DATI_ARCH_X86 -DLITTLEENDIAN_CPU -DATI_BITS_64 -DWITH_TARGET_AMDGCN -DOPENCL_EXPORTS -DCL_USE_DEPRECATED_OPENCL_1_0_APIS -DCL_USE_DEPRECATED_OPENCL_1_1_APIS -DCL_USE_DEPRECATED_OPENCL_1_2_APIS -DCL_USE_DEPRECATED_OPENCL_2_0_APIS -DWITH_LIGHTNING_COMPILER)
|
||||
add_definitions(-DOPENCL_C_MAJOR=2 -DOPENCL_C_MINOR=0)
|
||||
|
||||
set(CMAKE_SHARED_LINKER_FLAGS "-Wl,-Bsymbolic -Wl,--unresolved-symbols=report-all")
|
||||
set (CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/lib)
|
||||
|
||||
if(CMAKE_BUILD_TYPE MATCHES "^Debug$")
|
||||
add_definitions(-DDEBUG)
|
||||
endif()
|
||||
|
||||
if(DEV_LOG_ENABLE MATCHES "yes")
|
||||
add_definitions(-DDEV_LOG_ENABLE)
|
||||
endif()
|
||||
|
||||
option(BUILD_LINUXPRO "Build LinuxPro" OFF)
|
||||
if (BUILD_LINUXPRO)
|
||||
message(STATUS "Building LinuxPro")
|
||||
add_definitions(-DROCCLR_DISABLE_PREVEGA)
|
||||
add_definitions(-DROCCLR_ENABLE_GL_SHARING)
|
||||
endif()
|
||||
|
||||
option(BUILD_PAL "Build PAL backend" OFF)
|
||||
if (BUILD_PAL)
|
||||
add_subdirectory(device/pal)
|
||||
|
||||
add_subdirectory(compiler/sc/HSAIL)
|
||||
else ()
|
||||
add_subdirectory(device/rocm)
|
||||
endif()
|
||||
|
||||
set(oclruntime_src
|
||||
thread/thread.cpp
|
||||
thread/monitor.cpp
|
||||
thread/semaphore.cpp
|
||||
utils/flags.cpp
|
||||
utils/debug.cpp
|
||||
device/appprofile.cpp
|
||||
device/device.cpp
|
||||
device/hwdebug.cpp
|
||||
device/blitcl.cpp
|
||||
device/blit.cpp
|
||||
device/devkernel.cpp
|
||||
device/devwavelimiter.cpp
|
||||
device/devprogram.cpp
|
||||
device/devhcprintf.cpp
|
||||
device/devhcmessages.cpp
|
||||
device/devhostcall.cpp
|
||||
device/comgrctx.cpp
|
||||
device/hsailctx.cpp
|
||||
platform/activity.cpp
|
||||
platform/kernel.cpp
|
||||
platform/context.cpp
|
||||
platform/command.cpp
|
||||
platform/ndrange.cpp
|
||||
platform/runtime.cpp
|
||||
platform/memory.cpp
|
||||
platform/program.cpp
|
||||
platform/commandqueue.cpp
|
||||
platform/agent.cpp
|
||||
os/os_win32.cpp
|
||||
os/alloc.cpp
|
||||
os/os.cpp
|
||||
os/os_posix.cpp
|
||||
compiler/lib/utils/options.cpp
|
||||
elf/elf.cpp
|
||||
)
|
||||
|
||||
add_library(amdrocclr_static STATIC ${oclruntime_src})
|
||||
|
||||
set_target_properties(amdrocclr_static PROPERTIES POSITION_INDEPENDENT_CODE ON)
|
||||
|
||||
target_include_directories(amdrocclr_static
|
||||
PUBLIC
|
||||
$<INSTALL_INTERFACE:include>
|
||||
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
|
||||
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
|
||||
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/device>
|
||||
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/device/rocm>
|
||||
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/compiler/lib/include>
|
||||
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/compiler/lib>
|
||||
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/compiler/lib/backends/common>
|
||||
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/elf>
|
||||
$<BUILD_INTERFACE:${OPENCL_DIR}>
|
||||
# GL and EGL headers.
|
||||
$<BUILD_INTERFACE:${OPENCL_DIR}/khronos/headers>
|
||||
$<BUILD_INTERFACE:${OPENCL_DIR}/khronos/headers/opencl2.2>
|
||||
$<TARGET_PROPERTY:amd_comgr,INTERFACE_INCLUDE_DIRECTORIES>)
|
||||
|
||||
if(USE_COMGR_LIBRARY)
|
||||
# FIXME: This should not be part of the public interface. Downstream
|
||||
# users need to add these definitions. This should be defined in a
|
||||
# config header here so other builds don't need to be aware of this.
|
||||
if(${BUILD_SHARED_LIBS})
|
||||
target_compile_definitions(amdrocclr_static PUBLIC USE_COMGR_LIBRARY COMGR_DYN_DLL)
|
||||
else()
|
||||
target_compile_definitions(amdrocclr_static PUBLIC USE_COMGR_LIBRARY)
|
||||
endif()
|
||||
#Needed here to export as transitive dependency in rocclr-targets.cmake
|
||||
target_link_libraries(amdrocclr_static PRIVATE amd_comgr)
|
||||
endif()
|
||||
|
||||
target_link_libraries(amdrocclr_static PUBLIC Threads::Threads)
|
||||
target_link_libraries(amdrocclr_static PUBLIC dl)
|
||||
|
||||
|
||||
if (BUILD_PAL)
|
||||
target_sources(amdrocclr_static PRIVATE $<TARGET_OBJECTS:rocclrpal>)
|
||||
target_link_libraries(amdrocclr_static PRIVATE amdhsaloader)
|
||||
target_link_libraries(amdrocclr_static PRIVATE pal)
|
||||
|
||||
target_compile_definitions(amdrocclr_static PRIVATE WITH_PAL_DEVICE)
|
||||
|
||||
export(TARGETS amdrocclr_static rocclrpal amdhsaloader amdhsacode pal addrlib vam metrohash cwpack gpuopen ddCore tiny_printf mpack rapidjson
|
||||
FILE ${ROCCLR_TARGETS_PATH})
|
||||
else()
|
||||
target_compile_definitions(amdrocclr_static PRIVATE WITH_HSA_DEVICE)
|
||||
|
||||
#ROCclr being static lib shall not link hsa-runtime64.
|
||||
#Needed here to export as transitive dependency in rocclr-targets.cmake
|
||||
target_link_libraries(amdrocclr_static PRIVATE hsa-runtime64::hsa-runtime64)
|
||||
target_sources(amdrocclr_static PRIVATE $<TARGET_OBJECTS:oclrocm>)
|
||||
export(TARGETS amdrocclr_static
|
||||
FILE ${ROCCLR_TARGETS_PATH})
|
||||
endif()
|
||||
|
||||
if (UNIX)
|
||||
set(ROCclr_DEFAULT_INSTALL_PREFIX "/opt/rocm/rocclr")
|
||||
|
||||
find_library(LIBRT rt)
|
||||
if (LIBRT)
|
||||
target_link_libraries(amdrocclr_static PUBLIC ${LIBRT})
|
||||
endif()
|
||||
|
||||
if (LIBNUMA)
|
||||
target_link_libraries(amdrocclr_static PUBLIC ${LIBNUMA})
|
||||
endif()
|
||||
endif()
|
||||
#comment out as it's not available in cmake 3.5
|
||||
#if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
|
||||
if(NOT CMAKE_INSTALL_PREFIX)
|
||||
if(CMAKE_BUILD_TYPE MATCHES Debug)
|
||||
set(CMAKE_INSTALL_PREFIX ${CMAKE_CURRENT_SOURCE_DIR} CACHE PATH "Installation path for rocclr" FORCE)
|
||||
#elseif(CMAKE_BUILD_TYPE MATCHES Release)
|
||||
else()
|
||||
set(CMAKE_INSTALL_PREFIX ${ROCclr_DEFAULT_INSTALL_PREFIX} CACHE PATH "Installation path for rocclr" FORCE)
|
||||
# message(FATAL_ERROR "Invalid CMAKE_BUILD_TYPE specified. Valid values are Debug and Release")
|
||||
endif()
|
||||
#endif()
|
||||
endif()
|
||||
|
||||
|
||||
install( TARGETS amdrocclr_static
|
||||
EXPORT rocclr
|
||||
ARCHIVE DESTINATION lib
|
||||
LIBRARY DESTINATION lib
|
||||
COMPONENT applications)
|
||||
|
||||
install (
|
||||
DIRECTORY include/
|
||||
DESTINATION include)
|
||||
install (
|
||||
DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/elf"
|
||||
DESTINATION include
|
||||
FILES_MATCHING PATTERN "*.h*")
|
||||
install (
|
||||
DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/compiler"
|
||||
DESTINATION include
|
||||
FILES_MATCHING PATTERN "*.h*")
|
||||
install (
|
||||
DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/utils"
|
||||
DESTINATION include
|
||||
FILES_MATCHING PATTERN "*.h*")
|
||||
install (
|
||||
DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/platform"
|
||||
DESTINATION include
|
||||
FILES_MATCHING PATTERN "*.h*")
|
||||
install (
|
||||
DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/thread"
|
||||
DESTINATION include
|
||||
FILES_MATCHING PATTERN "*.h*")
|
||||
install (
|
||||
DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/os"
|
||||
DESTINATION include
|
||||
FILES_MATCHING PATTERN "*.h*")
|
||||
install (
|
||||
DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/device"
|
||||
DESTINATION include
|
||||
FILES_MATCHING PATTERN "*.h*")
|
||||
|
||||
# Generate the install-tree package.
|
||||
set(ROCCLR_PREFIX_CODE "
|
||||
# Derive absolute install prefix from config file path.
|
||||
get_filename_component(ROCCLR_PREFIX \"\${CMAKE_CURRENT_LIST_FILE}\" PATH)")
|
||||
string(REGEX REPLACE "/" ";" count "${ROCCLR_PACKAGE_PREFIX}")
|
||||
foreach(p ${count})
|
||||
set(ROCCLR_PREFIX_CODE "${ROCCLR_PREFIX_CODE}
|
||||
get_filename_component(ROCCLR_PREFIX \"\${ROCCLR_PREFIX}\" PATH)")
|
||||
endforeach()
|
||||
|
||||
configure_file("cmake/${ROCCLR_CONFIG_NAME}.in"
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/${ROCCLR_CONFIG_NAME}.install"
|
||||
@ONLY)
|
||||
|
||||
install(FILES
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/${ROCCLR_CONFIG_NAME}.install"
|
||||
DESTINATION "${ROCCLR_PACKAGE_PREFIX}"
|
||||
RENAME "${ROCCLR_CONFIG_NAME}")
|
||||
install(EXPORT rocclr
|
||||
DESTINATION "${ROCCLR_PACKAGE_PREFIX}"
|
||||
FILE "${ROCCLR_TARGETS_NAME}")
|
||||
install(FILES
|
||||
"${ROCCLR_VERSION_PATH}"
|
||||
DESTINATION "${ROCCLR_PACKAGE_PREFIX}")
|
||||
list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
|
||||
include(ROCclr)
|
||||
|
||||
@@ -0,0 +1,55 @@
|
||||
# Copyright (c) 2020-2021 Advanced Micro Devices, Inc. All rights reserved.
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documentation files (the "Software"), to deal
|
||||
# in 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:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in
|
||||
# all copies or substantial portions of the Software.
|
||||
#
|
||||
# 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
|
||||
# AUTHORS 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 IN
|
||||
# THE SOFTWARE.
|
||||
|
||||
if(AMD_HSA_LOADER_FOUND)
|
||||
return()
|
||||
endif()
|
||||
|
||||
find_path(AMD_LIBELF_INCLUDE_DIR libelf.h
|
||||
HINTS
|
||||
${AMD_LIBELF_PATH}
|
||||
PATHS
|
||||
${CMAKE_SOURCE_DIR}/hsail-compiler/lib/loaders/elf/utils/libelf
|
||||
${CMAKE_SOURCE_DIR}/../hsail-compiler/lib/loaders/elf/utils/libelf
|
||||
${CMAKE_SOURCE_DIR}/../../hsail-compiler/lib/loaders/elf/utils/libelf)
|
||||
|
||||
find_path(AMD_HSAIL_INCLUDE_DIR hsa.h
|
||||
HINTS
|
||||
${AMD_SC_PATH}
|
||||
PATHS
|
||||
${CMAKE_SOURCE_DIR}/sc
|
||||
${CMAKE_SOURCE_DIR}/../sc
|
||||
${CMAKE_SOURCE_DIR}/../../sc
|
||||
PATH_SUFFIXES
|
||||
HSAIL/include)
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
find_package_handle_standard_args(AMD_HSA_LOADER
|
||||
"\nHSA Loader not found"
|
||||
AMD_LIBELF_INCLUDE_DIR AMD_HSAIL_INCLUDE_DIR)
|
||||
mark_as_advanced(AMD_LIBELF_INCLUDE_DIR AMD_HSAIL_INCLUDE_DIR)
|
||||
|
||||
set(USE_AMD_LIBELF "yes" CACHE FORCE "")
|
||||
# TODO compiler team requested supporting sp3 disassembly
|
||||
set(NO_SI_SP3 "yes" CACHE FORCE "")
|
||||
set(HSAIL_COMPILER_SOURCE_DIR "${AMD_LIBELF_INCLUDE_DIR}/../../../../..")
|
||||
add_subdirectory("${AMD_LIBELF_INCLUDE_DIR}" ${CMAKE_CURRENT_BINARY_DIR}/libelf)
|
||||
add_subdirectory("${AMD_HSAIL_INCLUDE_DIR}/../ext/libamdhsacode" ${CMAKE_CURRENT_BINARY_DIR}/libamdhsacode)
|
||||
add_subdirectory("${AMD_HSAIL_INCLUDE_DIR}/../ext/loader" ${CMAKE_CURRENT_BINARY_DIR}/loader)
|
||||
@@ -0,0 +1,74 @@
|
||||
# Copyright (c) 2020-2021 Advanced Micro Devices, Inc. All rights reserved.
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documentation files (the "Software"), to deal
|
||||
# in 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:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in
|
||||
# all copies or substantial portions of the Software.
|
||||
#
|
||||
# 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
|
||||
# AUTHORS 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 IN
|
||||
# THE SOFTWARE.
|
||||
|
||||
if(AMD_OPENCL_FOUND)
|
||||
return()
|
||||
endif()
|
||||
|
||||
find_path(AMD_OPENCL_INCLUDE_DIR cl.h
|
||||
HINTS
|
||||
${AMD_OPENCL_PATH}
|
||||
PATHS
|
||||
# gerrit repo name
|
||||
${CMAKE_SOURCE_DIR}/opencl
|
||||
${CMAKE_SOURCE_DIR}/../opencl
|
||||
${CMAKE_SOURCE_DIR}/../../opencl
|
||||
# github repo name
|
||||
${CMAKE_SOURCE_DIR}/ROCm-OpenCL-Runtime
|
||||
${CMAKE_SOURCE_DIR}/../ROCm-OpenCL-Runtime
|
||||
${CMAKE_SOURCE_DIR}/../../ROCm-OpenCL-Runtime
|
||||
# jenkins repo name
|
||||
${CMAKE_SOURCE_DIR}/opencl-on-vdi
|
||||
${CMAKE_SOURCE_DIR}/../opencl-on-vdi
|
||||
${CMAKE_SOURCE_DIR}/../../opencl-on-vdi
|
||||
${CMAKE_SOURCE_DIR}/opencl-on-rocclr
|
||||
${CMAKE_SOURCE_DIR}/../opencl-on-rocclr
|
||||
${CMAKE_SOURCE_DIR}/../../opencl-on-rocclr
|
||||
PATH_SUFFIXES
|
||||
khronos/headers/opencl2.2/CL
|
||||
NO_DEFAULT_PATH)
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
find_package_handle_standard_args(AMD_OPENCL
|
||||
"\nAMD OpenCL not found"
|
||||
AMD_OPENCL_INCLUDE_DIR)
|
||||
mark_as_advanced(AMD_OPENCL_INCLUDE_DIR)
|
||||
|
||||
set(AMD_OPENCL_DEFS
|
||||
-DHAVE_CL2_HPP
|
||||
-DOPENCL_MAJOR=2
|
||||
-DOPENCL_MINOR=2
|
||||
-DOPENCL_C_MAJOR=2
|
||||
-DOPENCL_C_MINOR=0
|
||||
-DCL_TARGET_OPENCL_VERSION=220
|
||||
-DCL_USE_DEPRECATED_OPENCL_1_0_APIS
|
||||
-DCL_USE_DEPRECATED_OPENCL_1_1_APIS
|
||||
-DCL_USE_DEPRECATED_OPENCL_1_2_APIS
|
||||
-DCL_USE_DEPRECATED_OPENCL_2_0_APIS)
|
||||
mark_as_advanced(AMD_OPENCL_DEFS)
|
||||
|
||||
set(AMD_OPENCL_INCLUDE_DIRS
|
||||
${AMD_OPENCL_INCLUDE_DIR}
|
||||
${AMD_OPENCL_INCLUDE_DIR}/..
|
||||
${AMD_OPENCL_INCLUDE_DIR}/../..
|
||||
${AMD_OPENCL_INCLUDE_DIR}/../../..
|
||||
${AMD_OPENCL_INCLUDE_DIR}/../../../..
|
||||
${AMD_OPENCL_INCLUDE_DIR}/../../../../amdocl)
|
||||
mark_as_advanced(AMD_OPENCL_INCLUDE_DIRS)
|
||||
@@ -0,0 +1,68 @@
|
||||
# Copyright (c) 2020-2021 Advanced Micro Devices, Inc. All rights reserved.
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documentation files (the "Software"), to deal
|
||||
# in 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:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in
|
||||
# all copies or substantial portions of the Software.
|
||||
#
|
||||
# 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
|
||||
# AUTHORS 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 IN
|
||||
# THE SOFTWARE.
|
||||
|
||||
if(AMD_PAL_FOUND)
|
||||
return()
|
||||
endif()
|
||||
|
||||
find_path(AMD_ASIC_REG_INCLUDE_DIR nv_id.h
|
||||
HINTS
|
||||
${AMD_DRIVERS_PATH}
|
||||
PATHS
|
||||
# p4 repo layout
|
||||
${CMAKE_SOURCE_DIR}/drivers
|
||||
${CMAKE_SOURCE_DIR}/../drivers
|
||||
${CMAKE_SOURCE_DIR}/../../drivers
|
||||
# github ent repo layout
|
||||
${CMAKE_SOURCE_DIR}/drivers/drivers
|
||||
${CMAKE_SOURCE_DIR}/../drivers/drivers
|
||||
${CMAKE_SOURCE_DIR}/../../drivers/drivers
|
||||
PATH_SUFFIXES
|
||||
inc/asic_reg)
|
||||
|
||||
find_path(AMD_HSAIL_INCLUDE_DIR hsa.h
|
||||
HINTS
|
||||
${AMD_SC_PATH}
|
||||
PATHS
|
||||
${CMAKE_SOURCE_DIR}/sc
|
||||
${CMAKE_SOURCE_DIR}/../sc
|
||||
${CMAKE_SOURCE_DIR}/../../sc
|
||||
PATH_SUFFIXES
|
||||
HSAIL/include)
|
||||
|
||||
find_path(AMD_PAL_INCLUDE_DIR pal.h
|
||||
HINTS
|
||||
${AMD_PAL_PATH}
|
||||
PATHS
|
||||
${CMAKE_SOURCE_DIR}/pal
|
||||
${CMAKE_SOURCE_DIR}/../pal
|
||||
${CMAKE_SOURCE_DIR}/../../pal
|
||||
PATH_SUFFIXES
|
||||
inc/core)
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
find_package_handle_standard_args(AMD_PAL
|
||||
"\nPAL not found"
|
||||
AMD_ASIC_REG_INCLUDE_DIR AMD_HSAIL_INCLUDE_DIR AMD_PAL_INCLUDE_DIR)
|
||||
mark_as_advanced(AMD_ASIC_REG_INCLUDE_DIR AMD_HSAIL_INCLUDE_DIR AMD_PAL_INCLUDE_DIR)
|
||||
|
||||
set(GLOBAL_ROOT_SRC_DIR "${AMD_ASIC_REG_INCLUDE_DIR}/../../..")
|
||||
set(PAL_SC_PATH "${AMD_HSAIL_INCLUDE_DIR}/../..")
|
||||
add_subdirectory("${AMD_PAL_INCLUDE_DIR}/../.." ${CMAKE_CURRENT_BINARY_DIR}/pal)
|
||||
@@ -1,4 +1,4 @@
|
||||
# Copyright (C) 2017-2021 Advanced Micro Devices, Inc. All Rights Reserved.
|
||||
# Copyright (c) 2020-2021 Advanced Micro Devices, Inc. All rights reserved.
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documentation files (the "Software"), to deal
|
||||
@@ -18,19 +18,29 @@
|
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
# THE SOFTWARE.
|
||||
|
||||
# Try to find ROCR (Radeon Open Compute Runtime)
|
||||
#
|
||||
# Once found, this will define:
|
||||
# - ROCR_FOUND - ROCR status (found or not found)
|
||||
# - ROCR_INCLUDES - Required ROCR include directories
|
||||
# - ROCR_LIBRARIES - Required ROCR libraries
|
||||
find_path(FIND_ROCR_INCLUDES hsa.h HINTS /opt/rocm/include /opt/rocm/hsa/include PATH_SUFFIXES hsa)
|
||||
find_library(FIND_ROCR_LIBRARIES hsa-runtime64 HINTS /opt/rocm/lib /opt/rocm/hsa/lib)
|
||||
if(AMD_UGL_FOUND)
|
||||
return()
|
||||
endif()
|
||||
|
||||
find_path(AMD_UGL_INCLUDE_DIR GL/glx.h
|
||||
HINTS
|
||||
${AMD_UGL_PATH}
|
||||
PATHS
|
||||
# p4 repo layout
|
||||
${CMAKE_SOURCE_DIR}/drivers/ugl/inc
|
||||
${CMAKE_SOURCE_DIR}/../drivers/ugl/inc
|
||||
${CMAKE_SOURCE_DIR}/../../drivers/ugl/inc
|
||||
# github ent repo layout
|
||||
${CMAKE_SOURCE_DIR}/drivers/drivers/ugl/inc
|
||||
${CMAKE_SOURCE_DIR}/../drivers/drivers/ugl/inc
|
||||
${CMAKE_SOURCE_DIR}/../../drivers/drivers/ugl/inc
|
||||
NO_DEFAULT_PATH)
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
find_package_handle_standard_args(ROCR DEFAULT_MSG
|
||||
FIND_ROCR_INCLUDES FIND_ROCR_LIBRARIES)
|
||||
mark_as_advanced(FIND_ROCR_INCLUDES FIND_ROCR_LIBRARIES)
|
||||
find_package_handle_standard_args(AMD_UGL
|
||||
"\nAMD UGL not found"
|
||||
AMD_UGL_INCLUDE_DIR)
|
||||
mark_as_advanced(AMD_UGL_INCLUDE_DIR)
|
||||
|
||||
set(ROCR_INCLUDES ${FIND_ROCR_INCLUDES})
|
||||
set(ROCR_LIBRARIES ${FIND_ROCR_LIBRARIES})
|
||||
set(AMD_UGL_INCLUDE_DIRS ${AMD_UGL_INCLUDE_DIR} ${ROCCLR_SRC_DIR}/device/gpu/gslbe/src/rt)
|
||||
mark_as_advanced(AMD_UGL_INCLUDE_DIRS)
|
||||
@@ -0,0 +1,132 @@
|
||||
# Copyright (c) 2020-2021 Advanced Micro Devices, Inc. All rights reserved.
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documentation files (the "Software"), to deal
|
||||
# in 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:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in
|
||||
# all copies or substantial portions of the Software.
|
||||
#
|
||||
# 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
|
||||
# AUTHORS 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 IN
|
||||
# THE SOFTWARE.
|
||||
|
||||
cmake_minimum_required(VERSION 3.5)
|
||||
|
||||
# ROCclr abstracts the usage of multiple AMD compilers and runtimes.
|
||||
# It is possible to support multiple backends concurrently in the same binary.
|
||||
option(ROCCLR_ENABLE_HSAIL "Enable support for HSAIL compiler" OFF)
|
||||
option(ROCCLR_ENABLE_LC "Enable support for LC compiler" ON)
|
||||
option(ROCCLR_ENABLE_HSA "Enable support for HSA runtime" ON)
|
||||
option(ROCCLR_ENABLE_PAL "Enable support for PAL runtime" OFF)
|
||||
|
||||
if((NOT ROCCLR_ENABLE_HSAIL) AND (NOT ROCCLR_ENABLE_LC))
|
||||
message(FATAL "Support for at least one compiler needs to be enabled!")
|
||||
endif()
|
||||
|
||||
if((NOT ROCCLR_ENABLE_HSA) AND (NOT ROCCLR_ENABLE_PAL))
|
||||
message(FATAL "Support for at least one runtime needs to be enabled!")
|
||||
endif()
|
||||
|
||||
set(THREADS_PREFER_PTHREAD_FLAG ON)
|
||||
find_package(Threads REQUIRED)
|
||||
|
||||
find_package(AMD_OPENCL)
|
||||
|
||||
add_library(rocclr STATIC)
|
||||
|
||||
set(ROCCLR_SRC_DIR "${CMAKE_CURRENT_LIST_DIR}/..")
|
||||
mark_as_advanced(ROCCLR_SRC_DIR)
|
||||
|
||||
set_target_properties(rocclr PROPERTIES
|
||||
CXX_STANDARD 14
|
||||
CXX_STANDARD_REQUIRED ON
|
||||
CXX_EXTENSIONS OFF
|
||||
POSITION_INDEPENDENT_CODE ON)
|
||||
|
||||
target_sources(rocclr PRIVATE
|
||||
${ROCCLR_SRC_DIR}/compiler/lib/utils/options.cpp
|
||||
${ROCCLR_SRC_DIR}/device/appprofile.cpp
|
||||
${ROCCLR_SRC_DIR}/device/blit.cpp
|
||||
${ROCCLR_SRC_DIR}/device/blitcl.cpp
|
||||
${ROCCLR_SRC_DIR}/device/comgrctx.cpp
|
||||
${ROCCLR_SRC_DIR}/device/devhcmessages.cpp
|
||||
${ROCCLR_SRC_DIR}/device/devhcprintf.cpp
|
||||
${ROCCLR_SRC_DIR}/device/devhostcall.cpp
|
||||
${ROCCLR_SRC_DIR}/device/device.cpp
|
||||
${ROCCLR_SRC_DIR}/device/devkernel.cpp
|
||||
${ROCCLR_SRC_DIR}/device/devprogram.cpp
|
||||
${ROCCLR_SRC_DIR}/device/devwavelimiter.cpp
|
||||
${ROCCLR_SRC_DIR}/device/hsailctx.cpp
|
||||
${ROCCLR_SRC_DIR}/device/hwdebug.cpp
|
||||
${ROCCLR_SRC_DIR}/elf/elf.cpp
|
||||
${ROCCLR_SRC_DIR}/os/alloc.cpp
|
||||
${ROCCLR_SRC_DIR}/os/os_posix.cpp
|
||||
${ROCCLR_SRC_DIR}/os/os_win32.cpp
|
||||
${ROCCLR_SRC_DIR}/os/os.cpp
|
||||
${ROCCLR_SRC_DIR}/platform/activity.cpp
|
||||
${ROCCLR_SRC_DIR}/platform/agent.cpp
|
||||
${ROCCLR_SRC_DIR}/platform/command.cpp
|
||||
${ROCCLR_SRC_DIR}/platform/commandqueue.cpp
|
||||
${ROCCLR_SRC_DIR}/platform/context.cpp
|
||||
${ROCCLR_SRC_DIR}/platform/kernel.cpp
|
||||
${ROCCLR_SRC_DIR}/platform/memory.cpp
|
||||
${ROCCLR_SRC_DIR}/platform/ndrange.cpp
|
||||
${ROCCLR_SRC_DIR}/platform/program.cpp
|
||||
${ROCCLR_SRC_DIR}/platform/runtime.cpp
|
||||
${ROCCLR_SRC_DIR}/thread/monitor.cpp
|
||||
${ROCCLR_SRC_DIR}/thread/semaphore.cpp
|
||||
${ROCCLR_SRC_DIR}/thread/thread.cpp
|
||||
${ROCCLR_SRC_DIR}/utils/debug.cpp
|
||||
${ROCCLR_SRC_DIR}/utils/flags.cpp)
|
||||
|
||||
if(WIN32)
|
||||
target_compile_definitions(rocclr PUBLIC ATI_OS_WIN)
|
||||
else()
|
||||
target_compile_definitions(rocclr PUBLIC ATI_OS_LINUX)
|
||||
endif()
|
||||
|
||||
target_compile_definitions(rocclr PUBLIC
|
||||
ATI_ARCH_X86
|
||||
LITTLEENDIAN_CPU
|
||||
WITH_LIQUID_FLASH=0
|
||||
${AMD_OPENCL_DEFS})
|
||||
|
||||
target_include_directories(rocclr PUBLIC
|
||||
${ROCCLR_SRC_DIR}
|
||||
${ROCCLR_SRC_DIR}/compiler/lib
|
||||
${ROCCLR_SRC_DIR}/compiler/lib/include
|
||||
${ROCCLR_SRC_DIR}/compiler/lib/backends/common
|
||||
${ROCCLR_SRC_DIR}/device
|
||||
${ROCCLR_SRC_DIR}/elf
|
||||
${ROCCLR_SRC_DIR}/include
|
||||
${AMD_OPENCL_INCLUDE_DIRS})
|
||||
|
||||
target_link_libraries(rocclr PUBLIC Threads::Threads)
|
||||
# IPC on Windows is not supported
|
||||
if(UNIX)
|
||||
target_link_libraries(rocclr PUBLIC rt)
|
||||
endif()
|
||||
|
||||
if(ROCCLR_ENABLE_HSAIL)
|
||||
include(ROCclrHSAIL)
|
||||
endif()
|
||||
|
||||
if(ROCCLR_ENABLE_LC)
|
||||
include(ROCclrLC)
|
||||
endif()
|
||||
|
||||
if(ROCCLR_ENABLE_HSA)
|
||||
include(ROCclrHSA)
|
||||
endif()
|
||||
|
||||
if(ROCCLR_ENABLE_PAL)
|
||||
include(ROCclrPAL)
|
||||
endif()
|
||||
@@ -0,0 +1,51 @@
|
||||
# Copyright (c) 2020-2021 Advanced Micro Devices, Inc. All rights reserved.
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documentation files (the "Software"), to deal
|
||||
# in 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:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in
|
||||
# all copies or substantial portions of the Software.
|
||||
#
|
||||
# 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
|
||||
# AUTHORS 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 IN
|
||||
# THE SOFTWARE.
|
||||
|
||||
find_package(hsa-runtime64 1.3 REQUIRED CONFIG
|
||||
PATHS
|
||||
/opt/rocm/
|
||||
PATH_SUFFIXES
|
||||
cmake/hsa-runtime64
|
||||
lib/cmake/hsa-runtime64
|
||||
lib64/cmake/hsa-runtime64)
|
||||
target_link_libraries(rocclr PUBLIC hsa-runtime64::hsa-runtime64)
|
||||
|
||||
find_package(NUMA QUIET)
|
||||
if(NUMA_FOUND)
|
||||
target_compile_definitions(rocclr PUBLIC ROCCLR_SUPPORT_NUMA_POLICY)
|
||||
target_link_libraries(rocclr PUBLIC NUMA)
|
||||
endif()
|
||||
|
||||
target_sources(rocclr PRIVATE
|
||||
${ROCCLR_SRC_DIR}/device/rocm/rocappprofile.cpp
|
||||
${ROCCLR_SRC_DIR}/device/rocm/rocblit.cpp
|
||||
${ROCCLR_SRC_DIR}/device/rocm/roccounters.cpp
|
||||
${ROCCLR_SRC_DIR}/device/rocm/rocdevice.cpp
|
||||
${ROCCLR_SRC_DIR}/device/rocm/rocglinterop.cpp
|
||||
${ROCCLR_SRC_DIR}/device/rocm/rockernel.cpp
|
||||
${ROCCLR_SRC_DIR}/device/rocm/rocmemory.cpp
|
||||
${ROCCLR_SRC_DIR}/device/rocm/rocprintf.cpp
|
||||
${ROCCLR_SRC_DIR}/device/rocm/rocprogram.cpp
|
||||
${ROCCLR_SRC_DIR}/device/rocm/rocschedcl.cpp
|
||||
${ROCCLR_SRC_DIR}/device/rocm/rocsettings.cpp
|
||||
${ROCCLR_SRC_DIR}/device/rocm/rocsignal.cpp
|
||||
${ROCCLR_SRC_DIR}/device/rocm/rocvirtual.cpp)
|
||||
|
||||
target_compile_definitions(rocclr PUBLIC WITH_HSA_DEVICE)
|
||||
@@ -1,4 +1,4 @@
|
||||
# Copyright (C) 2017-2021 Advanced Micro Devices, Inc. All Rights Reserved.
|
||||
# Copyright (c) 2020-2021 Advanced Micro Devices, Inc. All rights reserved.
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documentation files (the "Software"), to deal
|
||||
@@ -18,10 +18,4 @@
|
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
# THE SOFTWARE.
|
||||
|
||||
@ROCCLR_PREFIX_CODE@
|
||||
|
||||
include( CMakeFindDependencyMacro )
|
||||
find_dependency(hsa-runtime64)
|
||||
find_dependency(amd_comgr)
|
||||
message(STATUS "ROCclr at ${ROCclr_DIR}")
|
||||
include("${ROCclr_DIR}/@ROCCLR_TARGETS_NAME@")
|
||||
target_compile_definitions(rocclr PUBLIC WITH_COMPILER_LIB HSAIL_DYN_DLL)
|
||||
@@ -1,4 +1,4 @@
|
||||
# Copyright (C) 2019-2021 Advanced Micro Devices, Inc. All Rights Reserved.
|
||||
# Copyright (c) 2020-2021 Advanced Micro Devices, Inc. All rights reserved.
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documentation files (the "Software"), to deal
|
||||
@@ -18,19 +18,15 @@
|
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
# THE SOFTWARE.
|
||||
|
||||
# Try to find ROCT (Radeon Open Compute Thunk)
|
||||
#
|
||||
# Once found, this will define:
|
||||
# - ROCT_FOUND - ROCT status (found or not found)
|
||||
# - ROCT_INCLUDES - Required ROCT include directories
|
||||
# - ROCT_LIBRARIES - Required ROCT libraries
|
||||
find_path(FIND_ROCT_INCLUDES hsakmt.h HINTS /opt/rocm/include)
|
||||
find_library(FIND_ROCT_LIBRARIES hsakmt HINTS /opt/rocm/lib)
|
||||
find_package(amd_comgr REQUIRED CONFIG
|
||||
PATHS
|
||||
/opt/rocm/
|
||||
PATH_SUFFIXES
|
||||
cmake/amd_comgr
|
||||
lib/cmake/amd_comgr)
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
find_package_handle_standard_args(ROCT DEFAULT_MSG
|
||||
FIND_ROCT_INCLUDES FIND_ROCT_LIBRARIES)
|
||||
mark_as_advanced(FIND_ROCT_INCLUDES FIND_ROCT_LIBRARIES)
|
||||
|
||||
set(ROCT_INCLUDES ${FIND_ROCT_INCLUDES})
|
||||
set(ROCT_LIBRARIES ${FIND_ROCT_LIBRARIES})
|
||||
target_compile_definitions(rocclr PUBLIC WITH_LIGHTNING_COMPILER USE_COMGR_LIBRARY)
|
||||
if(BUILD_SHARED_LIBS)
|
||||
target_compile_definitions(rocclr PUBLIC COMGR_DYN_DLL)
|
||||
endif()
|
||||
target_link_libraries(rocclr PUBLIC amd_comgr)
|
||||
@@ -0,0 +1,82 @@
|
||||
# Copyright (c) 2020-2021 Advanced Micro Devices, Inc. All rights reserved.
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documentation files (the "Software"), to deal
|
||||
# in 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:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in
|
||||
# all copies or substantial portions of the Software.
|
||||
#
|
||||
# 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
|
||||
# AUTHORS 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 IN
|
||||
# THE SOFTWARE.
|
||||
|
||||
file(STRINGS palcdefs PAL_MAJOR_VERSION REGEX "^PAL_MAJOR_VERSION = [0-9]+")
|
||||
string(REGEX REPLACE "PAL_MAJOR_VERSION = " "" PAL_MAJOR_VERSION ${PAL_MAJOR_VERSION})
|
||||
|
||||
file(STRINGS palcdefs GPUOPEN_MAJOR_VERSION REGEX "^GPUOPEN_MAJOR_VERSION = [0-9]+")
|
||||
string(REGEX REPLACE "GPUOPEN_MAJOR_VERSION = " "" GPUOPEN_MAJOR_VERSION ${GPUOPEN_MAJOR_VERSION})
|
||||
|
||||
set(PAL_CLIENT "OCL")
|
||||
|
||||
set(PAL_CLIENT_INTERFACE_MAJOR_VERSION ${PAL_MAJOR_VERSION})
|
||||
set(GPUOPEN_CLIENT_INTERFACE_MAJOR_VERSION ${GPUOPEN_MAJOR_VERSION})
|
||||
set(GPUOPEN_CLIENT_INTERFACE_MINOR_VERSION 0)
|
||||
|
||||
set(PAL_CLOSED_SOURCE ON)
|
||||
set(PAL_DEVELOPER_BUILD OFF)
|
||||
set(PAL_BUILD_GPUOPEN ON)
|
||||
set(PAL_BUILD_SCPC OFF)
|
||||
set(PAL_BUILD_VIDEO OFF)
|
||||
set(PAL_BUILD_DTIF OFF)
|
||||
set(PAL_BUILD_OSS ON)
|
||||
set(PAL_BUILD_SECURITY OFF)
|
||||
set(PAL_SPPAP_CLOSED_SOURCE OFF)
|
||||
set(PAL_BUILD_GFX ON)
|
||||
set(PAL_BUILD_NULL_DEVICE OFF)
|
||||
set(PAL_BUILD_GFX6 ON)
|
||||
set(PAL_BUILD_GFX9 ON)
|
||||
|
||||
find_package(AMD_PAL)
|
||||
find_package(AMD_HSA_LOADER)
|
||||
find_package(AMD_UGL)
|
||||
|
||||
target_sources(rocclr PRIVATE
|
||||
${ROCCLR_SRC_DIR}/device/pal/palappprofile.cpp
|
||||
${ROCCLR_SRC_DIR}/device/pal/palblit.cpp
|
||||
${ROCCLR_SRC_DIR}/device/pal/palconstbuf.cpp
|
||||
${ROCCLR_SRC_DIR}/device/pal/palcounters.cpp
|
||||
${ROCCLR_SRC_DIR}/device/pal/paldebugmanager.cpp
|
||||
${ROCCLR_SRC_DIR}/device/pal/paldevice.cpp
|
||||
${ROCCLR_SRC_DIR}/device/pal/paldeviced3d10.cpp
|
||||
${ROCCLR_SRC_DIR}/device/pal/paldeviced3d11.cpp
|
||||
${ROCCLR_SRC_DIR}/device/pal/paldeviced3d9.cpp
|
||||
${ROCCLR_SRC_DIR}/device/pal/paldevicegl.cpp
|
||||
${ROCCLR_SRC_DIR}/device/pal/palgpuopen.cpp
|
||||
${ROCCLR_SRC_DIR}/device/pal/palkernel.cpp
|
||||
${ROCCLR_SRC_DIR}/device/pal/palmemory.cpp
|
||||
${ROCCLR_SRC_DIR}/device/pal/palprintf.cpp
|
||||
${ROCCLR_SRC_DIR}/device/pal/palprogram.cpp
|
||||
${ROCCLR_SRC_DIR}/device/pal/palresource.cpp
|
||||
${ROCCLR_SRC_DIR}/device/pal/palschedcl.cpp
|
||||
${ROCCLR_SRC_DIR}/device/pal/palsettings.cpp
|
||||
${ROCCLR_SRC_DIR}/device/pal/palsignal.cpp
|
||||
${ROCCLR_SRC_DIR}/device/pal/palthreadtrace.cpp
|
||||
${ROCCLR_SRC_DIR}/device/pal/paltimestamp.cpp
|
||||
${ROCCLR_SRC_DIR}/device/pal/palvirtual.cpp)
|
||||
|
||||
target_compile_definitions(rocclr PUBLIC WITH_PAL_DEVICE PAL_GPUOPEN_OCL)
|
||||
target_include_directories(rocclr PUBLIC ${AMD_UGL_INCLUDE_DIRS})
|
||||
target_link_libraries(rocclr PUBLIC pal amdhsaloader)
|
||||
|
||||
# support for OGL/D3D interop
|
||||
if(WIN32)
|
||||
target_link_libraries(rocclr PUBLIC opengl32.lib dxguid.lib)
|
||||
endif()
|
||||
@@ -1,59 +0,0 @@
|
||||
# Copyright (C) 2017-2021 Advanced Micro Devices, Inc. All Rights Reserved.
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documentation files (the "Software"), to deal
|
||||
# in 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:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in
|
||||
# all copies or substantial portions of the Software.
|
||||
#
|
||||
# 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
|
||||
# AUTHORS 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 IN
|
||||
# THE SOFTWARE.
|
||||
|
||||
file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/bc2h.c
|
||||
"#include <stdio.h>\n"
|
||||
"int main(int argc, char **argv){\n"
|
||||
" FILE *ifp, *ofp;\n"
|
||||
" int c, i, l;\n"
|
||||
" if (argc != 4) return 1;\n"
|
||||
" ifp = fopen(argv[1], \"rb\");\n"
|
||||
" if (!ifp) return 1;\n"
|
||||
" i = fseek(ifp, 0, SEEK_END);\n"
|
||||
" if (i < 0) return 1;\n"
|
||||
" l = ftell(ifp);\n"
|
||||
" if (l < 0) return 1;\n"
|
||||
" i = fseek(ifp, 0, SEEK_SET);\n"
|
||||
" if (i < 0) return 1;\n"
|
||||
" ofp = fopen(argv[2], \"wb+\");\n"
|
||||
" if (!ofp) return 1;\n"
|
||||
" fprintf(ofp, \"#define %s_size %d\\n\\n\"\n"
|
||||
" \"#if defined __GNUC__\\n\"\n"
|
||||
" \"__attribute__((aligned (4096)))\\n\"\n"
|
||||
" \"#elif defined _MSC_VER\\n\"\n"
|
||||
" \"__declspec(align(4096))\\n\"\n"
|
||||
" \"#endif\\n\"\n"
|
||||
" \"static const unsigned char %s[%s_size+1] = {\",\n"
|
||||
" argv[3], l,\n"
|
||||
" argv[3], argv[3]);\n"
|
||||
" i = 0;\n"
|
||||
" while ((c = getc(ifp)) != EOF) {\n"
|
||||
" if (0 == (i&7)) fprintf(ofp, \"\\n \");\n"
|
||||
" fprintf(ofp, \" 0x%02x,\", c);\n"
|
||||
" ++i;\n"
|
||||
" }\n"
|
||||
" fprintf(ofp, \" 0x00\\n};\\n\\n\");\n"
|
||||
" fclose(ifp);\n"
|
||||
" fclose(ofp);\n"
|
||||
" return 0;\n"
|
||||
"}\n"
|
||||
)
|
||||
|
||||
add_executable(bc2h ${CMAKE_CURRENT_BINARY_DIR}/bc2h.c)
|
||||
@@ -1,164 +0,0 @@
|
||||
# Copyright (C) 2020-2021 Advanced Micro Devices, Inc. All Rights Reserved.
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documentation files (the "Software"), to deal
|
||||
# in 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:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in
|
||||
# all copies or substantial portions of the Software.
|
||||
#
|
||||
# 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
|
||||
# AUTHORS 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 IN
|
||||
# THE SOFTWARE.
|
||||
|
||||
###
|
||||
file(STRINGS palcdefs PAL_MAJOR_VERSION REGEX "^PAL_MAJOR_VERSION = [0-9]+")
|
||||
string(REGEX REPLACE "PAL_MAJOR_VERSION = " "" PAL_MAJOR_VERSION ${PAL_MAJOR_VERSION})
|
||||
|
||||
file(STRINGS palcdefs GPUOPEN_MAJOR_VERSION REGEX "^GPUOPEN_MAJOR_VERSION = [0-9]+")
|
||||
string(REGEX REPLACE "GPUOPEN_MAJOR_VERSION = " "" GPUOPEN_MAJOR_VERSION ${GPUOPEN_MAJOR_VERSION})
|
||||
|
||||
### Create PAL backend library for ROCclr
|
||||
add_library(rocclrpal OBJECT "")
|
||||
|
||||
# Add defines necessary for PAL build
|
||||
set(PAL_CLIENT_INTERFACE_MAJOR_VERSION ${PAL_MAJOR_VERSION}
|
||||
CACHE STRING "PAL major interface: ${PAL_MAJOR_VERSION}" FORCE)
|
||||
set(GPUOPEN_CLIENT_INTERFACE_MAJOR_VERSION ${GPUOPEN_MAJOR_VERSION}
|
||||
CACHE STRING "GPU open major interface: ${GPUOPEN_MAJOR_VERSION}" FORCE)
|
||||
set(GPUOPEN_CLIENT_INTERFACE_MINOR_VERSION "0" CACHE STRING "GPU open minor interface: 0" FORCE)
|
||||
|
||||
set(PAL_CLIENT "OCL" CACHE STRING "Build PAL OCL support" FORCE)
|
||||
|
||||
set(PAL_BUILD_GPUOPEN ON CACHE BOOL "Build GPUOpen support")
|
||||
set(PAL_BUILD_VIDEO OFF CACHE BOOL "Don't build PAL with Video support")
|
||||
set(PAL_BUILD_SCPC OFF CACHE BOOL "Don't build SCPC")
|
||||
|
||||
set(PAL_CLOSED_SOURCE ON CACHE BOOL "Build closed source PAL")
|
||||
|
||||
set(PAL_BUILD_POLARIS22 ON CACHE BOOL "Build PAL with Polaris support")
|
||||
set(PAL_BUILD_GFX9 ON CACHE BOOL "Build PAL with GFX9 support")
|
||||
set(PAL_BUILD_OSS4 ON CACHE BOOL "Build PAL with OSS4 support")
|
||||
set(PAL_BUILD_VEGA12 ON CACHE BOOL "Build PAL with VEGA12 support")
|
||||
set(PAL_BUILD_VEGA20 ON CACHE BOOL "Build PAL with GFX9 support")
|
||||
set(PAL_BUILD_RAVEN1 ON CACHE BOOL "Build PAL with Raven1 support")
|
||||
set(PAL_BUILD_RAVEN2 ON CACHE BOOL "Build PAL with Raven2 support")
|
||||
set(PAL_BUILD_RENOIR ON CACHE BOOL "Build PAL with Renoir support")
|
||||
|
||||
set(PAL_BUILD_GFX10 ON CACHE BOOL "Build PAL with GFX10 support")
|
||||
set(PAL_BUILD_NAVI12 ON CACHE BOOL "Build PAL with Navi12 support")
|
||||
set(PAL_BUILD_NAVI14 ON CACHE BOOL "Build PAL with Navi14 support")
|
||||
|
||||
option(PAL_DEVELOPER_BUILD "No developer build" OFF)
|
||||
|
||||
set(PYTHON_EXECUTABLE /usr/bin/python3)
|
||||
|
||||
# Build PAL . . .
|
||||
set(GLOBAL_ROOT_SRC_DIR ${CMAKE_CURRENT_SOURCE_DIR})
|
||||
add_subdirectory(palbe)
|
||||
|
||||
# Setup defines for the client compilation
|
||||
target_compile_definitions(rocclrpal PRIVATE
|
||||
PAL_CLIENT_INTERFACE_MAJOR_VERSION=${PAL_CLIENT_INTERFACE_MAJOR_VERSION})
|
||||
target_compile_definitions(rocclrpal PRIVATE
|
||||
GPUOPEN_CLIENT_INTERFACE_MAJOR_VERSION=${GPUOPEN_CLIENT_INTERFACE_MAJOR_VERSION})
|
||||
target_compile_definitions(rocclrpal PRIVATE
|
||||
GPUOPEN_CLIENT_INTERFACE_MINOR_VERSION=${GPUOPEN_CLIENT_INTERFACE_MINOR_VERSION})
|
||||
|
||||
target_compile_definitions(rocclrpal PRIVATE PAL_CLIENT_OCL=1)
|
||||
target_compile_definitions(rocclrpal PRIVATE PAL_GPUOPEN_OCL=1)
|
||||
target_compile_definitions(rocclrpal PRIVATE PAL_BUILD_GPUOPEN=1)
|
||||
target_compile_definitions(rocclrpal PRIVATE PAL_BUILD_SCPC=0)
|
||||
target_compile_definitions(rocclrpal PRIVATE PAL_CLOSED_SOURCE=1)
|
||||
target_compile_definitions(rocclrpal PRIVATE PAL_BUILD_GPUOPEN=1)
|
||||
|
||||
# GFX9 targets
|
||||
target_compile_definitions(rocclrpal PRIVATE PAL_BUILD_POLARIS22=1)
|
||||
target_compile_definitions(rocclrpal PRIVATE PAL_BUILD_GFX9=1)
|
||||
target_compile_definitions(rocclrpal PRIVATE PAL_BUILD_OSS4=1)
|
||||
target_compile_definitions(rocclrpal PRIVATE PAL_BUILD_VEGA12=1)
|
||||
target_compile_definitions(rocclrpal PRIVATE PAL_BUILD_VEGA20=1)
|
||||
target_compile_definitions(rocclrpal PRIVATE PAL_BUILD_RAVEN1=1)
|
||||
target_compile_definitions(rocclrpal PRIVATE PAL_BUILD_RAVEN2=1)
|
||||
target_compile_definitions(rocclrpal PRIVATE PAL_BUILD_RENOIR=1)
|
||||
|
||||
# GFX10 targets
|
||||
target_compile_definitions(rocclrpal PRIVATE PAL_BUILD_GFX10=1)
|
||||
target_compile_definitions(rocclrpal PRIVATE PAL_BUILD_NAVI12=1)
|
||||
target_compile_definitions(rocclrpal PRIVATE PAL_BUILD_NAVI14=1)
|
||||
|
||||
target_compile_definitions(rocclrpal PRIVATE OPENCL_MAINLINE=1)
|
||||
|
||||
if(${USE_COMGR_LIBRARY} MATCHES "yes")
|
||||
target_compile_definitions(rocclrpal PRIVATE USE_COMGR_LIBRARY)
|
||||
endif()
|
||||
|
||||
if(UNIX)
|
||||
target_compile_definitions(rocclrpal PRIVATE PAL_AMDGPU_BUILD)
|
||||
endif()
|
||||
|
||||
target_include_directories(rocclrpal PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/compiler/sc/HSAIL/include)
|
||||
target_include_directories(rocclrpal PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/../asic_reg)
|
||||
|
||||
target_include_directories(rocclrpal PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/device/pal/palbe)
|
||||
target_include_directories(rocclrpal PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/device/pal/palbe/inc)
|
||||
target_include_directories(rocclrpal PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/device/pal/palbe/inc/core)
|
||||
target_include_directories(rocclrpal PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/device/pal/palbe/inc/util)
|
||||
target_include_directories(rocclrpal PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/device/pal/palbe/shared/gpuopen/inc)
|
||||
target_include_directories(rocclrpal PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/device/pal/palbe/shared/gpuopen/third_party/metrohash/src)
|
||||
target_include_directories(rocclrpal PRIVATE ${CMAKE_CURRENT_BINARY_DIR})
|
||||
|
||||
target_include_directories(rocclrpal
|
||||
PUBLIC
|
||||
$<INSTALL_INTERFACE:include>
|
||||
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}>
|
||||
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include>
|
||||
# GL and EGL headers
|
||||
$<BUILD_INTERFACE:${OPENCL_DIR}/khronos/headers>
|
||||
$<BUILD_INTERFACE:${OPENCL_DIR}/khronos/headers/opencl2.2>
|
||||
$<TARGET_PROPERTY:amd_comgr,INTERFACE_INCLUDE_DIRECTORIES>
|
||||
PRIVATE
|
||||
${OPENCL_DIR}
|
||||
${PROJECT_SOURCE_DIR}/compiler/lib
|
||||
${PROJECT_SOURCE_DIR}/compiler/lib/include
|
||||
${PROJECT_SOURCE_DIR}/compiler/lib/backends/common
|
||||
${CMAKE_CURRENT_BINARY_DIR}
|
||||
${ROCM_OCL_INCLUDES}
|
||||
${ROCR_INCLUDES})
|
||||
|
||||
|
||||
target_sources(rocclrpal PRIVATE
|
||||
palappprofile.cpp
|
||||
palblit.cpp
|
||||
palconstbuf.cpp
|
||||
palcounters.cpp
|
||||
paldebugmanager.cpp
|
||||
paldevice.cpp
|
||||
paldeviced3d10.cpp
|
||||
paldeviced3d11.cpp
|
||||
paldeviced3d9.cpp
|
||||
paldevicegl.cpp
|
||||
palgpuopen.cpp
|
||||
palkernel.cpp
|
||||
palmemory.cpp
|
||||
palprintf.cpp
|
||||
palprogram.cpp
|
||||
palresource.cpp
|
||||
palschedcl.cpp
|
||||
palsettings.cpp
|
||||
palsignal.cpp
|
||||
palthreadtrace.cpp
|
||||
paltimestamp.cpp
|
||||
palvirtual.cpp
|
||||
)
|
||||
|
||||
set_target_properties(rocclrpal PROPERTIES POSITION_INDEPENDENT_CODE ON)
|
||||
|
||||
|
||||
@@ -1,72 +0,0 @@
|
||||
# Copyright (C) 2017-2021 Advanced Micro Devices, Inc. All Rights Reserved.
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documentation files (the "Software"), to deal
|
||||
# in 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:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in
|
||||
# all copies or substantial portions of the Software.
|
||||
#
|
||||
# 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
|
||||
# AUTHORS 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 IN
|
||||
# THE SOFTWARE.
|
||||
|
||||
add_library(oclrocm OBJECT
|
||||
roccounters.cpp
|
||||
rocprintf.cpp
|
||||
rocprogram.cpp
|
||||
rocmemory.cpp
|
||||
rocdevice.cpp
|
||||
rocblit.cpp
|
||||
rockernel.cpp
|
||||
rocvirtual.cpp
|
||||
rocglinterop.cpp
|
||||
rocappprofile.cpp
|
||||
rocsettings.cpp
|
||||
rocschedcl.cpp
|
||||
rocsignal.cpp
|
||||
)
|
||||
|
||||
target_include_directories(oclrocm
|
||||
PUBLIC
|
||||
$<INSTALL_INTERFACE:include>
|
||||
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}>
|
||||
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include>
|
||||
# GL and EGL headers
|
||||
$<BUILD_INTERFACE:${OPENCL_DIR}/khronos/headers>
|
||||
$<BUILD_INTERFACE:${OPENCL_DIR}/khronos/headers/opencl2.2>
|
||||
$<TARGET_PROPERTY:amd_comgr,INTERFACE_INCLUDE_DIRECTORIES>
|
||||
PRIVATE
|
||||
${OPENCL_DIR}
|
||||
${PROJECT_SOURCE_DIR}/compiler/lib
|
||||
${PROJECT_SOURCE_DIR}/compiler/lib/backends/common
|
||||
${PROJECT_SOURCE_DIR}/elf
|
||||
${CMAKE_CURRENT_BINARY_DIR}
|
||||
${ROCM_OCL_INCLUDES}
|
||||
$<TARGET_PROPERTY:hsa-runtime64::hsa-runtime64,INTERFACE_INCLUDE_DIRECTORIES>)
|
||||
|
||||
|
||||
if(USE_COMGR_LIBRARY)
|
||||
if(${BUILD_SHARED_LIBS})
|
||||
target_compile_definitions(oclrocm PRIVATE USE_COMGR_LIBRARY COMGR_DYN_DLL)
|
||||
else()
|
||||
target_compile_definitions(oclrocm PRIVATE USE_COMGR_LIBRARY)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if (UNIX)
|
||||
find_library(LIBNUMA numa)
|
||||
if (LIBNUMA)
|
||||
target_compile_definitions(oclrocm PRIVATE ROCCLR_SUPPORT_NUMA_POLICY)
|
||||
message(STATUS "Found: ${LIBNUMA}")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
set_target_properties(oclrocm PROPERTIES POSITION_INDEPENDENT_CODE ON)
|
||||
Tagairt in Eagrán Nua
Cuir bac ar úsáideoir