Build system (libdw), correlation ID, and shebang fixes (#354)

* Fix compilation for output library

- link to targets for ATT (amd-comgr, dw, elf)

* Relax correlation ID retirement log failures

- only fail for correlation ID retirement underflow when building in CI mode

* Fix shebang for several files

- license was inserted before shebang in several places

* Update code coverage exclude folders for samples

* Tweak to agent tests

- test to make sure hsa agent is not the old value instead of testing that it is the new value

* Fix libdw include/link

---------

Co-authored-by: Jonathan R. Madsen <jonathanrmadsen@gmail.com>
This commit is contained in:
Madsen, Jonathan
2025-04-27 20:16:18 -05:00
committed by GitHub
parent 06005c7f6b
commit 3580478426
31 changed files with 116 additions and 316 deletions
+3 -1
View File
@@ -10,7 +10,8 @@ target_link_libraries(
att-parser-tool-v3
PRIVATE rocprofiler-sdk::rocprofiler-sdk-att-parser
rocprofiler-sdk::rocprofiler-sdk-json
rocprofiler-sdk::rocprofiler-sdk-common-library)
rocprofiler-sdk::rocprofiler-sdk-common-library
rocprofiler-sdk::rocprofiler-sdk-dw)
add_executable(att-decoder-test)
target_sources(att-decoder-test PRIVATE att_decoder_test.cpp)
@@ -21,6 +22,7 @@ target_link_libraries(
rocprofiler-sdk::rocprofiler-sdk-common-library
rocprofiler-sdk::rocprofiler-sdk-glog
rocprofiler-sdk::rocprofiler-sdk-static-library
rocprofiler-sdk::rocprofiler-sdk-dw
GTest::gtest
GTest::gtest_main)
+4 -1
View File
@@ -61,4 +61,7 @@ target_link_libraries(
rocprofiler-sdk::rocprofiler-sdk-common-library
rocprofiler-sdk::rocprofiler-sdk-cereal
rocprofiler-sdk::rocprofiler-sdk-perfetto
rocprofiler-sdk::rocprofiler-sdk-otf2)
rocprofiler-sdk::rocprofiler-sdk-otf2
rocprofiler-sdk::rocprofiler-sdk-amd-comgr
rocprofiler-sdk::rocprofiler-sdk-dw
rocprofiler-sdk::rocprofiler-sdk-elf)
+3 -1
View File
@@ -70,7 +70,8 @@ target_link_libraries(
rocprofiler-sdk::rocprofiler-sdk-amd-comgr
rocprofiler-sdk::rocprofiler-sdk-hsa-aql
rocprofiler-sdk::rocprofiler-sdk-drm
rocprofiler-sdk::rocprofiler-sdk-hsakmt-nolink)
rocprofiler-sdk::rocprofiler-sdk-hsakmt-nolink
rocprofiler-sdk::rocprofiler-sdk-dw)
target_compile_definitions(rocprofiler-sdk-object-library PRIVATE rocprofiler_EXPORTS=1)
@@ -140,6 +141,7 @@ target_link_libraries(
PUBLIC rocprofiler-sdk::rocprofiler-sdk-headers
rocprofiler-sdk::rocprofiler-sdk-hsa-runtime-nolink
rocprofiler-sdk::rocprofiler-sdk-hip-nolink
$<BUILD_INTERFACE:rocprofiler-sdk::rocprofiler-sdk-dw>
PRIVATE rocprofiler-sdk::rocprofiler-sdk-common-library
rocprofiler-sdk::rocprofiler-sdk-object-library)
@@ -26,6 +26,7 @@
#include "lib/common/utility.hpp"
#include "lib/rocprofiler-sdk/buffer.hpp"
#include "lib/rocprofiler-sdk/context/context.hpp"
#include "lib/rocprofiler-sdk/registration.hpp"
#include <rocprofiler-sdk/fwd.h>
@@ -63,7 +64,8 @@ correlation_id::add_ref_count()
{
auto _ret = m_ref_count.fetch_add(1);
ROCP_FATAL_IF(_ret == 0) << "correlation id already retired";
ROCP_CI_LOG_IF(WARNING, _ret == 0)
<< fmt::format("correlation id {} already retired", internal);
return _ret;
}
@@ -71,9 +73,19 @@ correlation_id::add_ref_count()
uint32_t
correlation_id::sub_ref_count()
{
if(m_ref_count == 0)
{
ROCP_CI_LOG(WARNING) << fmt::format(
"attempt to decrement correlation id {} reference count but reference count is zero",
internal);
return 0;
}
auto _ret = m_ref_count.fetch_sub(1);
ROCP_FATAL_IF(_ret == 0) << "correlation id underflow";
if(registration::get_fini_status() > 0) return 0;
ROCP_CI_LOG_IF(WARNING, _ret == 0) << fmt::format("correlation id underflow on {}", internal);
if(_ret == 1)
{
@@ -101,7 +113,8 @@ correlation_id::sub_ref_count()
ROCPROFILER_BUFFER_TRACING_CORRELATION_ID_RETIREMENT,
record);
ROCP_FATAL_IF(!success) << "failed to emplace correlation id retirement";
ROCP_CI_LOG_IF(WARNING, !success)
<< fmt::format("failed to emplace correlation id retirement for {}", internal);
}
}
}
+1 -1
View File
@@ -267,7 +267,7 @@ TEST(rocprofiler_lib, agent)
EXPECT_EQ(agent->workgroup_max_dim.z, hsa_agent->workgroup_max_dim[2]) << msg;
EXPECT_EQ(agent->grid_max_size, hsa_agent->grid_max_size) << msg;
// Skip the checks for older grid x, y, z dimension values.
if(hsa_agent->grid_max_dim.x == std::numeric_limits<int32_t>::max())
if(hsa_agent->grid_max_dim.x != std::numeric_limits<uint32_t>::max())
{
EXPECT_EQ(agent->grid_max_dim.x, hsa_agent->grid_max_dim.x) << msg;
EXPECT_EQ(agent->grid_max_dim.y, hsa_agent->grid_max_dim.y) << msg;