Use logical_node_id for mapping rocprofiler agents to HSA agents (#708)

* Temp: Fixing node id

* source formatting (clang-format v11) (#709)

Co-authored-by: ammarwa <3832908+ammarwa@users.noreply.github.com>

* Using logical node id

* Update agent.cpp

* Update agent.cpp

* Python formatting

---------

Co-authored-by: Ammar ELWazir <aelwazir@rocprofiler1.amd.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: ammarwa <3832908+ammarwa@users.noreply.github.com>
Co-authored-by: Ammar ELWazir <aelwazir@rocprofiler2.amd.com>
Co-authored-by: Jonathan R. Madsen <jonathanrmadsen@gmail.com>

[ROCm/rocprofiler-sdk commit: 62625d0aa1]
Este commit está contenido en:
Ammar ELWazir
2024-04-02 01:38:18 -05:00
cometido por GitHub
padre a79493bbb9
commit c1c514f743
Se han modificado 4 ficheros con 25 adiciones y 9 borrados
@@ -755,7 +755,9 @@ construct_agent_cache(::HsaApiTable* table)
for(const auto* ritr : rocp_agents)
{
if(ritr->node_id == internal_node_id)
// TODO(aelwazir): To be changed back to use node id once ROCR fixes
// the hsa_agents to use the real node id
if(ritr->logical_node_id == static_cast<int64_t>(internal_node_id))
{
rocp_hsa_agent_node_ids.erase(internal_node_id);
break;
@@ -799,9 +801,11 @@ construct_agent_cache(::HsaApiTable* table)
static_cast<hsa_agent_info_t>(HSA_AMD_AGENT_INFO_DRIVER_NODE_ID),
&node_id) == HSA_STATUS_SUCCESS)
{
if(ritr->node_id == node_id)
// TODO(aelwazir): To be changed back to use node id once ROCR fixes
// the hsa_agents to use the real node id
if(ritr->logical_node_id == static_cast<int64_t>(node_id))
{
agent_map.emplace(ritr->node_id, std::make_tuple(ritr, hitr));
agent_map.emplace(ritr->logical_node_id, std::make_tuple(ritr, hitr));
get_agent_mapping().emplace_back(agent_pair{ritr, hitr});
break;
}
@@ -888,8 +892,10 @@ construct_agent_cache(::HsaApiTable* table)
{
if(rocp_agent->type == ROCPROFILER_AGENT_TYPE_GPU)
{
// TODO(aelwazir): To be changed back to use node id once ROCR fixes
// the hsa_agents to use the real node id
LOG(ERROR) << fmt::format("rocprofiler agent <-> HSA agent mapping failed: {} ({})",
rocp_agent->node_id,
rocp_agent->logical_node_id,
err.what());
}
}
@@ -244,7 +244,9 @@ TEST(rocprofiler_lib, agent)
EXPECT_EQ(std::string_view{agent->product_name},
std::string_view{hsa_agent->device_mkt_name})
<< msg;
EXPECT_EQ(agent->node_id, hsa_agent->internal_node_id) << msg;
// TODO(aelwazir): To be changed back to use node id once ROCR fixes the hsa_agents to use
// the real node id
EXPECT_EQ(agent->logical_node_id, hsa_agent->internal_node_id) << msg;
EXPECT_EQ(agent->location_id, hsa_agent->bdf_id) << msg;
EXPECT_EQ(agent->device_id, hsa_agent->chip_id) << msg;
EXPECT_EQ(agent->simd_count, hsa_agent->compute_unit * hsa_agent->simds_per_cu) << msg;
@@ -30,9 +30,17 @@ def test_counter_values(input_data):
scaling_factor = 64 / itr["wave_front_size"]
break
for itr in data["rocprofiler-sdk-json-tool"]["buffer_records"]["counter_collection"]:
value = itr["counter_value"]
assert int(round(value, 0)) == int(round(1 * scaling_factor, 0)), str(data)
scaling_factor = 64 / itr["wave_front_size"]
for itr in data["rocprofiler-sdk-json-tool"]["buffer_records"][
"counter_collection"
]:
value = itr["counter_value"]
assert int(round(value, 0)) == int(round(1 * scaling_factor, 0)), (
f"Failure on agent "
f"{str(itr)} expected {1 * scaling_factor} but got {value} "
f"Debug Info:\n {str(data)}"
)
if __name__ == "__main__":
@@ -32,7 +32,7 @@ set(kernel-tracing-env
set_tests_properties(
test-kernel-tracing-execute
PROPERTIES TIMEOUT 45 LABELS "integration-tests" ENVIRONMENT "${kernel-tracing-env}"
PROPERTIES TIMEOUT 100 LABELS "integration-tests" ENVIRONMENT "${kernel-tracing-env}"
FAIL_REGULAR_EXPRESSION "${ROCPROFILER_DEFAULT_FAIL_REGEX}")
foreach(FILENAME validate.py pytest.ini conftest.py)