a798a26227
* Agent information w/o using hsa-runtime
- remove lib/rocprofiler/hsa/agent.{hpp,cpp}
- update include/rocprofiler/agent.h
- basically all possible info from /sys/class/kfd/kfd/topology/nodes/*
* Print topology in rocprofiler_lib.agent test
- hack to help diagnose errors
* Update lib/rocprofiler/tests/details/agent.cpp
- use LOG_IF(WARNING, ...) instead of LOG_IF(FATAL, ...)
* Update lib/rocprofiler/tests/agent.cpp
- print rocminfo at beginning of test
- fix comparison of agent handle
- misc other checks
* Updte lib/rocprofiler/agent.cpp
- handle unreadable /sys/class/kfd/kfd/topology/nodes/<N>/properties file
* Update lib/tests/buffering/CMakeLists.txt
- increase timeout to 120
- buffering.parallel will timeout when thread sanitizing is enabled
* Update cmake: rocprofiler-drm
- find drm headers and libraries
* Update include/rocprofiler/agent.h
- add family_id field
* Update lib/rocprofiler/agent.cpp
- parse /proc/cpuinfo for name, family, apicid, etc.
- read_topology uses unique pointers to cleanup memory allocations
- implement name and gfxip
* Update lib/rocprofiler/tests/agent.cpp
- improved failure message
- check name/gfxip
- remove check against hsa_agent_t.handle
- this value is dependent on the address of C++ class
* Update lib/rocprofiler/tests/details/agent.cpp
- tweak gfxip_ variable which is broken for CPU
* Update lib/rocprofiler/agent.cpp
- update string handling for name and gfxip
* Update lib/rocprofiler/tests/agent.cpp
- minor output tweak
* Update lib/rocprofiler/registration.{hpp,cpp}
- registration::init_logging() function
* Update lib/rocprofiler/agent.cpp
- fix hex handling of GFX step version
* Update lib/rocprofiler/tests/details/agent.cpp
- fix format string when nearest CPUs not found
* Update lib/rocprofiler/tests/CMakeLists.txt
- exclude details/agent.cpp from being parsed for gtest tests
* Update include/rocprofiler/fwd.h
- add ROCPROFILER_STATUS_ERROR_INCOMPATIBLE_ABI status
* Update lib/rocprofiler/tests/details/agent.{hpp,cpp}
- replace with slightly modified implementation of rocminfo
- primary change was not printing
* Update lib/rocprofiler/tests/agent.cpp
- update test to use rocminfo data
* Update lib/rocprofiler/agent.cpp
- add pc_sampling_configs
- return error on incompatible ABI
* Update counters and counters tests
- rename test names for consistency
- fixed incorrect spelling of derived
* Add lib/rocprofiler/tests/{timestamp,version}.cpp
- add timestamp and version tests for rocprofiler_get_timestamp and rocprofiler_get_version, respectively
* Update lib/rocprofiler/tests/agent
- fix double free of name_str from isa_info_t
* Update include/rocprofiler/agent.h
- comments for rocprofiler_agent_mem_bank_t
- add rocprofiler_dim3_t
- comments for rocprofiler_agent_t
- add new fields to rocprofiler_agent_t
- cu_count
- workgroup_max_size
- workgroup_max_dim
- grid_max_size
- grid_max_dim
- vendor_name
- product_name
- change prototype of rocprofiler_available_agents_cb_t to be const agent**
* Update lib/rocprofiler/agent.cpp
- set size field
- implement:
- product_name
- vendor_name
- workgroup_max_size
- workgroup_max_dim
- grid_max_size
- grid_max_dim
- cu_count
* Update lib/rocprofiler/tests/agent.cpp
- changes for const agent*
* Update samples/pc_sampling
- updates for const agent*
* Update lib/rocprofiler/agent.cpp
- fix ABI compatibility check
- return incompatible if tool agent is larger than our agent
* Update include/rocprofiler/agent.h
- doxygen comments
- make size field of rocprofiler_agent_t uint64_t for consistency
- add gpu_id via /sys/class/kfd/kfd/.../<idx>/gpu_id
- add model_name via /sys/class/kfd/kfd/.../<idx>/name
* Update lib/rocprofiler/agent.cpp
- add read_file function (vector of strings)
- support enum in read_property
- assign model_name and gpu_id fields
- remove unique_id
* Update lib/rocprofiler/tests/details/agent.*
- support family id, ucode_version, sdma_ucode_version
* Update lib/rocprofiler/tests/agent.cpp
- Add rocprofiler_lib.agent_abi test
- Verify family_id, ucode_version, sdma_ucode_version
207 lines
6.8 KiB
CMake
207 lines
6.8 KiB
CMake
# include guard
|
|
include_guard(DIRECTORY)
|
|
|
|
# ########################################################################################
|
|
#
|
|
# External Packages are found here
|
|
#
|
|
# ########################################################################################
|
|
|
|
target_include_directories(
|
|
rocprofiler-headers
|
|
INTERFACE $<BUILD_INTERFACE:${PROJECT_BINARY_DIR}/source/include>
|
|
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/source/include>
|
|
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/source>
|
|
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>)
|
|
|
|
target_compile_definitions(
|
|
rocprofiler-headers INTERFACE $<BUILD_INTERFACE:AMD_INTERNAL_BUILD=1>
|
|
$<BUILD_INTERFACE:__HIP_PLATFORM_AMD__=1>)
|
|
|
|
# ensure the env overrides the appending /opt/rocm later
|
|
string(REPLACE ":" ";" CMAKE_PREFIX_PATH "$ENV{CMAKE_PREFIX_PATH};${CMAKE_PREFIX_PATH}")
|
|
|
|
set(ROCPROFILER_DEFAULT_ROCM_PATH
|
|
/opt/rocm
|
|
CACHE PATH "Default search path for ROCM")
|
|
if(EXISTS ${ROCPROFILER_DEFAULT_ROCM_PATH})
|
|
get_filename_component(_ROCPROFILER_DEFAULT_ROCM_PATH
|
|
"${ROCPROFILER_DEFAULT_ROCM_PATH}" REALPATH)
|
|
|
|
if(NOT "${_ROCPROFILER_DEFAULT_ROCM_PATH}" STREQUAL
|
|
"${ROCPROFILER_DEFAULT_ROCM_PATH}")
|
|
set(ROCPROFILER_DEFAULT_ROCM_PATH
|
|
"${_ROCPROFILER_DEFAULT_ROCM_PATH}"
|
|
CACHE PATH "Default search path for ROCM" FORCE)
|
|
endif()
|
|
endif()
|
|
|
|
# ----------------------------------------------------------------------------------------#
|
|
#
|
|
# Threading
|
|
#
|
|
# ----------------------------------------------------------------------------------------#
|
|
|
|
set(CMAKE_THREAD_PREFER_PTHREAD ON)
|
|
set(THREADS_PREFER_PTHREAD_FLAG OFF)
|
|
|
|
find_library(pthread_LIBRARY NAMES pthread pthreads)
|
|
find_package_handle_standard_args(pthread-library REQUIRED_VARS pthread_LIBRARY)
|
|
|
|
find_library(pthread_LIBRARY NAMES pthread pthreads)
|
|
find_package_handle_standard_args(pthread-library REQUIRED_VARS pthread_LIBRARY)
|
|
|
|
if(pthread_LIBRARY)
|
|
target_link_libraries(rocprofiler-threading INTERFACE ${pthread_LIBRARY})
|
|
else()
|
|
find_package(Threads ${rocprofiler_FIND_QUIETLY} ${rocprofiler_FIND_REQUIREMENT})
|
|
if(Threads_FOUND)
|
|
target_link_libraries(rocprofiler-threading INTERFACE Threads::Threads)
|
|
endif()
|
|
endif()
|
|
|
|
# ----------------------------------------------------------------------------------------#
|
|
#
|
|
# dynamic linking (dl) and runtime (rt) libraries
|
|
#
|
|
# ----------------------------------------------------------------------------------------#
|
|
|
|
foreach(_LIB dl rt)
|
|
find_library(${_LIB}_LIBRARY NAMES ${_LIB})
|
|
find_package_handle_standard_args(${_LIB}-library REQUIRED_VARS ${_LIB}_LIBRARY)
|
|
if(${_LIB}_LIBRARY)
|
|
target_link_libraries(rocprofiler-threading INTERFACE ${${_LIB}_LIBRARY})
|
|
endif()
|
|
endforeach()
|
|
|
|
# ----------------------------------------------------------------------------------------#
|
|
#
|
|
# stdc++fs (filesystem) library
|
|
#
|
|
# ----------------------------------------------------------------------------------------#
|
|
|
|
find_library(stdcxxfs_LIBRARY NAMES stdc++fs)
|
|
find_package_handle_standard_args(stdcxxfs-library REQUIRED_VARS stdcxxfs_LIBRARY)
|
|
|
|
if(stdcxxfs_LIBRARY)
|
|
target_link_libraries(rocprofiler-stdcxxfs INTERFACE ${stdcxxfs_LIBRARY})
|
|
else()
|
|
target_link_libraries(rocprofiler-stdcxxfs INTERFACE stdc++fs)
|
|
endif()
|
|
|
|
# ----------------------------------------------------------------------------------------#
|
|
#
|
|
# HIP
|
|
#
|
|
# ----------------------------------------------------------------------------------------#
|
|
|
|
find_package(rocm_version REQUIRED)
|
|
list(APPEND CMAKE_PREFIX_PATH "${rocm_version_DIR}" "${rocm_version_DIR}/llvm")
|
|
list(APPEND CMAKE_MODULE_PATH "${rocm_version_DIR}/hip/cmake"
|
|
"${rocm_version_DIR}/lib/cmake")
|
|
find_package(hip REQUIRED CONFIG)
|
|
target_link_libraries(rocprofiler-hip INTERFACE hip::host)
|
|
|
|
# ----------------------------------------------------------------------------------------#
|
|
#
|
|
# HSA runtime
|
|
#
|
|
# ----------------------------------------------------------------------------------------#
|
|
|
|
find_package(
|
|
hsa-runtime64
|
|
REQUIRED
|
|
CONFIG
|
|
HINTS
|
|
${rocm_version_DIR}
|
|
${ROCM_PATH}
|
|
PATHS
|
|
${rocm_version_DIR}
|
|
${ROCM_PATH})
|
|
|
|
string(REPLACE "." ";" HSA_RUNTIME_VERSION "${hsa-runtime64_VERSION}")
|
|
# the following values are encoded into version.h
|
|
list(GET HSA_RUNTIME_VERSION 0 HSA_RUNTIME_VERSION_MAJOR)
|
|
list(GET HSA_RUNTIME_VERSION 1 HSA_RUNTIME_VERSION_MINOR)
|
|
|
|
target_link_libraries(rocprofiler-hsa-runtime INTERFACE hsa-runtime64::hsa-runtime64)
|
|
|
|
# ----------------------------------------------------------------------------------------#
|
|
#
|
|
# amd comgr
|
|
#
|
|
# ----------------------------------------------------------------------------------------#
|
|
|
|
find_package(
|
|
amd_comgr
|
|
REQUIRED
|
|
CONFIG
|
|
HINTS
|
|
${rocm_version_DIR}
|
|
${ROCM_PATH}
|
|
PATHS
|
|
${rocm_version_DIR}
|
|
${ROCM_PATH}
|
|
PATH_SUFFIXES
|
|
lib/cmake/amd_comgr)
|
|
|
|
target_link_libraries(rocprofiler-amd-comgr INTERFACE amd_comgr)
|
|
|
|
# ----------------------------------------------------------------------------------------#
|
|
#
|
|
# PTL (Parallel Tasking Library)
|
|
#
|
|
# ----------------------------------------------------------------------------------------#
|
|
|
|
target_link_libraries(rocprofiler-ptl INTERFACE PTL::ptl-static)
|
|
|
|
# ----------------------------------------------------------------------------------------#
|
|
#
|
|
# amd aql
|
|
#
|
|
# ----------------------------------------------------------------------------------------#
|
|
|
|
find_library(
|
|
hsa-amd-aqlprofile64_library
|
|
NAMES hsa-amd-aqlprofile64 hsa-amd-aqlprofile
|
|
HINTS ${rocm_version_DIR} ${ROCM_PATH}
|
|
PATHS ${rocm_version_DIR} ${ROCM_PATH})
|
|
|
|
target_link_libraries(rocprofiler-hsa-aql INTERFACE ${hsa-amd-aqlprofile64_library})
|
|
|
|
# ----------------------------------------------------------------------------------------#
|
|
#
|
|
# drm
|
|
#
|
|
# ----------------------------------------------------------------------------------------#
|
|
|
|
find_path(
|
|
drm_INCLUDE_DIR
|
|
NAMES drm.h
|
|
HINTS ${rocm_version_DIR} ${ROCM_PATH} /opt/amdgpu
|
|
PATHS ${rocm_version_DIR} ${ROCM_PATH} /opt/amdgpu
|
|
PATH_SUFFIXES include/drm include REQUIRED)
|
|
|
|
find_path(
|
|
xf86drm_INCLUDE_DIR
|
|
NAMES xf86drm.h
|
|
HINTS ${rocm_version_DIR} ${ROCM_PATH} /opt/amdgpu
|
|
PATHS ${rocm_version_DIR} ${ROCM_PATH} /opt/amdgpu
|
|
PATH_SUFFIXES include/drm include REQUIRED)
|
|
|
|
find_library(
|
|
drm_LIBRARY
|
|
NAMES drm
|
|
HINTS ${rocm_version_DIR} ${ROCM_PATH} /opt/amdgpu
|
|
PATHS ${rocm_version_DIR} ${ROCM_PATH} /opt/amdgpu REQUIRED)
|
|
|
|
find_library(
|
|
drm_amdgpu_LIBRARY
|
|
NAMES drm_amdgpu
|
|
HINTS ${rocm_version_DIR} ${ROCM_PATH} /opt/amdgpu
|
|
PATHS ${rocm_version_DIR} ${ROCM_PATH} /opt/amdgpu REQUIRED)
|
|
|
|
target_include_directories(rocprofiler-drm SYSTEM INTERFACE ${drm_INCLUDE_DIR}
|
|
${xf86drm_INCLUDE_DIR})
|
|
target_link_libraries(rocprofiler-drm INTERFACE ${drm_LIBRARY} ${drm_amdgpu_LIBRARY})
|