Skip to content

Commit

Permalink
Update llpc from commit 04b0c64a
Browse files Browse the repository at this point in the history
* Include dev changes inclusive to 9129dcf with 80970a1 reverted
* Add navi32 support
* [Continuations] Improve payload field copy mechanism
* Handle multiple token types in legacy cleanup
* [Continuations] Update lit tests to UTC version 3
* Refine relocatable shader
* Remove IShaderCache in LLPC
* Remove an outdated workaround
* Add location mask for uber fetch shader
* Remove i64 support in post-process
* Remove getAliasedFunction
* Match the lgccps function prototype
* Update CreateImageQuerySamples for new image resource layout
* Contain alpha channel For VK_FORMAT_A8_UNORM_KHR
* Update ALPHA_TO_MASK_DISABLE in color export shader
* lgc now depends on lgcrt
* Add lgccps support to continuations
* Add continuations into build
* Fix the failure for VK.pipeline.*.extended_dynamic_state.*.color_blend_dual_index_1 cases
* [Continuations]Fix case of small max hit attribute size
* Fix the user data argument.
* [Continuations] Remove some typed pointer code
* [Continuations] Add stack size metadata helpers
* Support origin_lower_left in LLPC
* [Continuations] Rename CleanupContinuation pass
* [Continuations] Run lit tests in opaque pointer mode
* RegisterMetadataBuilder: remove the wrong check for updating SPI_PS_INPUT_CNTL_.offset
* Support spv extended vertex varying attribute formats emulation.
* [Continuations]Move existing tests to dx subdirectory
* Fix tablegen incantations for multi-config builds
* Fix clang lgc test failure 'cps-unify-exits.lgc'
* Change shader interface of shaderIdentifier
* ColorExportShader: Fix "s_waitcnt"
  • Loading branch information
chuang13 committed Sep 28, 2023
1 parent 72a5200 commit e9a3361
Show file tree
Hide file tree
Showing 291 changed files with 21,846 additions and 20,025 deletions.
2 changes: 1 addition & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[*]
end_of_line = lf
indent_size = 4
indent_size = 2
indent_style = space
insert_final_newline = true
max_line_length = 120
Expand Down
69 changes: 61 additions & 8 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -43,17 +43,10 @@ add_library(vkgc_headers INTERFACE)
option(LLPC_BUILD_TOOLS "LLPC build all tools" OFF)

### Options that affect the headers ####################################################################################
option(LLPC_ENABLE_SHADER_CACHE "Enable experimental shader cache" OFF)

if(LLPC_ENABLE_SHADER_CACHE)
target_compile_definitions(vkgc_headers INTERFACE LLPC_ENABLE_SHADER_CACHE)
endif()

if (LLPC_CLIENT_INTERFACE_MAJOR_VERSION)
target_compile_definitions(vkgc_headers INTERFACE LLPC_CLIENT_INTERFACE_MAJOR_VERSION=${LLPC_CLIENT_INTERFACE_MAJOR_VERSION})
else()
# LLPC is not compiled, so fall back to the latest version
target_compile_definitions(vkgc_headers INTERFACE LLPC_CLIENT_INTERFACE_MAJOR_VERSION=LLPC_INTERFACE_MAJOR_VERSION)
message(FATAL_ERROR "Client of LLPC must set LLPC_CLIENT_INTERFACE_MAJOR_VERSION")
endif()

#if VKI_BUILD_GFX11
Expand Down Expand Up @@ -144,6 +137,7 @@ if(ICD_BUILD_LLPC)
add_subdirectory(llpc ${PROJECT_BINARY_DIR}/llpc)

if(LLPC_BUILD_TESTS)
set(LLVM_INCLUDE_TESTS ON CACHE BOOL "Force enable LLVM_INCLUDE_TESTS to include gmock" FORCE)
add_subdirectory(test)
endif()

Expand All @@ -158,3 +152,62 @@ if(ICD_BUILD_LLPC)

target_link_libraries(vkgc INTERFACE llpc)
endif()

# Set sub library properties
if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")

if (TARGET dumper)
set_property(TARGET dumper_base PROPERTY FOLDER Compiler)
set_property(TARGET dumper PROPERTY FOLDER Compiler)
endif()

if (TARGET vfx)
set_property(TARGET vfx PROPERTY FOLDER Compiler)
endif()

if(ICD_BUILD_LLPC)
set_property(TARGET llpc PROPERTY FOLDER Compiler)
set_property(TARGET llpcinternal PROPERTY FOLDER Compiler)
if(VKI_RAY_TRACING AND NOT LLPC_IS_STANDALONE)
set_property(TARGET vkgc_gpurtshim PROPERTY FOLDER Compiler)
endif()
set_property(TARGET vkgc_util PROPERTY FOLDER Compiler)
if (LLPC_BUILD_TOOLS)
set_property(TARGET amdllpc PROPERTY FOLDER Compiler)
endif()

set_property(TARGET all-targets PROPERTY FOLDER Misc)
set_property(TARGET AMDGPU PROPERTY FOLDER Misc)
set_property(TARGET benchmark PROPERTY FOLDER Misc)
set_property(TARGET benchmark_main PROPERTY FOLDER Misc)
set_property(TARGET distribution PROPERTY FOLDER Misc)
set_property(TARGET Engine PROPERTY FOLDER Misc)
set_property(TARGET install-distribution PROPERTY FOLDER Misc)
set_property(TARGET install-distribution-stripped PROPERTY FOLDER Misc)
set_property(TARGET LLVMSupportBlake3 PROPERTY FOLDER Misc)
set_property(TARGET Native PROPERTY FOLDER Misc)
set_property(TARGET NativeCodeGen PROPERTY FOLDER Misc)
set_property(TARGET opt-viewer PROPERTY FOLDER Misc)
if (TARGET llvm-dialects-example)
set_property(TARGET llvm-dialects-example PROPERTY FOLDER Misc)
endif()
if (LLVM_OPTIMIZED_TABLEGEN)
set_property(TARGET llvm_nm_target PROPERTY FOLDER Misc)
set_property(TARGET llvm_readobj_target PROPERTY FOLDER Misc)
set_property(TARGET llvm-min-tblgen-host PROPERTY FOLDER Misc)
set_property(TARGET llvm-tblgen-host PROPERTY FOLDER Misc)
set_property(TARGET CONFIGURE_LLVM_NATIVE PROPERTY FOLDER Misc)
set_property(TARGET CREATE_LLVM_NATIVE PROPERTY FOLDER Misc)
endif()
if (LLPC_BUILD_TESTS)
set_property(TARGET check-all PROPERTY FOLDER Tests)
if(NOT LLPC_IS_STANDALONE)
set_property(TARGET check-amber PROPERTY FOLDER "LLPC Tests")
endif()
set_property(TARGET check-amdllpc PROPERTY FOLDER "LLPC Tests")
set_property(TARGET check-amdllpc-units PROPERTY FOLDER "LLPC Tests")
set_property(TARGET check-lgccps-units PROPERTY FOLDER "LgcCps Tests")
set_property(TARGET check-lgc-units PROPERTY FOLDER "LGC Tests")
endif()
endif()
endif()
9 changes: 6 additions & 3 deletions cmake/CompilerFlags.cmake
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
function(set_compiler_options PROJECT_NAME ENABLE_WERROR)
target_compile_features("${PROJECT_NAME}" PUBLIC cxx_std_17)
set_target_properties("${PROJECT_NAME}" PROPERTIES CXX_EXTENSIONS OFF)
set_target_properties("${PROJECT_NAME}" PROPERTIES POSITION_INDEPENDENT_CODE ON)
target_compile_features(${PROJECT_NAME} PUBLIC cxx_std_20)
set_target_properties(${PROJECT_NAME} PROPERTIES
CXX_STANDARD 20
CXX_STANDARD_REQUIRED ON
CXX_EXTENSIONS OFF
POSITION_INDEPENDENT_CODE ON)

if(CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang")
if(ENABLE_WERROR)
Expand Down
43 changes: 43 additions & 0 deletions cmake/continuations.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
##
#######################################################################################################################
#
# Copyright (c) 2023 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.
#
#######################################################################################################################

set(LLPC_SOURCE_DIR "${CMAKE_CURRENT_LIST_DIR}/..")

# Function to add continuations and its dependencies as LLVM external projects.
# This appends the project names to LLVM_EXTERNAL_PROJECTS and sets each LLVM_EXTERNAL_*_SOURCE_DIR,
# all in the caller's scope.
function(add_continuations_projects)
if (NOT "${LLVM_EXTERNAL_CONTINUATIONS_SOURCE_DIR}")
if (NOT "${LLVM_EXTERNAL_LLVM_DIALECTS_SOURCE_DIR}")
list(APPEND LLVM_EXTERNAL_PROJECTS llvm_dialects)
set(LLVM_EXTERNAL_LLVM_DIALECTS_SOURCE_DIR "${LLPC_SOURCE_DIR}/imported/llvm-dialects" PARENT_SCOPE)
endif()
list(APPEND LLVM_EXTERNAL_PROJECTS lgccps lgcrt continuations)
set(LLVM_EXTERNAL_CONTINUATIONS_SOURCE_DIR "${LLPC_SOURCE_DIR}/shared/continuations" PARENT_SCOPE)
set(LLVM_EXTERNAL_LGCRT_SOURCE_DIR "${LLPC_SOURCE_DIR}/shared/lgcrt" PARENT_SCOPE)
set(LLVM_EXTERNAL_LGCCPS_SOURCE_DIR "${LLPC_SOURCE_DIR}/shared/lgccps" PARENT_SCOPE)
set(LLVM_EXTERNAL_PROJECTS "${LLVM_EXTERNAL_PROJECTS}" PARENT_SCOPE)
endif()
endfunction()
4 changes: 3 additions & 1 deletion cmake/lgc.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,11 @@ function(add_lgc_projects)
list(APPEND LLVM_EXTERNAL_PROJECTS llvm_dialects)
set(LLVM_EXTERNAL_LLVM_DIALECTS_SOURCE_DIR "${LLPC_SOURCE_DIR}/imported/llvm-dialects" PARENT_SCOPE)
endif()
list(APPEND LLVM_EXTERNAL_PROJECTS LgcCps lgc)
list(APPEND LLVM_EXTERNAL_PROJECTS LgcCps LgcRt Continuations lgc)
set(LLVM_EXTERNAL_PROJECTS "${LLVM_EXTERNAL_PROJECTS}" PARENT_SCOPE)
set(LLVM_EXTERNAL_LGCCPS_SOURCE_DIR "${LLPC_SOURCE_DIR}/shared/lgccps" PARENT_SCOPE)
set(LLVM_EXTERNAL_LGCRT_SOURCE_DIR "${LLPC_SOURCE_DIR}/shared/lgcrt" PARENT_SCOPE)
set(LLVM_EXTERNAL_CONTINUATIONS_SOURCE_DIR "${LLPC_SOURCE_DIR}/shared/continuations" PARENT_SCOPE)
set(LLVM_EXTERNAL_LGC_SOURCE_DIR "${LLPC_SOURCE_DIR}/lgc" PARENT_SCOPE)
endif()
endfunction()
9 changes: 9 additions & 0 deletions include/gpurt-compiler.h
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,15 @@ struct DispatchRaysConstantData {
unsigned profileMaxIterations; ///< Maximum traversal iterations for profiling
unsigned traceRayGpuVaLo; ///< Traversal shader (shader table) base address low 32-bits
unsigned traceRayGpuVaHi; ///< Traversal shader (shader table) base address high 32-bits
unsigned counterMode; ///< Counter capture mode. see TraceRayCounterMode
unsigned counterRayIdRangeBegin; ///< Counter capture ray ID range begin
unsigned counterRayIdRangeEnd; ///< Counter capture ray ID range end
unsigned cpsBackendStackSize; ///< The scratch memory used as stacks are divided into two parts:
///< (a) Used by a compiler backend, start at offset 0.
unsigned cpsFrontendStackSize; ///< (b) Used by IR (Intermediate Representation), for a continuation passing shader.
unsigned cpsGlobalMemoryAddressLo; ///< Separate CPS stack memory base address low 32-bits
unsigned cpsGlobalMemoryAddressHi; ///< Separate CPS stack memory base address high 32-bits
unsigned counterMask; ///< Mask for filtering ray history token
};
#pragma pack(pop)

Expand Down
Loading

0 comments on commit e9a3361

Please sign in to comment.