Skip to content
Open
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
5 changes: 5 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,11 @@ set(THEROCM_ROCM_SYSTEMS_SOURCE_DIR_DEFAULT "${THEROCK_SOURCE_DIR}/rocm-systems"
set(THEROCK_ROCM_SYSTEMS_SOURCE_DIR "${THEROCM_ROCM_SYSTEMS_SOURCE_DIR_DEFAULT}" CACHE STRING "Path to rocm-systems superrepo")
cmake_path(ABSOLUTE_PATH THEROCK_ROCM_SYSTEMS_SOURCE_DIR NORMALIZE)

# Source configuration for ROCgdb.
set(THEROCK_ROCGDB_SOURCE_DIR_DEFAULT "${THEROCK_SOURCE_DIR}/debug-tools/rocgdb/source")
set(THEROCK_ROCGDB_SOURCE_DIR "${THEROCK_ROCGDB_SOURCE_DIR_DEFAULT}" CACHE STRING "Path to rocgdb's sources")
cmake_path(ABSOLUTE_PATH THEROCK_ROCGDB_SOURCE_DIR NORMALIZE)

# Allow to specify alternative source locations instead of using
# repositories tracked in TheRock's `.gitmodules`.
therock_enable_external_source("composable-kernel" "${THEROCK_SOURCE_DIR}/ml-libs/composable_kernel" OFF)
Expand Down
5 changes: 5 additions & 0 deletions debug-tools/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,10 @@ if(THEROCK_ENABLE_ROCGDB)
message(WARNING "No Python with shared libpython found. rocgdb will be built without Python support.")
endif()

if(NOT ${THEROCK_ROCGDB_SOURCE_DIR} STREQUAL ${THEROCK_ROCGDB_SOURCE_DIR_DEFAULT})
message(WARNING "Configuring ROCgdb with modified source directory: ${THEROCK_ROCGDB_SOURCE_DIR}")
endif()

therock_cmake_subproject_declare(rocgdb
USE_DIST_AMDGPU_TARGETS
EXTERNAL_SOURCE_DIR "rocgdb"
Expand All @@ -206,6 +210,7 @@ if(THEROCK_ENABLE_ROCGDB)
"-DROCM_VERSION=${ROCM_MAJOR_VERSION}.${ROCM_MINOR_VERSION}.${ROCM_PATCH_VERSION}"
"-DSHARED_PYTHON_EXECUTABLES=${_rocgdb_python_executables_escaped}"
"-DTHEROCK_BUNDLE_SYSDEPS=${THEROCK_BUNDLE_SYSDEPS}"
"-DROCGDB_SOURCE_DIR=${THEROCK_ROCGDB_SOURCE_DIR}"
COMPILER_TOOLCHAIN
amd-llvm
RUNTIME_DEPS
Expand Down
16 changes: 11 additions & 5 deletions debug-tools/rocgdb/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,12 @@ project(rocgdb C CXX)
include(ExternalProject)
include(ProcessorCount)

# Allow external rocgdb source directory.
if(NOT ROCGDB_SOURCE_DIR)
set(ROCGDB_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/source")
endif()
message(STATUS "ROCgdb source directory: ${ROCGDB_SOURCE_DIR}")

# Function to extract a single path that matches a given regex pattern
# from a list of paths.
#
Expand Down Expand Up @@ -229,7 +235,7 @@ macro(add_python_variant minor_version configure_flags libpython_dir)
"LDFLAGS=${ALL_LDFLAGS}"
--
# The actual configure command.
${CMAKE_CURRENT_SOURCE_DIR}/source/configure
${ROCGDB_SOURCE_DIR}/configure
"--prefix=${ROCGDB_INTERMEDIATE_INSTALL_DIR}"
--program-prefix=roc
"--program-transform-name=${ROCGDB_PROGRAM_TRANSFORM_STR}"
Expand Down Expand Up @@ -290,7 +296,7 @@ macro(add_python_variant minor_version configure_flags libpython_dir)
COMMAND
${CMAKE_COMMAND} -E make_directory ${ROCGDB_INTERMEDIATE_INSTALL_DIR}/share/doc
COMMAND
${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/source/gdb/NOTICES.txt ${ROCGDB_INTERMEDIATE_INSTALL_DIR}/share/doc/
${CMAKE_COMMAND} -E copy ${ROCGDB_SOURCE_DIR}/gdb/NOTICES.txt ${ROCGDB_INTERMEDIATE_INSTALL_DIR}/share/doc/
# Rename rocgcore to rocgcore-py<python version>.
COMMAND
${CMAKE_COMMAND} -E rename ${ROCGDB_INTERMEDIATE_INSTALL_DIR}/bin/rocgcore ${ROCGDB_INTERMEDIATE_INSTALL_DIR}/bin/rocgcore-py${minor_version}
Expand Down Expand Up @@ -604,7 +610,7 @@ if(BUILD_TESTING)
# Get the directory part of the file.
get_filename_component(file_dir ${rocgdb_file} DIRECTORY)

install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/source/${rocgdb_file}
install(FILES ${ROCGDB_SOURCE_DIR}/${rocgdb_file}
DESTINATION tests/rocgdb/${file_dir}
COMPONENT tests)
endforeach()
Expand All @@ -613,7 +619,7 @@ if(BUILD_TESTING)
# Get the directory part of the file.
get_filename_component(file_dir ${rocgdb_file} DIRECTORY)

install(PROGRAMS ${CMAKE_CURRENT_SOURCE_DIR}/source/${rocgdb_file}
install(PROGRAMS ${ROCGDB_SOURCE_DIR}/${rocgdb_file}
DESTINATION tests/rocgdb/${file_dir}
COMPONENT tests)
endforeach()
Expand All @@ -626,7 +632,7 @@ if(BUILD_TESTING)
)

foreach(rocgdb_testsuite_dir ${ROCGDB_TESTSUITE_DIRS})
install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/source/${rocgdb_testsuite_dir}
install(DIRECTORY ${ROCGDB_SOURCE_DIR}/${rocgdb_testsuite_dir}
DESTINATION tests/rocgdb/gdb
COMPONENT tests
USE_SOURCE_PERMISSIONS)
Expand Down
Loading