Repository navigation
[debug-tools] Add debug tools feature and ROCdbgapi to TheRock (Linux) #2540
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -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}") | ||
|
|
@@ -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. | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That bit seems unrelated to that particular PR.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 | ||
|
|
@@ -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) | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -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: | ||
|
|
@@ -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, | ||
|
|
@@ -526,6 +534,14 @@ def main(argv): | |
| ] | ||
| ), | ||
| ) | ||
| parser.add_argument( | ||
| "--debug-tools", | ||
| nargs="+", | ||
| type=str, | ||
| default=[ | ||
| "amd-dbgapi", | ||
| ], | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I guess you might also want choices=["amd-dbgapi"]so
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -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] | ||
|
|
@@ -188,6 +189,7 @@ def retrieve_artifacts_by_run_id(args): | |
| elif any( | ||
| [ | ||
| args.blas, | ||
| args.debug_tools, | ||
| args.fft, | ||
| args.hipdnn, | ||
| args.miopen, | ||
|
|
@@ -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") | ||
|
|
@@ -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", | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fixed. |
||
| action=argparse.BooleanOptionalAction, | ||
| ) | ||
|
|
||
| artifacts_group.add_argument( | ||
| "--fft", | ||
| default=False, | ||
|
|
||
| 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 | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. missing period at the end of the sentence.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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() | ||
There was a problem hiding this comment.
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).