Skip to content

Commit

Permalink
Updates for 2.6 release.
Browse files Browse the repository at this point in the history
  • Loading branch information
AmitBM committed Jan 20, 2022
1 parent 7ed370e commit 4eefcb2
Show file tree
Hide file tree
Showing 594 changed files with 78,111 additions and 5,852 deletions.
7 changes: 1 addition & 6 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,12 +1,6 @@
build/CMake
build/windows
build/linux
external/dx10_asm/lib/VS2015/Win32/Release*
external/dx10_asm/lib/VS2015/x64
external/dxc/dxcompiler.dll
external/lc/disassembler
external/vulkan/tools/windows/lib/Debug
external/vulkan_offline
Output
.vscode
Output_Test
Expand All @@ -17,3 +11,4 @@ documentation/build
obj
build/__pycache__
external/code_sanitizer
*.pyc
20 changes: 10 additions & 10 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -122,16 +122,6 @@ if (RGA_ENABLE_VULKAN)
add_definitions("-DRGA_ENABLE_VULKAN")
endif()

# Add Common projects
add_subdirectory (${CMAKE_CURRENT_SOURCE_DIR}/../Common/Src/AMDTBaseTools ${CMAKE_CURRENT_BINARY_DIR}/Common/Src/AMDTBaseTools)
add_subdirectory (${CMAKE_CURRENT_SOURCE_DIR}/../Common/Src/AMDTOSWrappers ${CMAKE_CURRENT_BINARY_DIR}/Common/Src/AMDTOSWrappers)

# Disable specific MS compiler warnings for Common targets
if(${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
target_compile_options(AMDTBaseTools PRIVATE "/wd4309")
target_compile_options(AMDTOSWrappers PRIVATE "/wd4275" "/wd4309")
endif()

# Add RGA CLI projects
if(NOT BUILD_GUI_ONLY)
if (RGA_ENABLE_VULKAN)
Expand All @@ -145,6 +135,16 @@ endif()
# Add source folder
add_subdirectory (source)

# Add amdt_os_wrappers and amdt_base_tools.
add_subdirectory (${CMAKE_CURRENT_SOURCE_DIR}/external/amdt_base_tools)
add_subdirectory (${CMAKE_CURRENT_SOURCE_DIR}/external/amdt_os_wrappers)

# Disable specific MS compiler warnings for Common targets
if(${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
target_compile_options(AMDTBaseTools PRIVATE "/wd4309")
target_compile_options(AMDTOSWrappers PRIVATE "/wd4275" "/wd4309")
endif()

# Add Tests
if(AMD_INTERNAL)
add_subdirectory (${PROJECT_SOURCE_DIR}/../RGA-Internal/tests ${CMAKE_CURRENT_BINARY_DIR}/tests)
Expand Down
18 changes: 9 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,18 +53,18 @@ As a preliminary step, make sure that you have the following installed on your s
* Python 2.7 or above
* Qt (in case that you are interested in building the GUI app; you can build the command line executable without Qt). Qt 5.15.2 is recommended.

cd to the Build sub-folder, and run:
cd to the build sub-folder, and run:

Prebuild.bat --qt <path of Qt's msvc2017_64 folder> --vs 2017
prebuild.bat --qt <path of Qt's msvc2017_64 folder> --vs 2017

Where <path to Qt's msvc2017_64 folder> is the path to the Qt msvc2017_64 folder, such as C:\Qt\Qt5.15.2\msvc2017_64.

Running the Prebuild script will fetch all the dependencies and generate the solution file for Visual Studio.
Running the prebuild script will fetch all the dependencies and generate the solution file for Visual Studio.
After successfully running the preuild script, open RGA.sln from build\windows\vs2019 (or vs2017), and build:
* RadeonGPUAnalyzerCLI project for the command line executable
* RadeonGPUAnalyzerGUI project for the GUI app

Some useful options of the Prebuild script:
Some useful options of the prebuild script:
* --vs <VS version>: generate the solution files for a specific Visual Studio version. For example, to target VS 2019, add --vs 2019 to the command.
* --qt <path>: full path to the folder from where you would like the Qt binaries to be retrieved. By default, CMake would try to auto-detect Qt on the system.
* --vk-include and --vk-lib: full paths to where the Vulkan SDK include and Vulkan lib folders. By default, CMake would try to auto-detect the Vulkan SDK on the system.
Expand All @@ -76,7 +76,7 @@ named "utils" under the RGA executable's directory (for example, D3DCompiler_47.

-=-

If for some reason you do not want to use the Prebuild.bat script, you can also manually fetch the dependencies and generate the solution and project files:
If for some reason you do not want to use the prebuild.bat script, you can also manually fetch the dependencies and generate the solution and project files:
Start by running the FetchDependencies.py script to fetch the solution's dependencies.
To generate the solution file for VS 2017 in x64 configuration, use:

Expand All @@ -93,7 +93,7 @@ named "utils" under the RGA executable's directory (for example, D3DCompiler_47.
* sudo apt-get install libglu1-mesa-dev mesa-common-dev libgtk2.0-dev
* sudo apt-get install zlib1g-dev libx11-dev:i386
* Install CMake 3.10 or above. For auto-detecting the Vulkan SDK version 3.7 or above is required.
* Install python 2.7 (or above)
* Install python 3.6 (or above)
* To build the GUI app, you should also have Qt installed

* Build:
Expand All @@ -102,17 +102,17 @@ named "utils" under the RGA executable's directory (for example, D3DCompiler_47.

On Linux, it is recommended to explicitly pass to CMake the location of the Vulkan SDK include and lib directories as well as the location of Qt. For example:

./Prebuild.sh --qt ~/Qt-5.15.2/5.15.2/gcc_64 --vk-include ~/work/vulkan-sdk/1.1.97.0/x86_64/include/ --vk-lib ~/work/vulkan-sdk/1.1.97.0/x86_64/lib/
./prebuild.sh --qt ~/Qt-5.15.2/5.15.2/gcc_64 --vk-include ~/work/vulkan-sdk/1.1.97.0/x86_64/include/ --vk-lib ~/work/vulkan-sdk/1.1.97.0/x86_64/lib/

This will fetch all the dependencies and generate the make files.

Then, cd to the auto-generated subfolder build/linux/make and run make.

-=-

If for some reason you do not want to use the Prebuild.sh script, you can also manually fetch the dependencies and generate the makefiles:
If for some reason you do not want to use the prebuild.sh script, you can also manually fetch the dependencies and generate the makefiles:

* run: FetchDependencies.py
* run: python3 fetch_dependencies.py
* run: cmake –DCMAKE_BUILD_TYPE=Release (or: Debug) <full or relative path to the RGA repo directory>

It is recommended to create a directory to hold all build files, and launch cmake from that directory.
Expand Down
47 changes: 9 additions & 38 deletions build/dependency_map.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,6 @@
# RGA git project names and revisions
#

# Binaries dependencies in zip files
zip_files = {
"dx10_asm.zip" : "external/",
"lc.zip" : "external/",
"dxc.zip" : "external/",
"vulkan_offline.zip" : "external/",
"vulkan.zip" : "external/"
}

# key = GitHub release link
# value = location
download_mapping_windows = {
Expand All @@ -25,45 +16,25 @@

# repositories.
git_mapping = {
"common-src-DeviceInfo" : ["Common/Src/DeviceInfo", "amd-navi24-alpha"]
}

github_mapping = {
# Lib.
"common-lib-AMD-ACL" : ["Common/Lib/AMD/ACL", "master"],
"common-lib-amd-ADL" : ["Common/Lib/AMD/ADL", "master"],
"common-lib-amd-APPSDK-3.0" : ["Common/Lib/AMD/APPSDK", "master"],
"common-lib-AMD-CAL-8.95" : ["Common/Lib/AMD/CAL", "master"],
"common-lib-amd-ags-4.0.0" : ["Common/Lib/AMD/ags", "master"],
"common-lib-ext-Boost-1.59" : ["Common/Lib/Ext/Boost", "master"],
"common-lib-ext-tinyxml-2.6.2" : ["Common/Lib/Ext/tinyxml", "master"],
"common-lib-ext-utf8cpp" : ["Common/Lib/Ext/utf8cpp", "master"],
"common-lib-ext-WindowsKits" : ["Common/Lib/Ext/Windows-Kits", "master"],
"common-lib-ext-zlib-1.2.8" : ["Common/Lib/Ext/zlib", "master"],
"common-lib-ext-tinyxml2-5.0.1" : ["Common/Lib/Ext/tinyxml2", "master"],
"cxxopts" : ["Common/Lib/Ext/cxxopts", "master"],
"volk" : ["Common/Lib/Ext/volk", "master"],
# Src.
"common-src-ACLModuleManager" : ["Common/Src/ACLModuleManager", "master"],
"common-src-ADLUtil" : ["Common/Src/ADLUtil", "master"],
"common-src-AMDTBaseTools" : ["Common/Src/AMDTBaseTools", "master"],
"common-src-AMDTOSWrappers" : ["Common/Src/AMDTOSWrappers", "6a5293d6a4f00c70747f935a4122a1b986129396"],
"common-src-AMDTMutex" : ["Common/Src/AMDTMutex", "master"],
"common-src-CElf" : ["Common/Src/CElf", "master"],
"common-src-DeviceInfo" : ["Common/Src/DeviceInfo", "rga-v2.5"],
"common-src-DynamicLibraryModule" : ["Common/Src/DynamicLibraryModule", "master"],
"common-src-TSingleton" : ["Common/Src/TSingleton", "master"],
"common-src-VersionInfo" : ["Common/Src/VersionInfo", "master"],
"common-src-Vsprops" : ["Common/Src/Vsprops", "master"],
"common-src-Miniz" : ["Common/Src/Miniz", "master"],
"common-src-Misc" : ["Common/Src/Misc", "master"],
"UpdateCheckAPI" : ["Common/Src/UpdateCheckAPI", "v2.0.0"],
"update_check_api" : ["Common/Src/update_check_api", "v2.0.0"],
# QtCommon.
"QtCommon" : ["QtCommon", "rga-2.5"]
"QtCommon" : ["QtCommon", "rga-2.5"],
}

github_mapping = {
"common-lib-ext-tinyxml2-5.0.1" : ["Common/Lib/Ext/tinyxml2", "master"],
"common-lib-ext-yaml-cpp" : ["Common/Lib/Ext/yaml-cpp", "master"],
"cxxopts" : ["Common/Lib/Ext/cxxopts", "master"],
"volk" : ["Common/Lib/Ext/volk", "master"],
}

git_private_mapping = {
"code_sanitizer" : ["RGA/external/code_sanitizer", "master"],
"common-Scripts" : ["common-Scripts", "master"],
"RGA-Internal" : ["RGA-Internal", None]
}
127 changes: 19 additions & 108 deletions build/fetch_dependencies.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,23 +48,21 @@
from dependency_map import github_root
from dependency_map import download_mapping_windows
from dependency_map import download_mapping_linux
from dependency_map import zip_files

# Calculate the root of the git server - all git and zip file dependencies should be retrieved from the same server.
git_url = subprocess.check_output(["git", "-C", script_root, "remote", "get-url", "origin"], shell=SHELLARG)
git_url_string = (str(git_url).lstrip("b'"))
amd_github_url = (str(git_url).lstrip("b'"))
if git_url is None:
print("Error: Unable to determine origin for RGA git project")
exit(1)

# URL to root of radeon_gpu_analyzer releases on github.com.
github_release_root = "https://github.com/GPUOpen-Tools/radeon_gpu_analyzer/releases/download/"
# Temporary while repositories are on gerrit and github.amd.com. This is used to clone DeviceInfo repo.
gerrit_root = "ssh://gerritgit/DevTools/ec/"


def parse_arguments():
parser = argparse.ArgumentParser(description="A script that updates the build enviroment")
parser.add_argument('--latest', action='store_true', default=False, help='Use latest version on the default branch')
parser.add_argument('--binary-path', action='store', default=None, help='Use rga_dependencies zip file at specified path')
return (parser.parse_args())


Expand Down Expand Up @@ -157,27 +155,6 @@ def getVersion():
return major + "." + minor + "." + update


def artifactoryDownload(file_path, value):
from artifactory_helper import ArtifactoryHelper
from artifactory_helper import artifactory_server
# path is artifactory server relative path to zip file.
# value is <rga-relative-target-path>.
zip_file_name = file_path.split('/')[-1].split('#')[0].split('?')[0]
target_path = os.path.normpath(os.path.join(rga_root, value))
print("Downloading %s into %s"%(zip_file_name, target_path))
artifactory_download = ArtifactoryHelper(artifactory_server)
artifactory_path = artifactory_server + file_path
artifactory_download.DownloadFile(artifactory_path)
try:
zipfile.ZipFile(zip_file_name).extractall(target_path)
except (RuntimeError, ValueError):
print("Unable to expand package %s.\n"%file_path)
sys.exit(1)
if (get_os() == "Linux"):
make_executable(target_path)
os.remove(zip_file_name)


def do_fetch(repo_target, repo_branch):
status = True

Expand All @@ -203,11 +180,12 @@ def do_fetch(repo_target, repo_branch):

def do_clone(repo_git_path, repo_target, repo_branch):
status = True

print("Directory %s does not exist. \n\tUsing 'git clone' to get latest from %s"%(repo_target, repo_git_path))
sys.stdout.flush()
try:
print("Cloning...%s\n"%(" ".join(["git", "clone", repo_git_path, repo_target])))
subprocess.check_call(["git", "clone", repo_git_path, repo_target], shell=SHELLARG)
print("Checking out branch...\n")
subprocess.check_call(["git", "-C", repo_target, "checkout", repo_branch], shell=SHELLARG)
except subprocess.CalledProcessError as e:
print("ERROR: 'git clone' failed with return code: %d\n"%e.returncode)
Expand All @@ -218,40 +196,11 @@ def do_clone(repo_git_path, repo_target, repo_branch):
return status


def fetch_private_map(git_server, repo_target):
# Clone repositories in git_private_mapping if they don't exist.
from dependency_map import git_private_mapping

# Determine checked out branch of RGA.
git_output = subprocess.check_output(["git", "-C", script_root, "branch", "--show-current"], shell=SHELLARG)
git_branch = git_output.decode()
rga_branch = git_branch.rstrip()

os.chdir(workspace)
for key in git_private_mapping:
if git_private_mapping[key][1] is None:
git_private_mapping[key][1] = rga_branch
private_git_path = git_server + key
private_repo_target = os.path.normpath(os.path.join(repo_target, git_private_mapping[key][0]))

print("\nChecking out commit: " + git_private_mapping[key][1] + " for " + key)
if os.path.isdir(private_repo_target):
# directory exists - get latest from git using pull
status = do_fetch(private_repo_target, git_private_mapping[key][1])
if not status:
sys.exit(1)
else:
# directory doesn't exist - clone from git
status = do_clone(private_git_path, private_repo_target, git_private_mapping[key][1])
if not status:
sys.exit(1)


def fetch_git_map(arguments, git_branch, git_root):
def fetch_git_map(arguments, git_branch):
for key in git_mapping:
# Target path, relative to workspace
path = git_mapping[key][0]
source = git_root + key
source = gerrit_root + key

required_commit = git_mapping[key][1]
# required_commit may be "None" - or user may override commit via command line. In this case, use tip of tree
Expand Down Expand Up @@ -316,25 +265,26 @@ def do_fetch_dependencies(arguments):
print("Error calling command: git --version")

# Strip everything after the last '/' from the URL to retrieve the root
git_root = (git_url_string.rsplit('/', 1))[0] + '/'

# If cloning from github - use the master branch as the default branch - otherwise use amd-master
amd_github_root = (amd_github_url.rsplit('/', 1))[0] + '/'
# If cloning from github.com - use the master branch as the default branch - otherwise use amd-master
git_branch = "amd-master"
if "github.com" in git_url_string:
if "github.com" in amd_github_url:
git_branch = "master"

print("\nFetching dependencies from: " + git_root + " - using branch: " + git_branch)
repo_origin = amd_github_root

# Temporary during transition from gerrit to github.amd.com
if "github.amd.com" in amd_github_root:
repo_origin = gerrit_root

print("\nFetching dependencies from: " + repo_origin + " - using branch: " + git_branch)

# The following section contains OS-specific dependencies that are downloaded and placed in the specified target directory.
# for each dependency - test if it has already been fetched - if not, then fetch it, otherwise update it to top of tree
fetch_git_map(arguments, git_branch, git_root)
fetch_git_map(arguments, git_branch)
fetch_github_map(arguments, git_branch)

# Handle git_private_mapping.
if "github.com" not in git_url_string:
if "JENKINS_URL" not in os.environ:
fetch_private_map(git_root, workspace)

# Capture the operating system.
machine_os = get_os()

Expand All @@ -350,45 +300,6 @@ def do_fetch_dependencies(arguments):
for key in download_mapping:
downloadandunzip(key, download_mapping[key])

# If one of the large binaries exists, assume they all do.
if os.path.isfile(os.path.normpath(os.path.join(rga_root, "external/lc/opencl/windows/bin/clang.exe"))):
print("\nBinaries already exist, skipping rga_dependencies.zip download\n")
return
else:
# Download and extract additional zip files if necessary.
version = getVersion()
dependency_zip_file_name = "rga_dependencies_" + version + ".zip"
if arguments.binary_path is None:
# Download dependency zip file and unzip.
if "github" in git_url_string:
# Download from github.
rga_dependencies_zip_file = github_release_root + version + "/" + dependency_zip_file_name
downloadandunzip(rga_dependencies_zip_file, workspace)
else:
# Download from Artifactory.
# Import the artifactory_helper.py from RGA-Internal.
internal_repo_root = os.path.abspath(os.path.normpath(os.path.join(script_root, "../..")))
sys.path.insert(0, os.path.normpath(os.path.join(internal_repo_root, "RGA-Internal/build")))
from artifactory_helper import artifactory_root
os.chdir(workspace)

# Download and unzip dependency file from Artifactory.
artifactory_path = artifactory_root + version +"/" + dependency_zip_file_name
artifactoryDownload(artifactory_path, workspace)
else:
zipfile.ZipFile(arguments.binary_path).extractall(workspace)

# Copy extracted files to RGA folders.
for key in zip_files:
zip_file_path = os.path.join(workspace, key)
target_path = os.path.normpath(os.path.join(rga_root, zip_files[key]))
print("Extracting %s files into %s"%(key, target_path))
zipfile.ZipFile(zip_file_path).extractall(target_path)
# extractall doesn't retain execute permissions on Linux binaries.
if machine_os == "Linux":
make_executable(target_path)
os.remove(zip_file_path)


if __name__ == '__main__':
# fetch_dependencies.py executed as a script
Expand Down

0 comments on commit 4eefcb2

Please sign in to comment.