Skip to content

Commit

Permalink
Misc cleanup and stale code removal (#1026)
Browse files Browse the repository at this point in the history
* Remove custom allocators

- remove unused lib/rocprofiler-sdk/allocator.*
- remove unused lib/rocprofiler-sdk/context/allocator.hpp

* Fix rocprofiler_strip_target (rocprofiler_utilities.cmake)

* Remove old HSA_TOOLS_LIB support

- remove OnLoad/OnUnload functions used by HSA_TOOLS_LIB env variable

* Fix linter warnings + specific NOLINT exceptions

- replace bare NOLINT with NOLINT(<warning-name>)
  • Loading branch information
jrmadsen authored Aug 20, 2024
1 parent b9b5f33 commit 5d54682
Show file tree
Hide file tree
Showing 18 changed files with 41 additions and 351 deletions.
40 changes: 8 additions & 32 deletions cmake/rocprofiler_utilities.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -108,12 +108,12 @@ function(ROCPROFILER_CAPITALIZE str var)
endfunction()

# ------------------------------------------------------------------------------#
# function rocprofiler_strip_target(<TARGET> [FORCE] [EXPLICIT])
# function rocprofiler_strip_target(<TARGET> [FORCE])
#
# Creates a post-build command which strips a binary. FORCE flag will override
#
function(ROCPROFILER_STRIP_TARGET)
cmake_parse_arguments(STRIP "FORCE;EXPLICIT" "" "ARGS" ${ARGN})
cmake_parse_arguments(STRIP "FORCE" "" "ARGS" ${ARGN})

list(LENGTH STRIP_UNPARSED_ARGUMENTS NUM_UNPARSED)

Expand All @@ -131,36 +131,12 @@ function(ROCPROFILER_STRIP_TARGET)
endif()

if(CMAKE_STRIP AND (STRIP_FORCE OR ROCPROFILER_STRIP_LIBRARIES))
if(STRIP_EXPLICIT)
add_custom_command(
TARGET ${_TARGET}
POST_BUILD
COMMAND ${CMAKE_STRIP} ${STRIP_ARGS} $<TARGET_FILE:${_TARGET}>
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
COMMENT "Stripping ${_TARGET}...")
else()
add_custom_command(
TARGET ${_TARGET}
POST_BUILD
COMMAND
${CMAKE_STRIP} -w --keep-symbol="rocprofiler_init"
--keep-symbol="rocprofiler_finalize"
--keep-symbol="rocprofiler_push_trace"
--keep-symbol="rocprofiler_pop_trace"
--keep-symbol="rocprofiler_push_region"
--keep-symbol="rocprofiler_pop_region"
--keep-symbol="rocprofiler_set_env"
--keep-symbol="rocprofiler_set_mpi"
--keep-symbol="rocprofiler_reset_preload"
--keep-symbol="rocprofiler_set_instrumented"
--keep-symbol="rocprofiler_user_*" --keep-symbol="ompt_start_tool"
--keep-symbol="kokkosp_*" --keep-symbol="OnLoad"
--keep-symbol="OnUnload" --keep-symbol="OnLoadToolProp"
--keep-symbol="OnUnloadTool" --keep-symbol="__libc_start_main"
${STRIP_ARGS} $<TARGET_FILE:${_TARGET}>
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
COMMENT "Stripping ${_TARGET}...")
endif()
add_custom_command(
TARGET ${_TARGET}
POST_BUILD
COMMAND ${CMAKE_STRIP} ${STRIP_ARGS} $<TARGET_FILE:${_TARGET}>
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
COMMENT "Stripping ${_TARGET}...")
endif()
endfunction()

Expand Down
6 changes: 3 additions & 3 deletions samples/common/filesystem.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,11 +67,11 @@ namespace common
{
#if defined(ROCPROFILER_SAMPLES_HAS_GHC_LIB_FILESYSTEM) && \
ROCPROFILER_SAMPLES_HAS_GHC_LIB_FILESYSTEM > 0
namespace fs = ::ghc::filesystem; // NOLINT
namespace fs = ::ghc::filesystem; // NOLINT(misc-unused-alias-decls)
#elif defined(ROCPROFILER_SAMPLES_HAS_CPP_LIB_FILESYSTEM) && \
ROCPROFILER_SAMPLES_HAS_CPP_LIB_FILESYSTEM > 0
namespace fs = ::std::filesystem; // NOLINT
namespace fs = ::std::filesystem; // NOLINT(misc-unused-alias-decls)
#else
namespace fs = ::std::experimental::filesystem; // NOLINT
namespace fs = ::std::experimental::filesystem; // NOLINT(misc-unused-alias-decls)
#endif
} // namespace common
6 changes: 3 additions & 3 deletions source/lib/common/filesystem.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,11 +67,11 @@ namespace rocprofiler
namespace common
{
#if defined(ROCPROFILER_HAS_GHC_LIB_FILESYSTEM) && ROCPROFILER_HAS_GHC_LIB_FILESYSTEM > 0
namespace filesystem = ::ghc::filesystem; // NOLINT
namespace filesystem = ::ghc::filesystem; // NOLINT(misc-unused-alias-decls)
#elif defined(ROCPROFILER_HAS_CPP_LIB_FILESYSTEM) && ROCPROFILER_HAS_CPP_LIB_FILESYSTEM > 0
namespace filesystem = ::std::filesystem; // NOLINT
namespace filesystem = ::std::filesystem; // NOLINT(misc-unused-alias-decls)
#else
namespace filesystem = ::std::experimental::filesystem; // NOLINT
namespace filesystem = ::std::experimental::filesystem; // NOLINT(misc-unused-alias-decls)
#endif
} // namespace common
} // namespace rocprofiler
3 changes: 1 addition & 2 deletions source/lib/rocprofiler-sdk/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,10 @@
#
rocprofiler_activate_clang_tidy()

set(ROCPROFILER_LIB_HEADERS agent.hpp allocator.hpp buffer.hpp external_correlation.hpp
set(ROCPROFILER_LIB_HEADERS agent.hpp buffer.hpp external_correlation.hpp
intercept_table.hpp internal_threading.hpp registration.hpp)
set(ROCPROFILER_LIB_SOURCES
agent.cpp
allocator.cpp
buffer.cpp
buffer_tracing.cpp
agent_profile.cpp
Expand Down
47 changes: 0 additions & 47 deletions source/lib/rocprofiler-sdk/allocator.cpp

This file was deleted.

79 changes: 0 additions & 79 deletions source/lib/rocprofiler-sdk/allocator.hpp

This file was deleted.

3 changes: 1 addition & 2 deletions source/lib/rocprofiler-sdk/context/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@
# context
#
set(ROCPROFILER_LIB_CONFIG_SOURCES context.cpp correlation_id.cpp domain.cpp)
set(ROCPROFILER_LIB_CONFIG_HEADERS context.hpp correlation_id.hpp domain.hpp
allocator.hpp)
set(ROCPROFILER_LIB_CONFIG_HEADERS context.hpp correlation_id.hpp domain.hpp)

target_sources(rocprofiler-object-library PRIVATE ${ROCPROFILER_LIB_CONFIG_SOURCES}
${ROCPROFILER_LIB_CONFIG_HEADERS})
109 changes: 0 additions & 109 deletions source/lib/rocprofiler-sdk/context/allocator.hpp

This file was deleted.

2 changes: 1 addition & 1 deletion source/lib/rocprofiler-sdk/hsa/aql_packet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ TraceMemoryPool::Alloc(void** ptr, size_t size, desc_t flags, void* data)
{
// Return page aligned data to avoid cache flush overlap
status = pool.allocate_fn(pool.gpu_pool_, size + 0x2000, 0, ptr);
*ptr = (void*) ((uintptr_t(*ptr) + 0xFFF) & ~0xFFFul); // NOLINT
*ptr = (void*) ((uintptr_t(*ptr) + 0xFFF) & ~0xFFFul); // NOLINT(performance-no-int-to-ptr)
}
return status;
}
Expand Down
1 change: 0 additions & 1 deletion source/lib/rocprofiler-sdk/internal_threading.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
#include "lib/common/container/stable_vector.hpp"
#include "lib/common/static_object.hpp"
#include "lib/common/utility.hpp"
#include "lib/rocprofiler-sdk/allocator.hpp"
#include "lib/rocprofiler-sdk/buffer.hpp"
#include "lib/rocprofiler-sdk/context/context.hpp"
#include "lib/rocprofiler-sdk/internal_threading.hpp"
Expand Down
1 change: 0 additions & 1 deletion source/lib/rocprofiler-sdk/internal_threading.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
#include "lib/common/container/stable_vector.hpp"
#include "lib/common/defines.hpp"
#include "lib/common/utility.hpp"
#include "lib/rocprofiler-sdk/allocator.hpp"

#include <PTL/TaskManager.hh>
#include <PTL/ThreadPool.hh>
Expand Down
Loading

0 comments on commit 5d54682

Please sign in to comment.