Skip to content

Commit 1e61f9a

Browse files
committed
Merge branch 'internal_master_prm' into dev
2 parents 8abed12 + 26cb05f commit 1e61f9a

File tree

254 files changed

+41361
-32882
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

254 files changed

+41361
-32882
lines changed

CMakeLists.txt

+10-5
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,19 @@
2424
#######################################################################################################################
2525
cmake_minimum_required(VERSION 3.9...3.16)
2626

27+
### Define Project #####################################################################################################
28+
project(PAL
29+
# While PAL is primarily a C++ library, it also has some C files.
30+
# TestBigEndian called from AmdCmakeHelper requires C or CXX language to be enabled.
31+
LANGUAGES CXX C
32+
)
33+
2734
### CMake Includes #####################################################################################################
2835
list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake/Modules)
2936
list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake/)
3037
include(AmdCmakeHelper)
3138
include(PalVersionHelper)
39+
include(PalBuildParameters)
3240
include(PalOptions)
3341
include(PalOverrides)
3442
include(PalCompileDefinitions)
@@ -41,11 +49,8 @@ if (${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_CURRENT_SOURCE_DIR})
4149
set(PAL_IS_STANDALONE ON)
4250
endif()
4351

44-
### Define Project #####################################################################################################
45-
project(PAL
46-
# While PAL is primarily a C++ library, it also has some C files.
47-
LANGUAGES CXX C
48-
)
52+
### Build Parameters ###################################################################################################
53+
pals_build_parameters()
4954

5055
### Project Options ####################################################################################################
5156
pal_options()

cmake/PalBuildParameters.cmake

+89
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
##
2+
#######################################################################################################################
3+
#
4+
# Copyright (c) 2020 Advanced Micro Devices, Inc. All Rights Reserved.
5+
#
6+
# Permission is hereby granted, free of charge, to any person obtaining a copy
7+
# of this software and associated documentation files (the "Software"), to deal
8+
# in the Software without restriction, including without limitation the rights
9+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10+
# copies of the Software, and to permit persons to whom the Software is
11+
# furnished to do so, subject to the following conditions:
12+
#
13+
# The above copyright notice and this permission notice shall be included in all
14+
# copies or substantial portions of the Software.
15+
#
16+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22+
# SOFTWARE.
23+
#
24+
#######################################################################################################################
25+
26+
include(PalVersionHelper)
27+
28+
pal_include_guard(PalBuildParameters)
29+
30+
macro(pal_gfx9_options)
31+
32+
pal_build_parameter(PAL_BUILD_NAVI14 "Build PAL with Navi14 support?" ON ${pal_gpu_mode})
33+
34+
pal_build_parameter(PAL_BUILD_NAVI21 "Build PAL with Navi21 support?" ON ${pal_gpu_mode})
35+
pal_set_or(PAL_BUILD_GFX10_3 ${PAL_BUILD_NAVI21})
36+
37+
endmacro() # gfx9
38+
39+
# Specify GPU build options
40+
macro(pal_gfx_options)
41+
pal_build_parameter(PAL_BUILD_GFX "Build PAL with Graphics support?" ON AUTHOR_WARNING)
42+
43+
# If PAL is being built standalone, no need to display as warnings. Since the warnings are intended
44+
# for PAL clients.
45+
if (PAL_IS_STANDALONE)
46+
set(pal_gpu_mode "STATUS")
47+
else()
48+
set(pal_gpu_mode "AUTHOR_WARNING")
49+
endif()
50+
51+
if (PAL_BUILD_GFX)
52+
pal_build_parameter(PAL_BUILD_GFX6 "Build PAL with GFX6 support?" ${PAL_BUILD_GFX} ${pal_gpu_mode})
53+
pal_build_parameter(PAL_BUILD_GFX9 "Build PAL with GFX9 support?" ${PAL_BUILD_GFX} ${pal_gpu_mode})
54+
55+
if (PAL_BUILD_GFX9)
56+
pal_gfx9_options()
57+
endif()
58+
59+
endif() # PAL_BUILD_GFX
60+
endmacro()
61+
62+
# This macro is meant to encapsulate all the variables that PAL's clients are intended to
63+
# manipulate when customizing PAL for their purposes. Making it the first place cmake developers
64+
# for DXCP, XGL, etc. will look to when they have build problems/ideas/confusion.
65+
macro(pals_build_parameters)
66+
# It's very convenient to have the PAL_CLIENT_INTERFACE_MAJOR_VERSION be defined before anything else
67+
# And it needs to be defined hence the FATAL_ERROR.
68+
pal_build_parameter(PAL_CLIENT_INTERFACE_MAJOR_VERSION "Pal library interface value" "-1" FATAL_ERROR)
69+
70+
if (DEFINED PAL_CLIENT_INTERFACE_MINOR_VERSION)
71+
message(AUTHOR_WARNING "Unneccessary to specify PAL_CLIENT_INTERFACE_MINOR_VERSION")
72+
endif()
73+
74+
pal_build_parameter(PAL_CLIENT "Client pal should build for" "mandatory" FATAL_ERROR)
75+
76+
# Create a more convenient variable to avoid string comparisons.
77+
set(PAL_CLIENT_${PAL_CLIENT} ON)
78+
79+
set(PAL_AMDGPU_BUILD ${UNIX})
80+
81+
# If present, it specifies that the build is on a release branch (not stg) and en/disables features
82+
# specific to that branch. On stg, all branch-related features are enabled.
83+
if (DEFINED PAL_BUILD_BRANCH)
84+
message_verbose("Client specified PAL_BUILD_BRANCH: ${PAL_BUILD_BRANCH}")
85+
endif()
86+
87+
# Specify GPU build options
88+
pal_gfx_options()
89+
endmacro()

cmake/PalCompilerOptions.cmake

+1-1
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ function(pal_compiler_options TARGET)
4444

4545
if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
4646
set(isGNU TRUE)
47-
elseif("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
47+
elseif("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang")
4848
set(isClang TRUE)
4949
endif()
5050

cmake/PalCompilerWarnings.cmake

+3
Original file line numberDiff line numberDiff line change
@@ -83,5 +83,8 @@ function(pal_compiler_warnings_gnu_or_clang TARGET)
8383
add_flag_if_exists(${TARGET} -Wno-sizeof-array-div HAS_WARN_SIZEOF_DIV)
8484
# Don't warn on double parentheses in ifs, this is PAL's coding style
8585
add_flag_if_exists(${TARGET} -Wno-parentheses-equality HAS_WARN_PARENS)
86+
# Suppress anonymous struct warnings on Clang
87+
add_flag_if_exists(${TARGET} -Wno-gnu-anonymous-struct HAS_WARN_ANONYMOUS_STRUCT)
88+
add_flag_if_exists(${TARGET} -Wno-nested-anon-types HAS_WARN_NESTED_ANON_TYPES)
8689
endfunction()
8790

cmake/PalOptions.cmake

+2-61
Original file line numberDiff line numberDiff line change
@@ -28,47 +28,10 @@ include(CMakeDependentOption)
2828

2929
pal_include_guard(PalOptions)
3030

31-
macro(pal_gfx9_options)
32-
33-
pal_build_parameter(PAL_BUILD_NAVI14 "Build PAL with Navi14 support?" ON ${pal_gpu_mode})
34-
35-
pal_build_parameter(PAL_BUILD_NAVI21 "Build PAL with Navi21 support?" ON ${pal_gpu_mode})
36-
pal_set_or(PAL_BUILD_GFX10_3 ${PAL_BUILD_NAVI21})
37-
38-
endmacro() # gfx9
39-
40-
# Specify GPU build options
41-
macro(pal_gfx_options)
42-
pal_build_parameter(PAL_BUILD_GFX "Build PAL with Graphics support?" ON AUTHOR_WARNING)
43-
44-
# If PAL is being built standalone, no need to display as warnings. Since the warnings are intended
45-
# for PAL clients.
46-
if (PAL_IS_STANDALONE)
47-
set(pal_gpu_mode "STATUS")
48-
else()
49-
set(pal_gpu_mode "AUTHOR_WARNING")
50-
endif()
51-
52-
if (PAL_BUILD_GFX)
53-
pal_build_parameter(PAL_BUILD_GFX6 "Build PAL with GFX6 support?" ${PAL_BUILD_GFX} ${pal_gpu_mode})
54-
pal_build_parameter(PAL_BUILD_GFX9 "Build PAL with GFX9 support?" ${PAL_BUILD_GFX} ${pal_gpu_mode})
55-
56-
if (PAL_BUILD_GFX9)
57-
pal_gfx9_options()
58-
endif()
59-
60-
endif() # PAL_BUILD_GFX
61-
endmacro()
62-
63-
# This macro is meant to encapsulate all the variables that PAL's clients are intended to
64-
# manipulate when customizing PAL for their purposes. Making it the first place cmake developers
65-
# for DXCP, XGL, etc. will look to when they have build problems/ideas/confusion.
66-
#
67-
# All variables should have the prefix "PAL_" this serves two main purposes
31+
# All options/cache variables should have the prefix "PAL_" this serves two main purposes
6832
# Name collision issues
6933
# Cmake-gui allows grouping of variables based on prefixes, which then makes it clear what options PAL defined
7034
macro(pal_options)
71-
7235
option(PAL_BUILD_NULL_DEVICE "Build null device backend for offline compilation?" ON)
7336

7437
option(PAL_BUILD_GPUOPEN "Build GPUOpen developer driver support?" OFF)
@@ -84,12 +47,6 @@ macro(pal_options)
8447

8548
option(PAL_BUILD_CORE "Build PAL Core?" ON)
8649

87-
# If present, it specifies that the build is on a release branch (not stg) and en/disables features
88-
# specific to that branch. On stg, all branch-related features are enabled.
89-
if (DEFINED PAL_BUILD_BRANCH)
90-
message_verbose("Client specified PAL_BUILD_BRANCH: ${PAL_BUILD_BRANCH}")
91-
endif()
92-
9350
option(PAL_BUILD_GPUUTIL "Build PAL GPU Util?" ON)
9451

9552
cmake_dependent_option(PAL_BUILD_LAYERS "Build PAL Layers?" ON "PAL_BUILD_GPUUTIL" OFF)
@@ -104,7 +61,7 @@ macro(pal_options)
10461
option(PAL_DEVELOPER_BUILD "Enable developer build" OFF)
10562

10663
# If the client turns on PAL developer build they expect these ALL these features to be turned on
107-
if (${PAL_DEVELOPER_BUILD})
64+
if (PAL_DEVELOPER_BUILD)
10865
# Notice how these aren't cache variables.
10966
# Because if they were cache variables either they/we would have to use the FORCE keyword
11067
# Either way it would be a bad interface for the client
@@ -121,31 +78,15 @@ macro(pal_options)
12178
endif()
12279
#endif
12380

124-
# Specify GPU build options
125-
pal_gfx_options()
126-
12781
option(PAL_BUILD_OSS "Build PAL with Operating System support?" ON)
12882
cmake_dependent_option(PAL_BUILD_OSS1 "Build PAL with OSS1?" ON "PAL_BUILD_OSS" OFF)
12983
cmake_dependent_option(PAL_BUILD_OSS2 "Build PAL with OSS2?" ON "PAL_BUILD_OSS" OFF)
13084
cmake_dependent_option(PAL_BUILD_OSS2_4 "Build PAL with OSS2_4?" ON "PAL_BUILD_OSS" OFF)
13185
cmake_dependent_option(PAL_BUILD_OSS4 "Build PAL with OSS4?" ON "PAL_BUILD_OSS" OFF)
13286

133-
set(PAL_AMDGPU_BUILD ${UNIX})
13487
option(PAL_BUILD_DRI3 "Build PAL with DRI3 support?" ON)
13588
option(PAL_BUILD_WAYLAND "Build PAL with WAYLAND support?" OFF)
13689

137-
# PAL Client Options ###############################################################################
138-
pal_build_parameter(PAL_CLIENT "Client pal should build for" "mandatory" FATAL_ERROR)
139-
140-
# Create a more convenient variable to avoid string comparisons.
141-
set(PAL_CLIENT_${PAL_CLIENT} ON)
142-
143-
pal_build_parameter(PAL_CLIENT_INTERFACE_MAJOR_VERSION "Pal library interface value" "-1" FATAL_ERROR)
144-
145-
if (DEFINED PAL_CLIENT_INTERFACE_MINOR_VERSION)
146-
message(AUTHOR_WARNING "Unneccessary to specify PAL_CLIENT_INTERFACE_MINOR_VERSION")
147-
endif()
148-
14990
# Paths to PAL's dependencies
15091
set(PAL_METROHASH_PATH ${PROJECT_SOURCE_DIR}/src/util/imported/metrohash CACHE PATH "Specify the path to the MetroHash project.")
15192
set( PAL_CWPACK_PATH ${PROJECT_SOURCE_DIR}/src/util/imported/cwpack CACHE PATH "Specify the path to the CWPack project.")

inc/core/g_palPipelineAbiMetadata.h

+21-15
Original file line numberDiff line numberDiff line change
@@ -77,11 +77,12 @@ struct HardwareStageMetadata
7777
uint32 vgprCount;
7878
/// Number of SGPRs used.
7979
uint32 sgprCount;
80-
/// VGPR count upper limit (only set if different from HW default).
80+
/// If non-zero, indicates the shader was compiled with a directive to instruct the compiler to limit the VGPR usage
81+
/// to be less than or equal to the specified value (only set if different from HW default).
8182
uint32 vgprLimit;
8283
/// SGPR count upper limit (only set if different from HW default).
8384
uint32 sgprLimit;
84-
/// Compute only. Thread-group X/Y/Z dimensions.
85+
/// Thread-group X/Y/Z dimensions (Compute only).
8586
uint32 threadgroupDimensions[3];
8687
/// Wavefront size (only set if different from HW default).
8788
uint32 wavefrontSize;
@@ -94,15 +95,15 @@ struct HardwareStageMetadata
9495
{
9596
struct
9697
{
97-
/// The shader reads or writes UAV(s).
98+
/// The shader reads or writes UAVs.
9899
uint8 usesUavs : 1;
99-
/// The shader reads or writes ROV(s).
100+
/// The shader reads or writes ROVs.
100101
uint8 usesRovs : 1;
101102
/// The shader writes to one or more UAVs.
102103
uint8 writesUavs : 1;
103104
/// The shader writes out a depth value.
104105
uint8 writesDepth : 1;
105-
/// The shader uses append or consume ops.
106+
/// The shader uses append and/or consume operations, either memory or GDS.
106107
uint8 usesAppendConsume : 1;
107108
uint8 reserved : 3;
108109
};
@@ -161,32 +162,35 @@ struct PipelineMetadata
161162
uint32 userDataLimit;
162163
/// The user data spill threshold. 0xFFFF for NoUserDataSpilling.
163164
uint32 spillThreshold;
164-
/// Amount of LDS space used internally for handling data-passing between the ES and GS shader stages. This can be
165-
/// zero if the data is passed using off-chip buffers. This value should be used to program all user-SGPRs which
166-
/// have been marked with "UserDataMapping::EsGsLdsSize" (typically only the GS and VS HW stages will ever have a
167-
/// user-SGPR so marked).
165+
/// Size in bytes of LDS space used internally for handling data-passing between the ES and GS shader stages. This
166+
/// can be zero if the data is passed using off-chip buffers. This value should be used to program all user-SGPRs
167+
/// which have been marked with "UserDataMapping::EsGsLdsSize" (typically only the GS and VS HW stages will ever
168+
/// have a user-SGPR so marked).
168169
uint32 esGsLdsSize;
169170
#if PAL_CLIENT_INTERFACE_MAJOR_VERSION < 619
170171
/// Address of stream out table entry.
171172
uint32 streamOutTableAddress;
172173
/// Address(es) of indirect user data tables. 3 for VK, else 1.
173174
uint32 indirectUserDataTableAddresses[3];
174175
#endif
175-
/// Explicit max subgroup size for NGG shaders (max number of threads in a subgroup).
176+
/// Explicit maximum subgroup size for NGG shaders (maximum number of threads in a subgroup).
176177
uint32 nggSubgroupSize;
177178
/// Graphics only. Number of PS interpolants.
178179
uint32 numInterpolants;
180+
/// Max mesh shader scratch memory used.
181+
uint32 meshScratchMemorySize;
179182
/// Name of the client graphics API.
180183
char api[16];
181-
/// Graphics API shader create info binary blob.
184+
/// Graphics API shader create info binary blob. Can be defined by the driver using the compiler if they want to be
185+
/// able to correlate API-specific information used during creation at a later time.
182186
BinaryData apiCreateInfo;
183187

184188
union
185189
{
186190
struct
187191
{
188192
/// Indicates whether or not the pipeline uses the viewport array index feature. Pipelines which use this
189-
/// feature can render into all 16 viewports, whereas pipelines which don't use it are restricted to
193+
/// feature can render into all 16 viewports, whereas pipelines which do not use it are restricted to
190194
/// viewport #0.
191195
uint8 usesViewportArrayIndex : 1;
192196
#if PAL_CLIENT_INTERFACE_MAJOR_VERSION < 619
@@ -222,16 +226,17 @@ struct PipelineMetadata
222226
#endif
223227
uint32 nggSubgroupSize : 1;
224228
uint32 numInterpolants : 1;
225-
uint32 placeholder2 : 1;
229+
uint32 meshScratchMemorySize : 1;
226230
#if PAL_CLIENT_INTERFACE_MAJOR_VERSION < 619
227231
uint32 calcWaveBreakSizeAtDrawTime : 1;
228232
#else
229-
uint32 placeholder3 : 1;
233+
uint32 placeholder2 : 1;
230234
#endif
235+
uint32 placeholder3 : 1;
231236
uint32 placeholder4 : 1;
232237
uint32 api : 1;
233238
uint32 apiCreateInfo : 1;
234-
uint32 reserved : 14;
239+
uint32 reserved : 13;
235240
};
236241
uint32 uAll;
237242
} hasEntry;
@@ -281,6 +286,7 @@ namespace PipelineMetadataKey
281286
#endif
282287
static constexpr char NggSubgroupSize[] = ".nggSubgroupSize";
283288
static constexpr char NumInterpolants[] = ".num_interpolants";
289+
static constexpr char MeshScratchMemorySize[] = ".mesh_scratch_memory_size";
284290
#if PAL_CLIENT_INTERFACE_MAJOR_VERSION < 619
285291
static constexpr char CalcWaveBreakSizeAtDrawTime[] = ".calc_wave_break_size_at_draw_time";
286292
#endif

0 commit comments

Comments
 (0)