Skip to content

Commit 514b60a

Browse files
committed
GPA 4.4 updates
1 parent 7976216 commit 514b60a

625 files changed

Lines changed: 102225 additions & 66444 deletions

File tree

Some content is hidden

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

BUILD.md

Lines changed: 18 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
* `pip install pyenchant`
2222
* `pip install sphinxcontrib-spelling`
2323
* **Note:** Be sure to add Python scripts to PATH in order to build documentation from pre_build scripts.
24+
* C++20 compiler toolchain that supports `std::format` (GNU 13+, Clang 17+, etc.)
2425

2526
## Windows Build Information
2627
The Windows projects each include a .rc file that embeds the VERSIONINFO resource into the final binary.
@@ -54,7 +55,7 @@ python build/pre_build.py --help
5455

5556
Additional switches that can be used with the pre_build.py script:
5657
--vs=[2022]: Specify the Visual Studio version for which to generate projects. Default is 2022.
57-
--config=[debug,release]: Specify the config for which to generate makefiles. Default is both. A specific config can only be specified on Linux. On Windows, both configs are always supported by the generated VS solution and project files.
58+
--config=[Debug,Release]: Specify the config for which to generate makefiles. Default is both. A specific config can only be specified on Linux. On Windows, both configs are always supported by the generated VS solution and project files.
5859
--clean: Delete cmake-generated directories created by this script
5960
--skipdx11: Does not generate build files for DX11 version of GPA (Windows only)
6061
--skipdx12: Does not generate build files for DX12 version of GPA (Windows only)
@@ -99,7 +100,7 @@ cmake --build build/win/ --config Debug
99100

100101
On Linux
101102

102-
Assuming you use `Unix Makefiles` which is the default `generator` on Windows
103+
Assuming you use `Unix Makefiles` which is the default `generator` on Linux
103104

104105
```sh
105106
cmake -S . -B build/linux -D CMAKE_BUILD_TYPE=Debug
@@ -115,26 +116,21 @@ NOTES:
115116

116117
NOTE: The PublicCounterCompiler Tool requires using the `Visual Studio` generator due to `C#` usage!
117118

118-
The PublicCounterCompiler Tool is a C# utility that will generate C++ code to define the public (or derived) counters.
119-
It takes as input text files contained in the [public_counter_compiler_input_files](source/public_counter_compiler_input_files) directory and
120-
outputs files in the [gpu_perf_api_counter_generator](source/auto_generated/gpu_perf_api_counter_generator), [gpu_perf_api_unit_tests](source/auto_generated/gpu_perf_api_unit_tests)
121-
and [docs](docs) directories.
122-
123-
There are three ways to execute the tool:
124-
* With no parameters - the user interface opens with no fields prepopulated.
125-
* With two parameters - the user interface opens with the two main fields prepopulated. Note that pressing the "Compile Public Counters" button will load the correct input files and generate the output files in the correct location.
126-
* Param 1: **API** - the API to compile counters for (e.g. GL, CL, DX11, DX12, VK, etc.)
127-
* Param 2: **HW generation** - the generation to compile counters for (ex: Gfx9, Gfx10, Gfx11 etc.)
128-
* With six or seven parameters - the user interface does not open and will generate the C++ files using the specified input and output file locations.
129-
* Param 1: **Counter names file** - text file containing hardware counter names and type (CounterNames[API][GEN].txt)
130-
* Param 2: **Public counter definition file** - text file defining how the public counters are calculated (PublicCounterDefinitions\*.txt)
131-
* Param 3: **Output Dir** - the directory to generate the output in (e.g. the path to the GPUPerfAPICounterGenerator directory)
132-
* Param 4: **Test output Dir** - the directory to generate the test output in (e.g. the path to the GPUPerfAPIUnitTests/counters directory)
133-
* Param 5: **API** - the API to take the counter names from (e.g. DX12)
134-
* Param 6: **GPU** - the GPU to take the counter names from (e.g. Gfx11)
135-
* Param 7: **GPU ASIC** - the subversion of GPU to take the counter names from (optional)
136-
137-
See the various `public_counter_definitions_*.txt` files in the [public_counter_compiler_input_files](source/public_counter_compiler_input_files) directory. These contain all the counter definitions.
119+
The PublicCounterCompiler Tool is a C# CLI utility that generates C++ code to define the public (or derived) counters.
120+
It reads counter definition files from [source/codegen](source/codegen) and outputs files to
121+
[source/auto_generated/gpu_perf_api_counter_generator](source/auto_generated/gpu_perf_api_counter_generator),
122+
[source/auto_generated/gpu_perf_api_unit_tests/counters](source/auto_generated/gpu_perf_api_unit_tests/counters),
123+
and [documentation/sphinx/source](documentation/sphinx/source).
124+
125+
```sh
126+
# Generate the C++ code
127+
PublicCounterCompiler
128+
129+
# Get command line options for more granular control
130+
PublicCounterCompiler --help
131+
```
132+
133+
See the `public_counter_definitions_*.txt` files in [source/codegen](source/codegen). These contain all the counter definitions.
138134
Each counter is given a name, a description, a type, an optional usage type, a list of hardware counters required and a formula applied to the values of the hardware counters to calculate the value of the counter.
139135

140136
Counter formulas are expressed in a Reverse Polish Notation and are made up the following elements:

CMakeLists.txt

Lines changed: 49 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
## Copyright (C) 2018-2026 Advanced Micro Devices, Inc. All rights reserved. ##
1+
#/ Copyright (C) Advanced Micro Devices, Inc. All rights reserved.
22

33
cmake_minimum_required(VERSION 3.25)
44
set(GPA_CMAKE_MODULES_DIR ${CMAKE_CURRENT_SOURCE_DIR}/build/cmake_modules)
55

66
set(GPA_MAJOR_VERSION 4)
7-
set(GPA_MINOR_VERSION 3)
7+
set(GPA_MINOR_VERSION 4)
88
set(GPA_UPDATE_VERSION 0)
99

1010
if(NOT DEFINED build)
@@ -26,31 +26,38 @@ set(CMAKE_CXX_STANDARD_REQUIRED ON)
2626
set(CMAKE_CXX_EXTENSIONS OFF)
2727
set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
2828
set(CMAKE_MSVC_DEBUG_INFORMATION_FORMAT "Embedded")
29-
30-
if(NOT ${skiptests} AND NOT TARGET gtest)
31-
enable_testing()
32-
block()
33-
set(CMAKE_FOLDER "Tests")
34-
set(BUILD_GMOCK OFF)
35-
set(INSTALL_GTEST OFF)
36-
add_subdirectory(external/googletest EXCLUDE_FROM_ALL SYSTEM)
37-
endblock()
38-
endif()
39-
40-
add_subdirectory(external/device_info)
41-
add_subdirectory(external/tsingleton)
29+
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
30+
set(CMAKE_C_VISIBILITY_PRESET "hidden")
31+
set(CMAKE_CXX_VISIBILITY_PRESET "hidden")
32+
set(CMAKE_VISIBILITY_INLINES_HIDDEN "YES")
4233

4334
if(NOT ${skipdocs})
4435
add_subdirectory(documentation/sphinx)
4536
endif()
4637

47-
if (NOT skipvulkan)
48-
block()
49-
add_subdirectory(external/Vulkan-Headers EXCLUDE_FROM_ALL SYSTEM)
50-
add_subdirectory(source/third_party/AmdVkExt SYSTEM)
51-
endblock()
38+
if(NOT ${skiptests})
39+
enable_testing()
5240
endif()
5341

42+
block()
43+
set(CMAKE_FOLDER "${CMAKE_FOLDER}/external")
44+
45+
add_subdirectory(external/device_info)
46+
47+
set(CMAKE_FOLDER "${CMAKE_FOLDER}/third_party")
48+
49+
if(NOT ${skiptests} AND NOT TARGET gtest)
50+
set(BUILD_GMOCK OFF)
51+
set(INSTALL_GTEST OFF)
52+
add_subdirectory(external/third_party/googletest EXCLUDE_FROM_ALL SYSTEM)
53+
endif()
54+
55+
if (NOT skipvulkan)
56+
add_subdirectory(external/third_party/Vulkan-Headers EXCLUDE_FROM_ALL SYSTEM)
57+
endif()
58+
endblock()
59+
60+
add_subdirectory(source/third_party/AmdVkExt SYSTEM)
5461
if (WIN32)
5562
add_subdirectory(source/third_party/AmdDxExt SYSTEM)
5663
endif()
@@ -62,6 +69,28 @@ else()
6269
add_compile_options(-Wall -Werror)
6370
endif()
6471

72+
add_library(GPUPerfAPI-Headers INTERFACE)
73+
add_library(AMD::GPUPerfAPI-Headers ALIAS GPUPerfAPI-Headers)
74+
target_sources(GPUPerfAPI-Headers PUBLIC
75+
FILE_SET HEADERS
76+
BASE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/include/
77+
FILES
78+
${CMAKE_CURRENT_SOURCE_DIR}/include/gpu_performance_api/gpu_perf_api.h
79+
${CMAKE_CURRENT_SOURCE_DIR}/include/gpu_performance_api/gpu_perf_api_counters.h
80+
${CMAKE_CURRENT_SOURCE_DIR}/include/gpu_performance_api/gpu_perf_api_functions.h
81+
${CMAKE_CURRENT_SOURCE_DIR}/include/gpu_performance_api/gpu_perf_api_function_types.h
82+
${CMAKE_CURRENT_SOURCE_DIR}/include/gpu_performance_api/gpu_perf_api_interface_loader.h
83+
${CMAKE_CURRENT_SOURCE_DIR}/include/gpu_performance_api/gpu_perf_api_stub.h
84+
${CMAKE_CURRENT_SOURCE_DIR}/include/gpu_performance_api/gpu_perf_api_types.h
85+
${CMAKE_CURRENT_SOURCE_DIR}/include/gpu_performance_api/gpu_perf_api_vk.h
86+
)
87+
88+
if (PROJECT_IS_TOP_LEVEL)
89+
# Used to verify that all headers in a target's PUBLIC and INTERFACE header sets can be included on their own.
90+
# This is a helpful test to ensure users of the library can include the headers without needing to worry about include order or missing includes.
91+
set_target_properties(GPUPerfAPI-Headers PROPERTIES VERIFY_INTERFACE_HEADER_SETS ON)
92+
endif()
93+
6594
add_subdirectory(source)
6695

6796
set(CPACK_ARCHIVE_COMPONENT_INSTALL ON)

LICENSE.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Copyright (c) 2016-2025 Advanced Micro Devices, Inc. All rights reserved.
1+
Copyright Advanced Micro Devices, Inc. All rights reserved.
22

33
Permission is hereby granted, free of charge, to any person obtaining a copy
44
of this software and associated documentation files (the "Software"), to deal

NOTICES.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,14 @@ The above copyright notice and this permission notice (including the next paragr
1111
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.
1212

1313
AMD copyrighted code (BSD-2-Clause)
14-
Copyright (c) 2012 Advanced Micro Devices, Inc. All rights reserved.
14+
Copyright Advanced Micro Devices, Inc. All rights reserved.
1515
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
1616
Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
1717
Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
1818
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
1919

2020
AMD copyrighted code (MIT)
21-
Copyright (c) 2016-2018 Advanced Micro Devices, Inc. All rights reserved.
21+
Copyright Advanced Micro Devices, Inc. All rights reserved.
2222
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:
2323
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
2424
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 NON-INFRINGEMENT. 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.

0 commit comments

Comments
 (0)