Add logical_node_type_id field to rocprofiler_agent_t (#948)

* Add logical_node_type_id field to rocprofiler_agent_t

* Patch queue_controller
This commit is contained in:
Jonathan R. Madsen
2024-06-24 23:18:58 -05:00
committed by GitHub
parent 62ec95eae6
commit af2f85ca93
4 changed files with 40 additions and 7 deletions
+18 -5
View File
@@ -369,6 +369,9 @@ read_topology()
auto data = std::vector<unique_agent_t>{};
uint64_t idcount = 0;
uint64_t nodecount = 0;
uint64_t cpucount = 0;
uint64_t gpucount = 0;
uint64_t unkcount = 0;
while(true)
{
@@ -398,11 +401,12 @@ read_topology()
// we may have been able to open the properties file but if it was empty, we ignore it
if(properties.empty()) continue;
auto agent_info = common::init_public_api_struct(rocprofiler_agent_t{});
agent_info.type = ROCPROFILER_AGENT_TYPE_NONE;
agent_info.logical_node_id = idcount++;
agent_info.node_id = node_id;
agent_info.id.handle = (agent_info.logical_node_id) + get_agent_offset();
auto agent_info = common::init_public_api_struct(rocprofiler_agent_t{});
agent_info.type = ROCPROFILER_AGENT_TYPE_NONE;
agent_info.logical_node_id = idcount++;
agent_info.node_id = node_id;
agent_info.id.handle = (agent_info.logical_node_id) + get_agent_offset();
agent_info.logical_node_type_id = -1;
if(!name_prop.empty())
agent_info.model_name =
@@ -419,6 +423,15 @@ read_topology()
agent_info.type = ROCPROFILER_AGENT_TYPE_CPU;
else if(agent_info.simd_count > 0)
agent_info.type = ROCPROFILER_AGENT_TYPE_GPU;
else
ROCP_WARNING << "agent " << agent_info.node_id << " is neither a CPU nor a GPU";
if(agent_info.type == ROCPROFILER_AGENT_TYPE_CPU)
agent_info.logical_node_type_id = cpucount++;
else if(agent_info.type == ROCPROFILER_AGENT_TYPE_GPU)
agent_info.logical_node_type_id = gpucount++;
else
agent_info.logical_node_type_id = unkcount++;
read_property(properties, "mem_banks_count", agent_info.mem_banks_count);
read_property(properties, "caches_count", agent_info.caches_count);
@@ -137,7 +137,9 @@ constexpr rocprofiler_agent_t default_agent =
.product_name = nullptr,
.model_name = nullptr,
.node_id = 0,
.logical_node_id = 0};
.logical_node_id = 0,
.logical_node_type_id = 0,
.reserved_padding0 = 0};
} // namespace
void
+3 -1
View File
@@ -103,9 +103,11 @@ TEST(rocprofiler_lib, agent_abi)
EXPECT_EQ(offsetof(rocprofiler_agent_t, model_name), 272) << msg;
EXPECT_EQ(offsetof(rocprofiler_agent_t, node_id), 280) << msg;
EXPECT_EQ(offsetof(rocprofiler_agent_t, logical_node_id), 284) << msg;
EXPECT_EQ(offsetof(rocprofiler_agent_t, logical_node_type_id), 288) << msg;
EXPECT_EQ(offsetof(rocprofiler_agent_t, reserved_padding0), 292) << msg;
// Add test for offset of new field above this. Do NOT change any existing values!
constexpr auto expected_rocp_agent_size = 288;
constexpr auto expected_rocp_agent_size = 296;
// If a new field is added, increase this value by the size of the new field(s)
EXPECT_EQ(sizeof(rocprofiler_agent_t), expected_rocp_agent_size)
<< "ABI break. If you added a new field, make sure that this is the only new check that "