Skip to content

Commit

Permalink
Update source code for RMV v1.10 release
Browse files Browse the repository at this point in the history
  • Loading branch information
ahosier committed Jul 1, 2024
1 parent a20908b commit de5ef12
Show file tree
Hide file tree
Showing 78 changed files with 567 additions and 568 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@ documentation/build
documentation/source/_build
source/frontend/util/version.h
Buildinfo.properties
external
.vscode
*.aps

60 changes: 30 additions & 30 deletions BUILD.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,21 @@ Clone the project radeon_memory_visualizer from github.com
git clone https://github.com/GPUOpen-Tools/radeon_memory_visualizer.git
```

### Get Qt6
Qt V6.7.0 can be installed using the Qt online installer available from the Qt 6.7.0 release page [here][qt-online].
As an alternative, the Qt 6.7.0 offline installer can be used [here][qt-offline].
Packages for Windows and Linux are provided.

### Building on Windows
As a preliminary step, make sure that you have the following installed on your system:
* CMake 3.11 or above.
* Python 3.7 or above.
* Qt® 5 or above (5.15.2 is the default and recommended).
* Qt® 6 or above (6.7.0 is the default and recommended).
* Visual Studio® 2015 or above (2019 is the default).

Qt V5.15.2 can be installed using the Qt online installer available from the Qt 5.15.2 release page [here][qt-online].
As an alternative, the Qt 5.12.6 offline installer can be used [here][qt-offline].
Qt should be installed to the default location (C:\Qt\Qt5.xx.x).
Qt should be installed to the default location (C:\Qt\Qt6.xx.x).
Be sure to select msvc2017/msvc2019 64-bit during Qt installation, depending on the compiler you decide to use.
Select msvc2019 if using Visual Studio 2022.
A reboot is required after Qt is installed.

CMake can be downloaded from [here](https://cmake.org/download/).
Expand All @@ -27,7 +31,7 @@ This can be installed once Python is installed, as follows:
* pip install -U sphinx
* pip install sphinx_rtd_theme

Run the python pre_build.py script in the build folder from a command prompt. If no command line options are provided, the defaults will be used (Qt 5.15.2 and Visual Studio 2019)
Run the python pre_build.py script in the build folder from a command prompt. If no command line options are provided, the defaults will be used (Qt 6.7.0 and Visual Studio 2022)

Some useful options of the pre_build.py script:
* --vs <Visual Studio version>: generate the solution files for a specific Visual Studio version. For example, to target Visual Studio 2017, add --vs 2017 to the command.
Expand All @@ -38,6 +42,8 @@ Go into the 'vs2019' folder (build/win/vs2019) and double click on the RMV.sln f
The Release and Debug builds of RMV will be available in the build/release and build/debug folders.

### Building on Ubuntu
If Qt is installed from a Qt installer, it should be installed to ~/Qt/Qt6.7.0 (the default of ~/Qt6.7.0 will not work).

Required dependencies can be installed as follows:
```bash
sudo apt-get update
Expand All @@ -51,21 +57,26 @@ sudo apt-get install python3-sphinx
sudo apt-get install libxcb-xinerama0
sudo apt-get install mesa-common-dev libglu1-mesa-dev
```
Qt V5.15.2 can be installed using the Qt online installer available from the Qt 5.15.2 release page [here][qt-online].
As an alternative, the Qt 5.12.6 offline installer can be used [here][qt-offline] (the .run file) and installed
to ~/Qt/Qt5.12.6 (the default of ~/Qt5.12.6 will not work).

XCB libraries are required for Qt v5.15.x (they are not needed for older Qt versions). By default, the CMake configuration will attempt to copy
these files from the Qt lib folder. If needed, the XCB library files (libxcb*) can be obtained from the /lib folder of the Radeon Developer Tool
Suite download found [here](https://gpuopen.com/tools/).
Qt6 can be installed from the package manager using:
```bash
sudo apt-get install qt6-base-dev
sudo apt-get install qt6-base-private-dev
```
As of this writing, this package on Ubuntu 2204 is 6.2.4

XCB libraries are required for Qt v5 and above. These can be installed by using:
```bash
sudo apt-get install libxcb-cursor-dev
```

Run the python pre_build.py in the build folder.
```bash
python3 pre_build.py
```
Or run the pre_build.py script with the -qt option to specify another version of Qt. For example:
```bash
python3 pre_build.py --qt 5.12.6
python3 pre_build.py --qt 6.7.0
```
The pre_build.py script will construct the output folders and build the necessary makefiles.
To build the release build, use:
Expand All @@ -81,25 +92,14 @@ Alternatively, building can be done directly from the prebuild script with the -
python3 pre_build.py --build
```

It is possible to use the system-installed version of Qt rather than using a Qt installer described above. At the time of this writing, Ubuntu 22.04 LTS
comes with Qt 5.15.3. To use the system Qt, a fake Qt package is needed. For Qt 5.15.3, this can be made by creating the required directory structure
If Qt is not installed from a Qt installer, a fake Qt package is needed. This can be made by creating the required directory structure
and setting up symbolic links to point to the system Qt lib and include directories:
```bash
mkdir -p ~/Qt/Qt5.15.3/5.15.3/gcc_64
sudo ln -s /usr/lib/x86_64-linux-gnu ~/Qt/Qt5.15.3/5.15.3/gcc_64/lib
sudo ln -s /usr/include/x86_64-linux-gnu/qt5 ~/Qt/Qt5.15.3/5.15.3/gcc_64/include
```
python3 pre_build.py --qt 5.15.3 --qt-system --build

Some additional Qt components may be required, so install those:

```
sudo apt-get install qtbase5-dev
sudo apt-get install qtbase5-dev-tools
sudo apt-get install libqt5svg5-dev
sudo apt-get install libqt5x11extras5
sudo apt-get install qtbase5-private-dev
mkdir -p ~/Qt/Qt6.7.0/6.7.0/gcc_64
sudo ln -s /usr/lib/x86_64-linux-gnu ~/Qt/Qt6.7.0/6.7.0/gcc_64/lib
sudo ln -s /usr/include/x86_64-linux-gnu/qt6 ~/Qt/Qt6.7.0/6.7.0/gcc_64/include
```
python3 pre_build.py --qt 6.7.0 --build

[qt-online]: https://www.qt.io/blog/qt-5.15.2-released
[qt-offline]: https://download.qt.io/archive/qt/5.12/5.12.6/
[qt-online]: https://www.qt.io/blog/qt-6.7-released
[qt-offline]: https://download.qt.io/archive/qt/6.7/6.7.0
18 changes: 1 addition & 17 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,12 @@ cmake_minimum_required(VERSION 3.11)

set(SYSTEM_INFO_BUILD_RDF_INTERFACES ON)


## Specify the top level name of the project - this will define the solution name for Visual Studio
project(RMV)

# Define version information
set(RMV_MAJOR_VERSION 1)
set(RMV_MINOR_VERSION 9)
set(RMV_MINOR_VERSION 10)
if (NOT RMV_BUGFIX_NUMBER)
set(RMV_BUGFIX_NUMBER 0)
endif ()
Expand Down Expand Up @@ -60,7 +59,6 @@ ELSE(WIN32)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_DEBUG ${CMAKE_BINARY_DIR}/../../debug)
ENDIF(WIN32)


# Add for CentOS compiler warning
add_definitions(-DJSON_SKIP_UNSUPPORTED_COMPILER_CHECK)

Expand Down Expand Up @@ -168,18 +166,6 @@ if(SPHINX_EXECUTABLE)
COMMAND ${CMAKE_COMMAND} -E echo "building Sphinx documentation"
COMMAND ${SPHINX_EXECUTABLE} ${CMAKE_SOURCE_DIR}/documentation/source ${DOCS_OUTPUT_DIR}/help/rmv/. -t ${SPHINX_OPTION}
COMMAND ${CMAKE_COMMAND} -E remove_directory ${DOCS_OUTPUT_DIR}/help/rmv/.doctrees
COMMAND ${CMAKE_COMMAND} -E remove ${DOCS_OUTPUT_DIR}/help/rmv/allocation_explorer.html
COMMAND ${CMAKE_COMMAND} -E remove ${DOCS_OUTPUT_DIR}/help/rmv/allocation_overview.html
COMMAND ${CMAKE_COMMAND} -E remove ${DOCS_OUTPUT_DIR}/help/rmv/capture.html
COMMAND ${CMAKE_COMMAND} -E remove ${DOCS_OUTPUT_DIR}/help/rmv/carousel.html
COMMAND ${CMAKE_COMMAND} -E remove ${DOCS_OUTPUT_DIR}/help/rmv/heap_overview.html
COMMAND ${CMAKE_COMMAND} -E remove ${DOCS_OUTPUT_DIR}/help/rmv/memory_leak_finder.html
COMMAND ${CMAKE_COMMAND} -E remove ${DOCS_OUTPUT_DIR}/help/rmv/resource_details.html
COMMAND ${CMAKE_COMMAND} -E remove ${DOCS_OUTPUT_DIR}/help/rmv/resource_list.html
COMMAND ${CMAKE_COMMAND} -E remove ${DOCS_OUTPUT_DIR}/help/rmv/resource_overview.html
COMMAND ${CMAKE_COMMAND} -E remove ${DOCS_OUTPUT_DIR}/help/rmv/settings.html
COMMAND ${CMAKE_COMMAND} -E remove ${DOCS_OUTPUT_DIR}/help/rmv/snapshot_delta.html
COMMAND ${CMAKE_COMMAND} -E remove ${DOCS_OUTPUT_DIR}/help/rmv/timeline.html
)
else()
message(WARNING "SPHINX_EXECUTABLE (sphinx-build) is not found! Documentation will not be built!")
Expand All @@ -194,5 +180,3 @@ add_custom_command(TARGET Documentation POST_BUILD
COMMAND ${CMAKE_COMMAND} -E make_directory ${DOCS_OUTPUT_DIR}/samples
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_SOURCE_DIR}/samples/sample_trace.rmv ${DOCS_OUTPUT_DIR}/samples/.
)


5 changes: 3 additions & 2 deletions build/dependency_map.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,9 @@
# Define a set of dependencies that exist as separate git projects.
# each git dependency has a desired directory where it will be cloned - along with a commit to checkout
git_mapping = {
github_tools + "QtCommon" : ["../external/qt_common", "v3.12.0", True],
github_tools + "UpdateCheckApi" : ["../external/update_check_api", "v2.1.0", True],
github_tools + "qt_common" : ["../external/qt_common", "v4.0.0", True],
github_tools + "update_check_api" : ["../external/update_check_api", "v2.1.1", True],
github_tools + "system_info_utils" : ["../external/system_info_utils", "88a338a01949f8d8bad60a30b78b65300fd13a9f", False],
github_root + "GPUOpen-Drivers/libamdrdf" : ["../external/rdf", "v1.1.2", True],
}

5 changes: 5 additions & 0 deletions build/fetch_dependencies.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@
## \brief Script to fetch all external git and/or downloadable dependencies
## needed to build the project.
##
## fetch_dependencies.py (--internal)
##
## If --internal is specified, then any additional dependencies required for internal builds will also
## be checked out.
##
## Each git repo will be updated to the commit specified in the "gitMapping" table.
##=============================================================================

Expand Down
14 changes: 8 additions & 6 deletions build/pre_build.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
import argparse
import shutil
import subprocess
import distutils.spawn
import platform
import time

Expand Down Expand Up @@ -63,9 +62,10 @@
else:
parser.add_argument("--qt-root", default="~/Qt", help="specify the root directory for locating QT on this system (default: ~/Qt) ")
parser.add_argument("--qt-system", action="store_true", help="use the system-installed version of QT")
parser.add_argument("--qt", default="5.15.2", help="specify the version of QT to be used with the script (default: 5.15.2)" )
parser.add_argument("--qt", default="6.7.0", help="specify the version of QT to be used with the script (default: 6.7.0)" )
parser.add_argument("--clean", action="store_true", help="delete any directories created by this script")
parser.add_argument("--no-qt", action="store_true", help="build a headless version (not applicable for all products)")
parser.add_argument("--build-number", default="0", help="specify the build number, primarily to be used by build machines to produce versioned builds")
parser.add_argument("--update", action="store_true", help="Force fetch_dependencies script to update all dependencies")
parser.add_argument("--output", default=output_root, help="specify the output location for generated cmake and build output files (default = OS specific subdirectory of location of PreBuild.py script)")
parser.add_argument("--build", action="store_true", help="build all supported configurations on completion of prebuild step")
Expand Down Expand Up @@ -114,10 +114,10 @@ def mkdir_print(dir):
# Look for Qt path in specified Qt root directory
# Example:
# --qt-root=C:\\Qt
# --qt=5.15.2
# Look first for C:\\Qt\\Qt5.15.2\\5.15.2
# --qt=6.7.0
# Look first for C:\\Qt\\Qt6.7.0\\6.7.0
# (if not found..)
# Look next for C:\\Qt\\5.15.2
# Look next for C:\\Qt\\6.7.0
#
# If neither of those can be found AND we are using the default
# qt-root dir (i.e. the user did not specify --qt-root), then also
Expand Down Expand Up @@ -262,6 +262,8 @@ def generate_config(config):
if args.qt_system:
cmake_args.extend(["-DQT_SYSTEM:BOOL=TRUE"])

cmake_args.extend(["-DRMV_BUILD_NUMBER=" + str(args.build_number)])

cmake_args.extend(["-DCMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE=" + release_output_dir])
cmake_args.extend(["-DCMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE=" + release_output_dir])
cmake_args.extend(["-DCMAKE_RUNTIME_OUTPUT_DIRECTORY_DEBUG=" + debug_output_dir])
Expand Down Expand Up @@ -324,7 +326,7 @@ def generate_config(config):
with open(vscode_json_file, 'w') as f:
json.dump(json_data, f, indent=4)

if not distutils.spawn.find_executable(cmake_args[0]):
if not shutil.which(cmake_args[0]):
log_error_and_exit("cmake not found")

p = subprocess.Popen(cmake_args, cwd=cmake_dir, stderr=subprocess.STDOUT)
Expand Down
15 changes: 12 additions & 3 deletions cmake/devtools_qt_helper.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@

cmake_minimum_required(VERSION 3.10)


# Attempt to automatically find Qt on the local machine
if (UNIX AND NOT APPLE)
find_package(Qt6 QUIET COMPONENTS Core Widgets Network Gui Svg Test GuiPrivate CorePrivate)
Expand All @@ -32,6 +31,16 @@ if (NOT Qt6_DIR)
endif ()
endif ()

# linuxdeployqt
if (UNIX AND NOT APPLE)

find_program(LINUXDEPLOYQT "linuxdeployqt" HINTS "${PROJECT_SOURCE_DIR}/external/linuxdeployqt")
if (LINUXDEPLOYQT)
message(STATUS "Found linuxdeployqt: ${LINUXDEPLOYQT}")
else ()
message(ERROR "linuxdeployqt not found but is required for build")
endif ()
endif ()

if (Qt5_DIR OR Qt6_DIR)
#######################################################################################################################
Expand All @@ -57,7 +66,7 @@ if (Qt5_DIR OR Qt6_DIR)
if (WIN32)
if (Qt6_DIR)
set(DEPLOYQT_POST_BUILD_COMMAND
${DEPLOYQT_EXECUTABLE} $<TARGET_FILE:${target}> -verbose 0 --no-compiler-runtime --no-translations
${DEPLOYQT_EXECUTABLE} $<TARGET_FILE:${target}> -verbose 0 --no-compiler-runtime --no-translations --no-system-d3d-compiler --no-system-dxc-compiler --no-opengl-sw --no-network
WORKING_DIRECTORY ${output_directory})
else ()
set(DEPLOYQT_POST_BUILD_COMMAND
Expand All @@ -67,7 +76,7 @@ if (Qt5_DIR OR Qt6_DIR)
elseif (UNIX AND NOT APPLE)
set(DEPLOYQT_POST_BUILD_COMMAND
${CMAKE_COMMAND} -E env LD_LIBRARY_PATH=${EXTERNAL_DIR}/libtraceevent/lib:${EXTERNAL_DIR}/libtracefs/lib:${_qt_bin_dir}/../lib
${DEPLOYQT_EXECUTABLE} $<TARGET_FILE:${target}> -qmake=${QT_QMAKE_EXECUTABLE} -verbose=0 -unsupported-allow-new-glibc
${DEPLOYQT_EXECUTABLE} $<TARGET_FILE:${target}> -qmake=${QT_QMAKE_EXECUTABLE} -verbose=0 -unsupported-allow-new-glibc -no-translations
WORKING_DIRECTORY ${output_directory})
elseif (include_mac)

Expand Down
33 changes: 29 additions & 4 deletions source/backend/rmt_data_set.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
#else
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#include <corecrt_io.h>
#endif // #ifdef _LINUX

// Determine if a file is read only.
Expand All @@ -58,6 +59,30 @@ static bool IsFileReadOnly(const char* file_path)
#endif
}

/// @brief Opens a file with the option of preventing other processes from inheriting the handle.
///
// @param [out] file_descriptor A pointer to the file descriptor to be opened.
// @param [in] file_name A pointer to the file name to be opened.
// @param [in] mode The mode to open the file in.
// @param [in] prevent_inheritance A flag that, if true, prevents inheritance of the file handle.
///
/// @return An error code indicating the result of the operation (0 indicates success).
///
static errno_t OpenFile(FILE** file_descriptor, char const* file_name, char const* mode, bool prevent_inheritance)
{
errno_t error_no = fopen_s(file_descriptor, file_name, mode);
#ifdef WIN32
if ((error_no == 0) && (prevent_inheritance))
{
// Disable inheritance of the file handle.
SetHandleInformation((HANDLE)_get_osfhandle(_fileno(*file_descriptor)), HANDLE_FLAG_INHERIT, 0);
}
#else
RMT_UNUSED(prevent_inheritance);
#endif
return error_no;
}

/// @brief Determine if the trace file is an RGD crash dump.
///
/// @param [in] path A pointer to the trace file path to be checked.
Expand Down Expand Up @@ -1118,7 +1143,7 @@ static RmtErrorCode CommitTemporaryFileEdits(RmtDataSet* data_set, bool remove_t
else
{
data_set->file_handle = NULL;
errno_t error_no = fopen_s((FILE**)&data_set->file_handle, data_set->temporary_file_path, "rb+");
errno_t error_no = OpenFile((FILE**)&data_set->file_handle, data_set->temporary_file_path, "rb+", true);

RMT_ASSERT(data_set->file_handle);
RMT_ASSERT(error_no == 0);
Expand Down Expand Up @@ -1187,7 +1212,7 @@ RmtErrorCode RmtDataSetInitialize(const char* path, RmtDataSet* data_set)
{
// Determine if the back up file or original file should be opened. If the backup file can't be opened with write privileges
// (because another RMV instance already has opened it), set the read only flag and attempt to open the original file in read only mode.
error_no = fopen_s((FILE**)&data_set->file_handle, trace_file, file_access_mode);
error_no = OpenFile((FILE**)&data_set->file_handle, trace_file, file_access_mode, true);
if ((data_set->file_handle == nullptr) || error_no != 0)
{
// Set the read only flag so that opening the original file will be attempted.
Expand All @@ -1200,7 +1225,7 @@ RmtErrorCode RmtDataSetInitialize(const char* path, RmtDataSet* data_set)
// File is read-only. Attempt to just read the original rmv trace file.
file_access_mode = "rb";
trace_file = data_set->file_path;
error_no = fopen_s((FILE**)&data_set->file_handle, trace_file, file_access_mode);
error_no = OpenFile((FILE**)&data_set->file_handle, trace_file, file_access_mode, true);
if ((data_set->file_handle == nullptr) || error_no != 0)
{
error_code = kRmtErrorFileNotOpen;
Expand All @@ -1227,7 +1252,7 @@ RmtErrorCode RmtDataSetInitialize(const char* path, RmtDataSet* data_set)
if (error_code != kRmtOk)
{
// Loading as an RDF file failed, attempt to open the trace file using the legacy format.
error_no = fopen_s((FILE**)&data_set->file_handle, trace_file, file_access_mode);
error_no = OpenFile((FILE**)&data_set->file_handle, trace_file, file_access_mode, true);
if ((data_set->file_handle != nullptr) && (error_no == 0))
{
error_code = kRmtOk;
Expand Down
1 change: 1 addition & 0 deletions source/backend/rmt_data_timeline.h
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ typedef struct RmtDataTimeline
int32_t* series_memory_buffer; ///< The size of the series memory buffer. This is subdivided into the series and levels.
uint64_t maximum_value_in_all_series; ///< The maxim value seen at any one time in all series.
RmtDataTimelineType timeline_type; ///< The type of timeline.
uint32_t filter_mask; ///< Bit mask used to filter one or more of the series.
} RmtDataTimeline;

/// Destroy the timeline (and free underlaying memory allocated for this).
Expand Down
1 change: 1 addition & 0 deletions source/backend/rmt_rdf_file_parser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ static RmtErrorCode LoadSegmentChunk(rdfChunkFile* chunk_file, RmtDataSet* data_
{
data_set->segment_info[count].base_address = data.physical_base_address;
data_set->segment_info[count].heap_type = static_cast<RmtHeapType>(data.type);

data_set->segment_info[count].index = 0;
data_set->segment_info[count].size = data.size;
count++;
Expand Down
Loading

0 comments on commit de5ef12

Please sign in to comment.