Memory Allocation Counter Track Shows Total Allocation (#71)

* Counter track for memory allocation is now a running sum showing total allocation

* Address review comments

* Update source/lib/output/generatePerfetto.cpp

Co-authored-by: Meserve, Mark <Mark.Meserve@amd.com>

* Updated to reflect review comments

* Fix compilation errors on CI

* remove braces on scalar

* Fix struct compilation issues

* Removed name_to_id for sanitizer

---------

Co-authored-by: Meserve, Mark <Mark.Meserve@amd.com>
This commit is contained in:
Trowbridge, Ian
2025-02-12 12:59:53 -06:00
committed by GitHub
parent 5d0b220c37
commit cc0c401615
10 changed files with 166 additions and 65 deletions
@@ -185,6 +185,8 @@ call_hsa_memory_allocate(const size_t i, const size_t base_size, hsa_agent_t age
hsa_region_t* ptr_reg = &region_list[0];
status = hsa_agent_iterate_regions(agent, callback_get_regions, &ptr_reg);
RET_IF_HSA_ERR(status)
auto address_vec = std::vector<void*>{};
address_vec.reserve(i);
for(size_t j = 0; j < i; ++j)
{
@@ -192,6 +194,10 @@ call_hsa_memory_allocate(const size_t i, const size_t base_size, hsa_agent_t age
status = hsa_memory_allocate(region_list[0], base_size, &addr);
RET_IF_HSA_ERR(status)
address_vec.emplace_back(addr);
}
for(void* addr : address_vec)
{
status = hsa_memory_free(addr);
RET_IF_HSA_ERR(status)
}
@@ -215,6 +221,8 @@ call_hsa_memory_pool_allocate(const size_t i, const size_t base_size, hsa_agent_
hsa_amd_memory_pool_t* ptr_memory_pool = &memory_pool_list[0];
status = hsa_amd_agent_iterate_memory_pools(agent, callback_get_memory_pools, &ptr_memory_pool);
RET_IF_HSA_ERR(status)
auto address_vec = std::vector<void*>{};
address_vec.reserve(i);
for(size_t j = 0; j < i; ++j)
{
@@ -223,6 +231,10 @@ call_hsa_memory_pool_allocate(const size_t i, const size_t base_size, hsa_agent_
status = hsa_amd_memory_pool_allocate(memory_pool_list[0], base_size, flags, &addr);
RET_IF_HSA_ERR(status)
address_vec.emplace_back(addr);
}
for(void* addr : address_vec)
{
status = hsa_amd_memory_pool_free(addr);
RET_IF_HSA_ERR(status)
}