Skip to content

Commit 507552a

Browse files
committed
GPA 4.1 Updates
1 parent a0852bc commit 507552a

File tree

175 files changed

+110322
-97457
lines changed

Some content is hidden

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

175 files changed

+110322
-97457
lines changed

BUILD.md

Lines changed: 79 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,17 @@
11
# GPUPerfAPI Build Instructions
22
---
33
## Table of Contents
4-
* [Cloning & Updating Dependent Repositories](#cloningupdating-dependent-repositories)
54
* [Windows Build Information](#windows-build-information)
65
* [Linux Build Information](#linux-build-information)
76
* [PublicCounterCompiler Tool](#publiccountercompiler-tool)
87

9-
## Cloning & Updating Dependent Repositories
10-
GPUPerfAPI no longer uses git submodules to reference dependent repositories. Instead, you need to follow these instructions in
11-
order to clone and update any dependent repositories.
12-
138
#### Prerequisites
14-
* Python 3.x, which can be installed from https://www.python.org/.
15-
* CMake 3.19 and newer.
16-
* For Windows, this can be downloaded from https://cmake.org/download/.
17-
* For Linux, this can be installed using:
9+
* Python 3.6 or newer which can be installed from https://www.python.org/.
10+
* Vulkan SDK (optional)
11+
* CMake 3.25 and newer which can be installed from https://cmake.org/download/ or your package manager.
12+
* On Windows, this can also be installed using:
13+
* `winget install cmake`
14+
* On Linux, this can also be installed using:
1815
* `sudo apt-get install cmake`
1916
* To build the documentation:
2017
* Install Sphinx:
@@ -24,75 +21,100 @@ order to clone and update any dependent repositories.
2421
* Install spelling checker (optional)
2522
* `pip install pyenchant`
2623
* `pip install sphinxcontrib-spelling`
27-
* **Note:** Be sure to add Python scripts to PATH in order to build documentation from prebuild scripts.
28-
29-
#### Instructions
30-
* Simply execute the [pre_build.py](build/pre_build.py) Python script located in the GPA directory:
31-
* `python build/pre_build.py`
32-
* This script will clone any dependent repositories that are not present on the system. If any of the dependent repositories are already
33-
present on the system, this script will instead do a "git pull" on those repositories to ensure that they are up to date. Please re-run
34-
this script everytime you pull new changes from GPA repository.
35-
* **Note:** For GPA 3.3 and newer, if you are updating an existing clone of the GPA repo from a GPA release prior to 3.3, you will first need to delete the Common/Lib/Ext/GoogleTest directory. Starting with GPA 3.3, GPA is now using a fork of the official GoogleTest repo. Failure to remove this directory will lead to Git errors when running [pre_build.py](build/pre_build.py) or [fetch_dependencies.py](scripts/fetch_dependencies.py).
36-
* **Note:** For GPA 3.11 and newer, the Common/ directory has been removed, and the external/Lib/Ext/GoogleTest will first need to be deleted instead.
37-
* This script will also download and execute the Vulkan SDK installer.
38-
* On Windows, running the installer may require elevation. If you've previously installed the required Vulkan version, fetch_dependencies.py will simply copy the files from the default installation location into the correct place into the GPUPerfAPI directory tree.
39-
* fetch_dependencies.py is set up to install the version of the Vulkan SDK which was used during development. If you want to use a newer version of the SDK, the following file will need to be updated:
40-
* [fetch_dependencies.py](scripts/fetch_dependencies.py)
41-
* By default the build will expect the Vulkan SDK to be found in a directory pointed to by the `VULKAN_SDK` environment variable. This environment variable is automatically set by the Windows SDK installer, but you may need to set it manually after running the Linux SDK installer. The Linux SDK includes a script called `setup-env.sh` to aid in setting this environment variable:
42-
* `source ~/VulkanSDK/1.0.68.0/setup-env.sh` (adjust PATH as necessary)
43-
* This script also executes CMake to generate all required files to build GPA.
44-
* If you want to generate all CMake build files without trying to clone/pull dependent repos, you can add "--nofetch" to the [pre_build.py](build/pre_build.py) command line.
45-
* Additional switches that can be used with the [pre_build.py](build/pre_build.py) script:
46-
* `--vs=[2015,2017,2019,2022]`: Specify the Visual Studio version for which to generate projects. Default is 2022.
47-
* `--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.
48-
* `--platform=[x86,x64]`: Specify the platform for which to generate build files. Default is both.
49-
* `--clean`: Deletes CMakeBuild directory and regenerates all build files from scratch
50-
* `--skipdx11`: Does not generate build files for DX11 version of GPA (Windows only)
51-
* `--skipdx12`: Does not generate build files for DX12 version of GPA (Windows only)
52-
* `--skipvulkan`: Does not generate build files for Vulkan version of GPA
53-
* `--skipopengl`: Does not generate build files for OpenGL version of GPA
54-
* `--skipopencl`: Does not generate build files for OpenCL version of GPA
55-
* `--skiptests`: Does not generate build files for unit tests
56-
* `--skipdocs`: Does not generate build files for documentation
57-
* `--skipexamples`: Does not generate build files for GPA examples
58-
* `--cmakecmd="CMD"`: Override the "cmake" command with "CMD"
24+
* **Note:** Be sure to add Python scripts to PATH in order to build documentation from pre_build scripts.
5925

6026
## Windows Build Information
27+
The Windows projects each include a .rc file that embeds the VERSIONINFO resource into the final binary.
6128

6229
##### Prerequisites
63-
* Microsoft Visual Studio 2022
30+
* Microsoft Visual Studio 2022 (17.13.5)
6431
* Within the Visual Studio Installer, the following workloads:
6532
* Desktop development with C++
6633
* Within the Visual Studio Installer, the following individual components:
6734
* Windows 11 SDK (10.0.22621.0)
6835
* MSVC v143 - VS 2022 C++ x64/x86 build tools (latest)
6936
* C++ CMake tools for Windows
70-
* C++ Clang Compiler for Windows (15.0.1)
71-
* .NET Framework 4.6.2-4.8.1 SDKs and targeting packs
37+
* C++ Clang Compiler for Windows (19.1.1)
38+
* .NET SDK
39+
* .NET 8.0 Runtime (Long Term Support)
7240
* C# and Visual Basic
7341
* C# and Visual Basic Roslyn compilers
7442

75-
##### Build Instructions
76-
* Load build\win\vs2022_x64\GPUPerfAPI-x64.sln into Visual Studio to build the 64-bit version of GPA.
77-
* Load build\win\vs2022_x86\GPUPerfAPI-x86.sln into Visual Studio to build the 32-bit version of GPA.
78-
* After a successful build, the GPUPerfAPI binaries can be found in `gpu_performance_api\build\output\(configuration)` (e.g. gpu_performance_api\build\output\debug_x64).
79-
80-
#### Additional Information
81-
* The Windows projects each include a .rc file that embeds the VERSIONINFO resource into the final binary. Internally within AMD, a Jenkins build system will dynamically update.
82-
the build number. The version and build numbers can be manually updated by modifying the [gpa_version.h](source/gpu_perf_api_common/gpa_version.h) file.
83-
8443
## Linux Build Information
8544

8645
##### Prerequisites
8746
* Install the Mesa common development package:
8847
* `sudo apt-get install mesa-common-dev`
8948

90-
##### Build Instructions
91-
* Execute "make" in the build/linux/make_debug_x64 to build the 64-bit debug version of GPA.
92-
* Execute "make" in the build/linux/make_release_x64 to build the 64-bit release version of GPA.
93-
* After a successful build, the GPUPerfAPI binaries can be found in `gpu_performance_api/build/output/$(Configuration)` (e.g. gpu_performance_api/build/output/debug_x64).
49+
#### Instructions (pre_build.py)
50+
51+
GPA utilizes a python script pre_build.py to help users configure/setup the CMake build.
52+
```sh
53+
python build/pre_build.py --help
54+
```
55+
56+
Additional switches that can be used with the pre_build.py script:
57+
--vs=[2022]: Specify the Visual Studio version for which to generate projects. Default is 2022.
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.
59+
--clean: Delete cmake-generated directories created by this script
60+
--skipdx11: Does not generate build files for DX11 version of GPA (Windows only)
61+
--skipdx12: Does not generate build files for DX12 version of GPA (Windows only)
62+
--skipvulkan: Does not generate build files for Vulkan version of GPA
63+
--skipopengl: Does not generate build files for OpenGL version of GPA
64+
--skiptests: Does not generate build files for unit tests
65+
--skipdocs: Does not generate build files for documentation
66+
--skipexamples: Does not generate build files for GPA examples
67+
--cmakecmd="CMD": Override the "cmake" command with "CMD"
68+
69+
By default the project will not build the generated CMake project (Although you can with `--build`).
70+
71+
On Windows
72+
73+
* Load build\win\vs2022_x64\GPUPerfAPI-x64.sln into Visual Studio to build the 64-bit version of GPA.
74+
* After a successful build, the GPUPerfAPI binaries can be found in gpu_performance_api\build\output\(configuration) (e.g. gpu_performance_api\build\output\debug_x64).
75+
76+
You can use CMake to open the solution from the command line:
77+
```sh
78+
cmake --open build/win/vs2022_x64/
79+
```
80+
81+
On Linux
82+
83+
* Execute `make` in the build/linux/make_debug_x64 to build the 64-bit debug version of GPA.
84+
* Execute `make` in the build/linux/make_release_x64 to build the 64-bit release version of GPA.
85+
* After a successful build, the GPUPerfAPI binaries can be found in gpu_performance_api/build/output/$(Configuration) (e.g. gpu_performance_api/build/output/debug_x64).
86+
87+
#### Instructions (CMake)
88+
89+
You can also use CMake directly:
90+
91+
On Windows
92+
93+
Assuming you use `Visual Studio` which is the default `generator` on Windows
94+
95+
```sh
96+
cmake -S . -B build/win/
97+
cmake --build build/win/ --config Debug
98+
```
99+
100+
On Linux
101+
102+
Assuming you use `Unix Makefiles` which is the default `generator` on Windows
103+
104+
```sh
105+
cmake -S . -B build/linux -D CMAKE_BUILD_TYPE=Debug
106+
cmake --build build/linux
107+
```
108+
109+
NOTES:
110+
- You may want to configure with `-Dskipdocs=ON` if you don't want to add python scripts to your PATH.
111+
- You may want to configure with `-Dskipcsharp=ON` if you don't want to download C# development tools.
112+
- CMake 3.30+ brings drastic performance improvements to FetchContent highly recommended for developers.
94113

95114
## PublicCounterCompiler Tool
115+
116+
NOTE: The PublicCounterCompiler Tool requires using the `Visual Studio` generator due to `C#` usage!
117+
96118
The PublicCounterCompiler Tool is a C# utility that will generate C++ code to define the public (or derived) counters.
97119
It takes as input text files contained in the [public_counter_compiler_input_files](source/public_counter_compiler_input_files) directory and
98120
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)

CMakeLists.txt

Lines changed: 68 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,43 +1,88 @@
11
## Copyright (c) 2018-2025 Advanced Micro Devices, Inc. All rights reserved.
2-
cmake_minimum_required(VERSION 3.10)
2+
cmake_minimum_required(VERSION 3.25)
3+
set(GPA_CMAKE_MODULES_DIR ${CMAKE_CURRENT_SOURCE_DIR}/build/cmake_modules)
34

4-
set(DEPTH "./")
5-
6-
message(STATUS "Generating project files for GPA....")
7-
set(GPA_CMAKE_MODULES_DIR ${CMAKE_CURRENT_SOURCE_DIR}/build/cmake_modules)
8-
9-
set(CMAKE_CXX_STANDARD 17)
10-
set(CMAKE_CXX_STANDARD_REQUIRED ON)
11-
set(CMAKE_CXX_EXTENSIONS OFF)
5+
set(GPA_MAJOR_VERSION 4)
6+
set(GPA_MINOR_VERSION 1)
7+
set(GPA_UPDATE_VERSION 0)
128

139
if(NOT DEFINED build)
1410
set(GPA_BUILD_NUMBER 0)
1511
else()
1612
set(GPA_BUILD_NUMBER ${build})
1713
endif()
14+
set(ProjectSuffix "-x64")
15+
project(GPUPerfAPI${ProjectSuffix} VERSION ${GPA_MAJOR_VERSION}.${GPA_MINOR_VERSION}.${GPA_UPDATE_VERSION}.${GPA_BUILD_NUMBER} LANGUAGES C CXX)
1816

19-
include(${GPA_CMAKE_MODULES_DIR}/gpa_version.cmake)
2017
include(${GPA_CMAKE_MODULES_DIR}/defs.cmake)
2118
include(${GPA_CMAKE_MODULES_DIR}/build_flags.cmake)
19+
include(${GPA_CMAKE_MODULES_DIR}/utils.cmake)
20+
include(${GPA_CMAKE_MODULES_DIR}/common.cmake)
21+
include(${GPA_CMAKE_MODULES_DIR}/fetch_dependencies.cmake)
2222

23-
if (WIN32)
24-
if (${build-32bit})
25-
set(PlatformSuffix "-x86")
26-
else()
27-
set(PlatformSuffix "-x64")
28-
endif()
23+
24+
set(CMAKE_CXX_STANDARD 17)
25+
set(CMAKE_CXX_STANDARD_REQUIRED ON)
26+
set(CMAKE_CXX_EXTENSIONS OFF)
27+
28+
if(NOT ${skiptests} AND NOT TARGET gtest)
29+
enable_testing()
30+
block()
31+
set(CMAKE_FOLDER "Tests")
32+
set(BUILD_GMOCK OFF)
33+
set(INSTALL_GTEST OFF)
34+
add_subdirectory(external/googletest EXCLUDE_FROM_ALL SYSTEM)
35+
if (MSVC)
36+
target_compile_options(gtest PRIVATE
37+
"$<$<CONFIG:RELEASE>:/MT>"
38+
"$<$<CONFIG:DEBUG>:/MTd>"
39+
)
40+
endif()
41+
endblock()
2942
endif()
3043

44+
add_subdirectory(external/adl)
45+
add_subdirectory(external/tsingleton)
46+
add_subdirectory(external/adl_util)
47+
add_subdirectory(external/dynamic_library_module)
48+
49+
if(NOT ${skipdocs})
50+
add_subdirectory(documentation/sphinx)
51+
endif()
52+
53+
add_subdirectory(source)
54+
3155

32-
set(GPA_ALL_OPEN_SOURCE ON)
56+
set(CPACK_ARCHIVE_COMPONENT_INSTALL ON)
57+
set(CPACK_COMPONENTS_GROUPING IGNORE)
3358

34-
if(${BUILD_ANDROID})
35-
include (${GPA_CMAKE_MODULES_DIR}/android.cmake)
59+
install(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/include/gpu_performance_api" DESTINATION ${GPA_INSTALL_INCLUDEDIR} COMPONENT GPUPerfAPI)
60+
install(FILES LICENSE.txt NOTICES.txt DESTINATION ${GPA_INSTALL_PREFIX} COMPONENT GPUPerfAPI)
61+
62+
# Create the archive's suffix (ie: <GPUPerfAPI>[-Android|-Linux]-<version>.[zip|tgz])
63+
set(ARCHIVE_SUFFIX "")
64+
if (LINUX)
65+
set(ARCHIVE_SUFFIX "${ARCHIVE_SUFFIX}-Linux")
66+
elseif (ANDROID)
67+
set(ARCHIVE_SUFFIX "${ARCHIVE_SUFFIX}-Android")
68+
endif()
69+
set(ARCHIVE_SUFFIX "${ARCHIVE_SUFFIX}-${PROJECT_VERSION}")
70+
if (GPA_PACKAGE_SUFFIX)
71+
set(ARCHIVE_SUFFIX "${ARCHIVE_SUFFIX}-${GPA_PACKAGE_SUFFIX}")
72+
endif()
73+
set(CPACK_PACKAGE_VENDOR "AMD")
74+
if (WIN32)
75+
set(CPACK_GENERATOR "ZIP")
76+
else()
77+
set(CPACK_GENERATOR "TGZ")
78+
# By default CMake uses .tar.gz
79+
set(CPACK_ARCHIVE_FILE_EXTENSION "tgz")
3680
endif()
81+
set(CPACK_PACKAGE_DIRECTORY ${GPA_OUTPUT_DIR})
82+
set(CPACK_INCLUDE_TOPLEVEL_DIRECTORY OFF)
3783

38-
## Define the GPA solution name
39-
project(GPUPerfAPI${PlatformSuffix} VERSION ${GPA_MAJOR_VERSION}.${GPA_MINOR_VERSION} LANGUAGES C CXX)
84+
set(CPACK_ARCHIVE_GPUPERFAPI_FILE_NAME "GPUPerfAPI${ARCHIVE_SUFFIX}")
4085

41-
include(${GPA_CMAKE_MODULES_DIR}/targets.cmake)
86+
include(CPack)
4287

43-
message(STATUS "Finished generating project files for GPA.")
88+
cpack_add_component(GPUPerfAPI)

CMakeSettings.json

Lines changed: 0 additions & 47 deletions
This file was deleted.

LICENSE.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Copyright (c) 2016-2024 Advanced Micro Devices, Inc. All rights reserved.
1+
Copyright (c) 2016-2025 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
@@ -80,7 +80,7 @@ License Text
8080
This program is freely distributable without licensing fees and is provided without guarantee or warrantee expressed or implied. This program is -not- in the public domain.
8181

8282

83-
google-googletest v1.8 (Apache-2.0)
83+
google-googletest v1.16 (Apache-2.0)
8484
Copyright 2009 Neal Norwitz All Rights Reserved.
8585
Portions Copyright 2009 Google Inc. All Rights Reserved.
8686
Apache License
@@ -121,7 +121,7 @@ Unless required by applicable law or agreed to in writing, software distributed
121121
See the License for the specific language governing permissions and limitations under the License.
122122

123123

124-
google-googletest v1.8.1 (BSD-3-Clause)
124+
google-googletest v1.16.0 (BSD-3-Clause)
125125
Copyright 2008, Google Inc.
126126
All rights reserved.
127127
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

0 commit comments

Comments
 (0)