Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -53,3 +53,7 @@
path = iree-libs/fusilli
url = https://github.com/iree-org/fusilli.git
branch = main
[submodule "amd-dbgapi"]
path = debug-tools/amd-dbgapi
url = https://github.com/ROCm/ROCdbgapi.git
branch = amd-staging
23 changes: 23 additions & 0 deletions BUILD_TOPOLOGY.toml
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,10 @@ submodules = ["half", "rocm-cmake", "amdsmi"]
description = "Compiler toolchain submodules"
submodules = ["llvm-project", "HIPIFY", "spirv-llvm-translator"]

[source_sets.debug-tools]
description = "ROCm debug tools submodules"
submodules = ["amd-dbgapi"]

[source_sets.rocm-systems]
description = "ROCm systems monorepo (runtime, profiler, etc.)"
submodules = ["rocm-systems"]
Expand Down Expand Up @@ -141,6 +145,10 @@ description = "Communication libraries per architecture (can run parallel to mat
artifact_groups = ["comm-libs"]
type = "per-arch"

[build_stages.debug-tools]
description = "ROCm debug tools"
artifact_groups = ["debug-tools"]

[build_stages.dctools-core]
description = "Data center tools with minimal dependencies"
artifact_groups = ["dctools-core"]
Expand Down Expand Up @@ -196,6 +204,12 @@ type = "generic"
artifact_group_deps = ["third-party-sysdeps"]
source_sets = ["compilers"]

[artifact_groups.debug-tools]
description = "ROCm debug tools"
type = "generic"
artifact_group_deps = ["compiler", "hip-runtime", "third-party-sysdeps"]
disable_platforms = ["windows"]

[artifact_groups.hip-runtime]
description = "HIP runtime"
type = "generic"
Expand Down Expand Up @@ -519,3 +533,12 @@ disable_platforms = ["windows"]
# artifact_group = "dctools-rocm"
# type = "target-neutral"
# artifact_deps = ["blas", "miopen", "rocprofiler-sdk"]

# --- ROCm Debug Tools ---

[artifacts.amd-dbgapi]
artifact_group = "debug-tools"
type = "target-neutral"
artifact_deps = ["amd-llvm", "core-runtime", "sysdeps"]

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Few comments.

The dbgapi artifact itself does not depend on "core-runitme". We only need the rocr headers to build, but we do not need that at runtime.

And "amd-llvm" seems a quite big net. We only need amd-comgr, not the entire llvm suite (no clang/clang++ or any other tool needed at runtime).

feature_group = "DEBUG_TOOLS" # Part of DEBUG_TOOLS, enabled by default via THEROCK_ENABLE_ALL
disable_platforms = ["windows"]
4 changes: 4 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,7 @@ option(THEROCK_USE_SAFE_DEPENDENCY_PROVIDER "Enable the safe dependency provider
option(THEROCK_ENABLE_ALL "Enables building of all feature groups" ON)
option(THEROCK_ENABLE_CORE "Enable building of core libraries" "${THEROCK_ENABLE_ALL}")
option(THEROCK_ENABLE_COMM_LIBS "Enable building of comm libraries" "${THEROCK_ENABLE_ALL}")
option(THEROCK_ENABLE_DEBUG_TOOLS "Enable building the ROCm debug tools" "${THEROCK_ENABLE_ALL}")
option(THEROCK_ENABLE_MATH_LIBS "Enable building of math libraries" "${THEROCK_ENABLE_ALL}")
option(THEROCK_ENABLE_ML_LIBS "Enable building of ML libraries" "${THEROCK_ENABLE_ALL}")
option(THEROCK_ENABLE_PROFILER "Enable building the profiler libraries" "${THEROCK_ENABLE_ALL}")
Expand Down Expand Up @@ -261,6 +262,8 @@ cmake_dependent_option(THEROCK_ROCWMMA_ENABLE_BENCHMARKS
# Additional manual features that don't map to artifacts

# Profiler Trace Decoder Binary (not an artifact, just a config option)

# Profiler Features.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That bit seems unrelated to that particular PR.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed.

if(THEROCK_FLAG_INCLUDE_PROFILER)
therock_add_feature(ROCPROF_TRACE_DECODER_BINARY
GROUP PROFILER
Expand Down Expand Up @@ -413,6 +416,7 @@ add_subdirectory(third-party)
add_subdirectory(base)
add_subdirectory(compiler)
add_subdirectory(core)
add_subdirectory(debug-tools)
# Note that rocprofiler-register is in base and is what higher level clients
# depend on. The profiler itself is independent.
add_subdirectory(profiler)
Expand Down
20 changes: 11 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -145,22 +145,24 @@ You can install the `rocm` Python package for any architecture inside a venv and
By default, the project builds everything available. The following group flags
enable/disable selected subsets:

| Group flag | Description |
| -------------------------------- | ------------------------------------ |
| `-DTHEROCK_ENABLE_ALL=OFF` | Disables all optional components |
| `-DTHEROCK_ENABLE_CORE=OFF` | Disables all core components |
| `-DTHEROCK_ENABLE_COMM_LIBS=OFF` | Disables all communication libraries |
| `-DTHEROCK_ENABLE_MATH_LIBS=OFF` | Disables all math libraries |
| `-DTHEROCK_ENABLE_ML_LIBS=OFF` | Disables all ML libraries |
| `-DTHEROCK_ENABLE_PROFILER=OFF` | Disables profilers |
| `-DTHEROCK_ENABLE_DC_TOOLS=OFF` | Disables data center tools |
| Group flag | Description |
| ---------------------------------- | ------------------------------------ |
| `-DTHEROCK_ENABLE_ALL=OFF` | Disables all optional components |
| `-DTHEROCK_ENABLE_CORE=OFF` | Disables all core components |
| `-DTHEROCK_ENABLE_COMM_LIBS=OFF` | Disables all communication libraries |
| `-DTHEROCK_ENABLE_DEBUG_TOOLS=OFF` | Disables all debug tools |
| `-DTHEROCK_ENABLE_MATH_LIBS=OFF` | Disables all math libraries |
| `-DTHEROCK_ENABLE_ML_LIBS=OFF` | Disables all ML libraries |
| `-DTHEROCK_ENABLE_PROFILER=OFF` | Disables profilers |
| `-DTHEROCK_ENABLE_DC_TOOLS=OFF` | Disables data center tools |

Individual features can be controlled separately (typically in combination with
`-DTHEROCK_ENABLE_ALL=OFF` or `-DTHEROCK_RESET_FEATURES=ON` to force a
minimal build):

| Component flag | Description |
| ------------------------------------ | --------------------------------------------- |
| `-DTHEROCK_ENABLE_AMD_DBGAPI=ON` | Enables the ROCm debug API library |
| `-DTHEROCK_ENABLE_COMPILER=ON` | Enables the GPU+host compiler toolchain |
| `-DTHEROCK_ENABLE_HIPIFY=ON` | Enables the hipify tool |
| `-DTHEROCK_ENABLE_CORE_RUNTIME=ON` | Enables the core runtime components and tools |
Expand Down
16 changes: 16 additions & 0 deletions build_tools/fetch_sources.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,8 @@ def get_enabled_projects(args) -> List[str]:
projects.extend(args.system_projects)
if args.include_compilers:
projects.extend(args.compiler_projects)
if args.include_debug_tools:
projects.extend(args.debug_tools)
if args.include_rocm_libraries:
projects.extend(["rocm-libraries"])
if args.include_rocm_systems:
Expand Down Expand Up @@ -423,6 +425,12 @@ def main(argv):
action=argparse.BooleanOptionalAction,
help="Include compilers",
)
parser.add_argument(
"--include-debug-tools",
default=True,
action=argparse.BooleanOptionalAction,
help="Include ROCm debugging tools",
)
parser.add_argument(
"--include-rocm-libraries",
default=True,
Expand Down Expand Up @@ -526,6 +534,14 @@ def main(argv):
]
),
)
parser.add_argument(
"--debug-tools",
nargs="+",
type=str,
default=[
"amd-dbgapi",
],

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess you might also want

    choices=["amd-dbgapi"]

so argparse knows the list of valid values (will be extended later to also cover debug-agent and gdb).

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure about that. My original intent was to have --debug-tools pull in sources for all 3 components (amd-dbgapi, rocgdb and debug agent) and not accept individual options.

Is there a particular reason why you think that would be useful?

)
args = parser.parse_args(argv)

# Handle --list-stages
Expand Down
11 changes: 11 additions & 0 deletions build_tools/install_rocm_from_artifacts.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
(--run-id RUN_ID | --release RELEASE | --input-dir INPUT_DIR)
[--run-github-repo RUN_GITHUB_REPO]
[--blas | --no-blas]
[--debug-tools | --no-debug-tools]
[--fft | --no-fft]
[--hipdnn | --no-hipdnn]
[--miopen | --no-miopen]
Expand Down Expand Up @@ -188,6 +189,7 @@ def retrieve_artifacts_by_run_id(args):
elif any(
[
args.blas,
args.debug_tools,
args.fft,
args.hipdnn,
args.miopen,
Expand All @@ -206,6 +208,8 @@ def retrieve_artifacts_by_run_id(args):
extra_artifacts = []
if args.blas:
extra_artifacts.append("blas")
if args.debug_tools:
extra_artifacts.append("amd-dbgapi")
if args.fft:
extra_artifacts.append("fft")
extra_artifacts.append("fftw3")
Expand Down Expand Up @@ -365,6 +369,13 @@ def main(argv):
action=argparse.BooleanOptionalAction,
)

artifacts_group.add_argument(
"--debug-tools",
default=False,
help="Include ROCm debugging tools (amd-dbgapi, rocgdb and rocr-debug-agent) artifacts",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just a nit, this PR is only about dbgapi. gdb/debug agent will come later.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed.

action=argparse.BooleanOptionalAction,
)

artifacts_group.add_argument(
"--fft",
default=False,
Expand Down
76 changes: 76 additions & 0 deletions debug-tools/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
set(DEBUG_TOOLS_DIR "${THEROCK_SOURCE_DIR}/debug-tools")

if(THEROCK_ENABLE_AMD_DBGAPI)
##############################################################################
# amd-dbgapi
#
# A library that provides support for a debugger and other tools to perform
# low-level control of the running code and inspection of the running state
# of AMD GPU's

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

missing period at the end of the sentence.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed.

##############################################################################

therock_cmake_subproject_declare(amd-dbgapi
USE_DIST_AMDGPU_TARGETS
EXTERNAL_SOURCE_DIR "amd-dbgapi"
BINARY_DIR "${CMAKE_CURRENT_BINARY_DIR}/amd-dbgapi"
COMPILER_TOOLCHAIN
amd-llvm
CMAKE_ARGS
-DREQUIRE_THREADS=ON
BUILD_DEPS
ROCR-Runtime
therock-libbacktrace
RUNTIME_DEPS
amd-comgr
INTERFACE_LINK_DIRS
"lib"
INTERFACE_INSTALL_RPATH_DIRS
"lib"
INTERFACE_PKG_CONFIG_DIRS
"share/pkgconfig"
)

therock_cmake_subproject_glob_c_sources(amd-dbgapi SUBDIRS
include
src
)

therock_cmake_subproject_provide_package(amd-dbgapi amd-dbgapi
lib/cmake/amd-dbgapi
)

therock_cmake_subproject_activate(amd-dbgapi)

# Check that we built the one library we're supposed to build.
therock_test_validate_shared_lib(PATH amd-dbgapi/dist/lib
LIB_NAMES
librocm-dbgapi.so
)

# The artifacts provided by amd-dbgapi.
therock_provide_artifact(amd-dbgapi
TARGET_NEUTRAL
DESCRIPTOR artifact-amd-dbgapi.toml
COMPONENTS
dbg
dev
doc
lib
SUBPROJECT_DEPS
amd-comgr
amd-dbgapi
)

# To speed up the transition of amd-dbgapi to TheRock, we keep a separate
# cmake file that we copy to the sources when the project is setup.
#
# This step is temporary and will eventually disappear in favor of having
# the right changes in the project's build system.
message(STATUS "[amd-dbgapi] Copying amd-dbgapi.cmake to the source directory")
execute_process(
COMMAND ${CMAKE_COMMAND} -E copy ${DEBUG_TOOLS_DIR}/amd-dbgapi.cmake ${DEBUG_TOOLS_DIR}/amd-dbgapi/CMakeLists.txt
OUTPUT_VARIABLE _output
ERROR_VARIABLE _error
RESULT_VARIABLE _result
)
endif()
1 change: 1 addition & 0 deletions debug-tools/amd-dbgapi
Submodule amd-dbgapi added at 7af9c5
Loading
Loading