-
Notifications
You must be signed in to change notification settings - Fork 116
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master_prm' into dev_promote
- Loading branch information
Showing
486 changed files
with
8,989 additions
and
31,086 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
## | ||
####################################################################################################################### | ||
# | ||
# Copyright (c) 2024 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 (NOT LLPC_LLVM_SRC_PATH) | ||
# Find LLVM source. Allow client driver to override using its own name for overlay builds. | ||
set(DEFAULT_LLPC_LLVM_SRC_PATH ${XGL_LLVM_SRC_PATH}) | ||
if (NOT DEFAULT_LLPC_LLVM_SRC_PATH) | ||
if(EXISTS ${CMAKE_CURRENT_LIST_DIR}/../../../imported/llvm-project/llvm) | ||
set(DEFAULT_LLPC_LLVM_SRC_PATH ${CMAKE_CURRENT_LIST_DIR}/../../../imported/llvm-project/llvm) | ||
elseif(EXISTS ${CMAKE_CURRENT_LIST_DIR}/../../llvm-project/llvm) | ||
set(DEFAULT_LLPC_LLVM_SRC_PATH ${CMAKE_CURRENT_LIST_DIR}/../../llvm-project/llvm) | ||
endif() | ||
endif() | ||
set(LLPC_LLVM_SRC_PATH ${DEFAULT_LLPC_LLVM_SRC_PATH} CACHE PATH "Specify the path to LLVM.") | ||
endif() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,129 @@ | ||
## | ||
####################################################################################################################### | ||
# | ||
# Copyright (c) 2024 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. | ||
# | ||
####################################################################################################################### | ||
|
||
# Build LLVM, using previously set up LLVM_EXTERNAL_PROJECTS and LLVM_EXTERNAL_*_SOURCE_DIR. | ||
# Relies on findllvm.cmake being run first. | ||
|
||
if (NOT LLPC_LLVM_SRC_PATH) | ||
message(FATAL_ERROR "No LLPC_LLVM_SRC_PATH specified") | ||
endif() | ||
|
||
# Set cached options. | ||
set(LLVMRAYTRACING_BUILD_TESTS ${LLPC_BUILD_TESTS}) | ||
set(LLVM_TARGETS_TO_BUILD AMDGPU CACHE STRING "LLVM targets to build") | ||
set(LLVM_BUILD_TESTS OFF CACHE BOOL "LLVM build tests") | ||
set(LLVM_BUILD_TOOLS ${LLPC_BUILD_LLVM_TOOLS} CACHE BOOL "LLVM build tools") | ||
set(LLVM_BUILD_UTILS OFF CACHE BOOL "LLVM build utils") | ||
set(LLVM_INCLUDE_DOCS OFF CACHE BOOL "LLVM include docs") | ||
set(LLVM_INCLUDE_EXAMPLES OFF CACHE BOOL "LLVM include examples") | ||
set(LLVM_INCLUDE_GO_TESTS OFF CACHE BOOL "LLVM include go tests") | ||
set(LLVM_INCLUDE_TESTS ${LLPC_BUILD_TESTS} CACHE BOOL "LLVM include tests") | ||
set(LLVM_INCLUDE_TOOLS ON CACHE BOOL "LLVM include tools") | ||
set(LLVM_INCLUDE_UTILS ON CACHE BOOL "LLVM include utils") | ||
set(LLVM_ENABLE_TERMINFO OFF CACHE BOOL "LLVM enable terminfo") | ||
set(LLVM_RAM_PER_TABLEGEN_JOB 4000 CACHE STRING "LLVM RAM per tablegen job") | ||
set(LLVM_RAM_PER_LINK_JOB 5000 CACHE STRING "LLVM RAM per link job") | ||
if(CMAKE_BUILD_TYPE_DEBUG) | ||
# Build optimized version of llvm-tblgen even in debug builds, for faster build times. | ||
set(LLVM_OPTIMIZED_TABLEGEN ON CACHE BOOL "Build optimized llvm-tblgen") | ||
#if _WIN32 | ||
if(LLVM_OPTIMIZED_TABLEGEN AND WIN32 AND (CMAKE_GENERATOR MATCHES "Ninja")) | ||
# LLVM implements the Release build of llvm-tblgen as a cross-compile target, which fails to find | ||
# our DK-based toolchain (created with amd_generate_msvc_toolchain). However, we can inject the toolchain | ||
# argument into LLVM's add_custom_target that sets up this cross-compile build. | ||
# See: llvm-project/llvm/cmake/modules/CrossCompile.cmake | ||
set(CROSS_TOOLCHAIN_FLAGS_NATIVE "-DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE}" CACHE STRING | ||
"Toolchain flags for native build" FORCE) | ||
endif() | ||
#endif | ||
endif() | ||
|
||
# This will greatly speed up debug builds because we won't be listing all the symbols with llvm-nm. | ||
set(LLVM_BUILD_LLVM_C_DYLIB OFF CACHE BOOL "LLVM build LLVM-C dylib") | ||
|
||
# Remove /nologo from CMAKE_RC_FLAGS to avoid getting an error from specifying it twice in LLVM. | ||
if (CMAKE_RC_FLAGS) | ||
string(REPLACE "/nologo" "" CMAKE_RC_FLAGS ${CMAKE_RC_FLAGS}) | ||
endif() | ||
|
||
# Build LLVM. | ||
if (NOT LLPC_LLVM_BUILD_PATH) | ||
set(LLPC_LLVM_BUILD_PATH ${PROJECT_BINARY_DIR}/llvm) | ||
endif() | ||
if (ICD_BUILD_LLPC) | ||
add_subdirectory(${LLPC_LLVM_SRC_PATH} ${LLPC_LLVM_BUILD_PATH}) | ||
else() | ||
add_subdirectory(${LLPC_LLVM_SRC_PATH} ${LLPC_LLVM_BUILD_PATH} EXCLUDE_FROM_ALL) | ||
endif() | ||
|
||
# Get LLVMConfig onto cmake path. | ||
list(APPEND CMAKE_MODULE_PATH | ||
"${LLPC_LLVM_BUILD_PATH}/lib/cmake/llvm" | ||
"${LLPC_LLVM_BUILD_PATH}/${CMAKE_CFG_INTDIR}/lib/cmake/llvm" # Workaround for VS generator with older LLVM. | ||
) | ||
|
||
# Export LLVM build path for client driver. | ||
# TODO: Change uses to LLPC_LLVM_BUILD_PATH. | ||
set(XGL_LLVM_BUILD_PATH ${LLPC_LLVM_BUILD_PATH} PARENT_SCOPE) | ||
|
||
# Extract LLVM revision number for code outside the LLPC repository to use. | ||
file(READ "${LLPC_LLVM_SRC_PATH}/include/llvm/Config/llvm-config.h.cmake" LLVM_CONFIG_HEADER) | ||
string(REGEX MATCH "#define LLVM_MAIN_REVISION ([0-9]+)" "\\1" _ "${LLVM_CONFIG_HEADER}") | ||
set(LLVM_MAIN_REVISION "${CMAKE_MATCH_1}") | ||
set(LLVM_MAIN_REVISION ${LLVM_MAIN_REVISION} PARENT_SCOPE) | ||
|
||
# Some of the games using old versions of the tcmalloc lib are crashing | ||
# when allocating aligned memory. C++17 enables aligned new by default, | ||
# so we need to disable it to prevent those crashes. | ||
if (ICD_BUILD_LLPC AND NOT WIN32) | ||
llvm_map_components_to_libnames(llvm_libs | ||
AMDGPUAsmParser | ||
AMDGPUCodeGen | ||
AMDGPUDisassembler | ||
AMDGPUInfo | ||
Analysis | ||
BinaryFormat | ||
Core | ||
Coroutines | ||
BitReader | ||
BitWriter | ||
CodeGen | ||
InstCombine | ||
ipo | ||
IRPrinter | ||
IRReader | ||
Linker | ||
LTO | ||
MC | ||
Passes | ||
ScalarOpts | ||
Support | ||
Target | ||
TransformUtils | ||
) | ||
foreach (lib ${llvm_libs}) | ||
target_compile_options(${lib} PRIVATE "-fno-aligned-new") | ||
endforeach() | ||
endif() |
Oops, something went wrong.