I suppose that's not a double-free as the second call has a different
address. There's no corresponding call to KfdDriver::AllocateKfdMemory
for that second free. With that said, the unique size (2^21) makes it
seem related.
I'm testing on a system with a Ryzen 7950X and a Radeon RX 9070 XT. I'm
not sure whether it's relevant that I have both an integrated and a
discrete GPU, so I figured I should mention that.
The stack trace of the allocation:
#0 rocr::AMD::KfdDriver::AllocateKfdMemory (flags=<synthetic pointer>...,
node_id=0, size=2097152)
at
/usr/src/rocr-runtime-7.1.0+dfsg-0ubuntu6/runtime/hsa-runtime/core/driver/kfd/amd_kfd_driver.cpp:510
#1 rocr::AMD::KfdDriver::AllocateMemory (this=<optimized out>, mem_region=...,
alloc_flags=0,
mem=0x7fffffffd6b0, size=2097152, agent_node_id=<optimized out>)
at
/usr/src/rocr-runtime-7.1.0+dfsg-0ubuntu6/runtime/hsa-runtime/core/driver/kfd/amd_kfd_driver.cpp:292
#2 0x00007ffff5bdf10e in rocr::AMD::MemoryRegion::Allocate
(this=0x5555555791c0,
size=@0x7fffffffd638: 2097152, alloc_flags=0, address=0x7fffffffd6b0,
agent_node_id=0)
at
/usr/src/rocr-runtime-7.1.0+dfsg-0ubuntu6/runtime/hsa-runtime/core/runtime/amd_memory_region.cpp:131
#3 0x00007ffff5c195ec in rocr::core::Runtime::AllocateMemory
(this=0x555555576010, region=0x5555555791c0,
size=<optimized out>, alloc_flags=0, address=0x7fffffffd6b0,
agent_node_id=<optimized out>)
at
/usr/src/rocr-runtime-7.1.0+dfsg-0ubuntu6/runtime/hsa-runtime/core/runtime/runtime.cpp:317
#4 0x00007ffff5c2419f in operator() (__closure=<optimized out>,
size=<optimized out>,
alignment=<optimized out>, alloc_flags=<optimized out>,
agent_node_id=<optimized out>)
at
/usr/src/rocr-runtime-7.1.0+dfsg-0ubuntu6/runtime/hsa-runtime/core/runtime/runtime.cpp:200
#5 std::__invoke_impl<void*,
rocr::core::Runtime::RegisterAgent(rocr::core::Agent*, bool)::<lambda(size_t,
size_t, rocr::core::MemoryRegion::AllocateFlags, int)>&, long unsigned int,
long unsigned int, unsigned int, int>
(__f=...) at /usr/include/c++/15/bits/invoke.h:63
#6 std::__invoke_r<void*,
rocr::core::Runtime::RegisterAgent(rocr::core::Agent*, bool)::<lambda(size_t,
size_t, rocr::core::MemoryRegion::AllocateFlags, int)>&, long unsigned int,
long unsigned int, unsigned int, int> (
__fn=...) at /usr/include/c++/15/bits/invoke.h:116
#7 std::_Function_handler<void*(long unsigned int, long unsigned int, unsigned
int, int), rocr::core::Runtime::RegisterAgent(rocr::core::Agent*,
bool)::<lambda(size_t, size_t, rocr::core::MemoryRegion::AllocateFlags, int)>
>::_M_invoke(const std::_Any_data &, unsigned long &&, unsigned long &&,
unsigned int &&, int &&) (
__functor=..., __args#0=<optimized out>, __args#1=<optimized out>,
__args#2=<optimized out>,
__args#3=<optimized out>) at /usr/include/c++/15/bits/std_function.h:292
#8 0x00007ffff5c29554 in std::function<void* (unsigned long, unsigned long,
unsigned int, int)>::operator()(unsigned long, unsigned long, unsigned int,
int) const (this=<optimized out>, __args#0=<optimized out>,
__args#1=64, __args#2=<optimized out>, __args#3=<optimized out>)
at /usr/include/c++/15/bits/std_function.h:593
#9 rocr::core::SharedSignalPool_t::alloc (this=0x555555576848)
at
/usr/src/rocr-runtime-7.1.0+dfsg-0ubuntu6/runtime/hsa-runtime/core/runtime/signal.cpp:79
#10 rocr::core::Shared<rocr::core::SharedSignal,
rocr::core::SharedSignalPool_t>::Shared (
this=0x55555557a7f8, pool=<optimized out>, flags=<optimized out>)
at
/usr/src/rocr-runtime-7.1.0+dfsg-0ubuntu6/runtime/hsa-runtime/core/common/shared.h:129
#11 rocr::core::LocalSignal::LocalSignal (this=<optimized out>,
initial_value=<optimized out>,
exportable=<optimized out>, this=<optimized out>, initial_value=<optimized
out>,
exportable=<optimized out>)
at
/usr/src/rocr-runtime-7.1.0+dfsg-0ubuntu6/runtime/hsa-runtime/core/runtime/signal.cpp:127
#12 0x00007ffff5c04a24 in rocr::core::InterruptSignal::InterruptSignal
(this=<optimized out>,
initial_value=<optimized out>, use_event=<optimized out>, this=<optimized
out>,
initial_value=<optimized out>, use_event=<optimized out>)
at
/usr/src/rocr-runtime-7.1.0+dfsg-0ubuntu6/runtime/hsa-runtime/core/runtime/interrupt_signal.cpp:95
#13 0x00007ffff5bea523 in rocr::core::Runtime::BindErrorHandlers
(this=0x555555576010)
at
/usr/src/rocr-runtime-7.1.0+dfsg-0ubuntu6/runtime/hsa-runtime/core/runtime/runtime.cpp:1837
#14 rocr::core::Runtime::Load (this=0x555555576010)
at
/usr/src/rocr-runtime-7.1.0+dfsg-0ubuntu6/runtime/hsa-runtime/core/runtime/runtime.cpp:2150
#15 rocr::core::Runtime::Acquire ()
at
/usr/src/rocr-runtime-7.1.0+dfsg-0ubuntu6/runtime/hsa-runtime/core/runtime/runtime.cpp:127
#16 rocr::HSA::hsa_init ()
at
/usr/src/rocr-runtime-7.1.0+dfsg-0ubuntu6/runtime/hsa-runtime/core/runtime/hsa.cpp:206
#17 0x00007ffff698b19d in amd::roc::Hsa::init ()
at /usr/src/rocm-hipamd-7.1.0-0ubuntu2/rocclr/device/rocm/rocrctx.hpp:173
#18 amd::roc::Device::init () at
/usr/src/rocm-hipamd-7.1.0-0ubuntu2/rocclr/device/rocm/rocdevice.cpp:343
#19 0x00007ffff6939569 in amd::Device::init ()
at /usr/src/rocm-hipamd-7.1.0-0ubuntu2/rocclr/device/device.cpp:691
#20 0x00007ffff6979cae in amd::Runtime::init ()
at /usr/src/rocm-hipamd-7.1.0-0ubuntu2/rocclr/platform/runtime.cpp:77
#21 0x00007ffff6591ef7 in hip::init (status=0x7fffffffdd77)
at /usr/src/rocm-hipamd-7.1.0-0ubuntu2/hipamd/src/hip_context.cpp:55
#22 0x00007ffff5fda464 in __pthread_once_slow (once_control=0x7ffff7faaa38
<hip::g_ihipInitialized>,
init_routine=0x7ffff6370630 <__once_proxy>) at ./nptl/pthread_once.c:116
#23 0x00007ffff5fda4d9 in ___pthread_once (once_control=<optimized out>,
init_routine=<optimized out>)
at ./nptl/pthread_once.c:143
#24 0x00007ffff670f231 in __gthread_once (__once=<optimized out>,
__func=<optimized out>)
at /usr/include/x86_64-linux-gnu/c++/15/bits/gthr-default.h:746
#25 std::call_once<void (&)(bool*), bool*> (__once=..., __f=<optimized out>) at
/usr/include/c++/15/mutex:918
#26 hip::hipMalloc (ptr=0x7fffffffe410, sizeBytes=20)
at /usr/src/rocm-hipamd-7.1.0-0ubuntu2/hipamd/src/hip_memory.cpp:759
#27 0x00005555555552a7 in main ()
The first deallocation of size 2097152:
#0 rocr::AMD::KfdDriver::FreeKfdMemory (mem=mem@entry=0x7ffff5600000,
size=size@entry=2097152)
at
/usr/src/rocr-runtime-7.1.0+dfsg-0ubuntu6/runtime/hsa-runtime/core/driver/kfd/amd_kfd_driver.cpp:516
#1 0x00007ffff5bb4233 in rocr::AMD::KfdDriver::FreeMemory (this=<optimized
out>, mem=0x7ffff5600000,
size=2097152)
at
/usr/src/rocr-runtime-7.1.0+dfsg-0ubuntu6/runtime/hsa-runtime/core/driver/kfd/amd_kfd_driver.cpp:358
#2 0x00007ffff5bdf9f8 in rocr::AMD::MemoryRegion::FreeImpl
(this=0x5555555791c0, address=0x7ffff5600000,
size=2097152)
at
/usr/src/rocr-runtime-7.1.0+dfsg-0ubuntu6/runtime/hsa-runtime/core/runtime/amd_memory_region.cpp:165
#3 rocr::AMD::MemoryRegion::FreeImpl (this=0x5555555791c0,
address=0x7ffff5600000, size=2097152)
at
/usr/src/rocr-runtime-7.1.0+dfsg-0ubuntu6/runtime/hsa-runtime/core/runtime/amd_memory_region.cpp:162
#4 rocr::AMD::MemoryRegion::Free (this=0x5555555791c0, address=0x7ffff5600000,
size=2097152)
at
/usr/src/rocr-runtime-7.1.0+dfsg-0ubuntu6/runtime/hsa-runtime/core/runtime/amd_memory_region.cpp:159
#5 0x00007ffff5c19bf2 in rocr::core::Runtime::FreeMemory (this=<optimized
out>, ptr=0x7ffff5600000)
at
/usr/src/rocr-runtime-7.1.0+dfsg-0ubuntu6/runtime/hsa-runtime/core/runtime/runtime.cpp:373
#6 0x00007ffff5c29121 in std::function<void(void*)>::operator()
(this=<optimized out>,
__args#0=<optimized out>) at /usr/include/c++/15/bits/std_function.h:593
#7 rocr::core::SharedSignalPool_t::clear (this=0x555555576848)
at
/usr/src/rocr-runtime-7.1.0+dfsg-0ubuntu6/runtime/hsa-runtime/core/runtime/signal.cpp:70
#8 0x00007ffff5bed37d in rocr::core::Runtime::Unload (this=0x555555576010)
at
/usr/src/rocr-runtime-7.1.0+dfsg-0ubuntu6/runtime/hsa-runtime/core/runtime/runtime.cpp:2218
#9 rocr::core::Runtime::Release ()
at
/usr/src/rocr-runtime-7.1.0+dfsg-0ubuntu6/runtime/hsa-runtime/core/runtime/runtime.cpp:145
#10 rocr::HSA::hsa_shut_down ()
at
/usr/src/rocr-runtime-7.1.0+dfsg-0ubuntu6/runtime/hsa-runtime/core/runtime/hsa.cpp:213
#11 0x00007ffff6979f7a in amd::Runtime::tearDown ()
at /usr/src/rocm-hipamd-7.1.0-0ubuntu2/rocclr/platform/runtime.cpp:97
#12 amd::Runtime::tearDown () at
/usr/src/rocm-hipamd-7.1.0-0ubuntu2/rocclr/platform/runtime.cpp:91
#13 0x00007ffff697a066 in amd::RuntimeTearDown::~RuntimeTearDown
(this=<optimized out>)
at /usr/src/rocm-hipamd-7.1.0-0ubuntu2/rocclr/platform/runtime.cpp:121
#14 amd::RuntimeTearDown::~RuntimeTearDown (this=<optimized out>)
at /usr/src/rocm-hipamd-7.1.0-0ubuntu2/rocclr/platform/runtime.cpp:113
#15 0x00007ffff5f790e2 in __cxa_finalize (d=0x7ffff6a7e000) at
./stdlib/cxa_finalize.c:97
#16 0x00007ffff658bc57 in __do_global_dtors_aux () from
/usr/lib/x86_64-linux-gnu/libamdhip64.so.7
#17 0x00007fffffffe300 in ?? ()
#18 0x00007ffff7fc30d2 in _dl_call_fini (closure_map=0x7ffff7fb7170) at
./elf/dl-call_fini.c:43
The failing deallocation:
#0 rocr::AMD::KfdDriver::FreeKfdMemory (mem=mem@entry=0x7ffea3a00000,
size=size@entry=2097152)
at
/usr/src/rocr-runtime-7.1.0+dfsg-0ubuntu6/runtime/hsa-runtime/core/driver/kfd/amd_kfd_driver.cpp:516
#1 0x00007ffff5bb4233 in rocr::AMD::KfdDriver::FreeMemory (this=<optimized
out>, mem=0x7ffea3a00000,
size=2097152)
at
/usr/src/rocr-runtime-7.1.0+dfsg-0ubuntu6/runtime/hsa-runtime/core/driver/kfd/amd_kfd_driver.cpp:358
#2 0x00007ffff5bc1931 in rocr::AMD::MemoryRegion::FreeImpl
(this=0x5555555c4060, address=0x7ffea3a00000,
size=2097152)
at
/usr/src/rocr-runtime-7.1.0+dfsg-0ubuntu6/runtime/hsa-runtime/core/runtime/amd_memory_region.cpp:165
#3 rocr::AMD::MemoryRegion::FreeImpl (this=0x5555555c4060,
address=0x7ffea3a00000, size=2097152)
at
/usr/src/rocr-runtime-7.1.0+dfsg-0ubuntu6/runtime/hsa-runtime/core/runtime/amd_memory_region.cpp:162
#4 rocr::AMD::MemoryRegion::BlockAllocator::free (this=0x5555555c40c0,
ptr=0x7ffea3a00000, length=2097152)
at
/usr/src/rocr-runtime-7.1.0+dfsg-0ubuntu6/runtime/hsa-runtime/core/inc/amd_memory_region.h:210
#5 rocr::SimpleHeap<rocr::AMD::MemoryRegion::BlockAllocator>::trim
(this=0x5555555c40c0)
at
/usr/src/rocr-runtime-7.1.0+dfsg-0ubuntu6/runtime/hsa-runtime/core/util/simple_heap.h:280
#6 rocr::SimpleHeap<rocr::AMD::MemoryRegion::BlockAllocator>::~SimpleHeap
(this=<optimized out>,
this=<optimized out>)
at
/usr/src/rocr-runtime-7.1.0+dfsg-0ubuntu6/runtime/hsa-runtime/core/util/simple_heap.h:123
#7 rocr::AMD::MemoryRegion::~MemoryRegion (this=<optimized out>,
this=<optimized out>)
at
/usr/src/rocr-runtime-7.1.0+dfsg-0ubuntu6/runtime/hsa-runtime/core/runtime/amd_memory_region.cpp:127
#8 rocr::AMD::MemoryRegion::~MemoryRegion (this=<optimized out>,
this=<optimized out>)
at
/usr/src/rocr-runtime-7.1.0+dfsg-0ubuntu6/runtime/hsa-runtime/core/runtime/amd_memory_region.cpp:127
#9 rocr::DeleteObject::operator()<rocr::core::MemoryRegion> (this=<synthetic
pointer>, ptr=0x5555555c4060)
at
/usr/src/rocr-runtime-7.1.0+dfsg-0ubuntu6/runtime/hsa-runtime/core/util/utils.h:248
#10 std::for_each<__gnu_cxx::__normal_iterator<rocr::core::MemoryRegion
const**, std::vector<rocr::core::MemoryRegion const*,
std::allocator<rocr::core::MemoryRegion const*> > >,
rocr::DeleteObject>(__gnu_cxx::__normal_iterator<rocr::core::MemoryRegion
const**, std::vector<rocr::core::MemoryRegion const*,
std::allocator<rocr::core::MemoryRegion const*> > >,
__gnu_cxx::__normal_iterator<rocr::core::MemoryRegion const**,
std::vector<rocr::core::MemoryRegion const*,
std::allocator<rocr::core::MemoryRegion const*> > >, rocr::DeleteObject) [clone
.isra.0] (__first=..., __last=..., __f=...) at
/usr/include/c++/15/bits/stl_algo.h:3798
#11 0x00007ffff5bc7f2f in rocr::AMD::GpuAgent::~GpuAgent (this=<optimized out>,
this=<optimized out>)
at
/usr/src/rocr-runtime-7.1.0+dfsg-0ubuntu6/runtime/hsa-runtime/core/runtime/amd_gpu_agent.cpp:247
#12 0x00007ffff5bc8455 in rocr::AMD::GpuAgent::~GpuAgent (this=<optimized out>,
this=<optimized out>)
at
/usr/src/rocr-runtime-7.1.0+dfsg-0ubuntu6/runtime/hsa-runtime/core/runtime/amd_gpu_agent.cpp:249
#13 0x00007ffff5bed53e in rocr::DeleteObject::operator()<rocr::core::Agent>
(this=<synthetic pointer>,
ptr=<optimized out>)
at
/usr/src/rocr-runtime-7.1.0+dfsg-0ubuntu6/runtime/hsa-runtime/core/util/utils.h:248
#14 std::for_each<__gnu_cxx::__normal_iterator<rocr::core::Agent**,
std::vector<rocr::core::Agent*, std::allocator<rocr::core::Agent*> > >,
rocr::DeleteObject> (__f=..., __first=0x5555555a15d0, __last=...)
at /usr/include/c++/15/bits/stl_algo.h:3798
#15 rocr::core::Runtime::DestroyAgents (this=0x555555576010)
at
/usr/src/rocr-runtime-7.1.0+dfsg-0ubuntu6/runtime/hsa-runtime/core/runtime/runtime.cpp:239
#16 rocr::core::Runtime::Unload (this=0x555555576010)
at
/usr/src/rocr-runtime-7.1.0+dfsg-0ubuntu6/runtime/hsa-runtime/core/runtime/runtime.cpp:2229
#17 rocr::core::Runtime::Release ()
at
/usr/src/rocr-runtime-7.1.0+dfsg-0ubuntu6/runtime/hsa-runtime/core/runtime/runtime.cpp:145
#18 rocr::HSA::hsa_shut_down ()
at
/usr/src/rocr-runtime-7.1.0+dfsg-0ubuntu6/runtime/hsa-runtime/core/runtime/hsa.cpp:213
#19 0x00007ffff6979f7a in amd::Runtime::tearDown ()
at /usr/src/rocm-hipamd-7.1.0-0ubuntu2/rocclr/platform/runtime.cpp:97
#20 amd::Runtime::tearDown () at
/usr/src/rocm-hipamd-7.1.0-0ubuntu2/rocclr/platform/runtime.cpp:91
#21 0x00007ffff697a066 in amd::RuntimeTearDown::~RuntimeTearDown
(this=<optimized out>)
at /usr/src/rocm-hipamd-7.1.0-0ubuntu2/rocclr/platform/runtime.cpp:121
#22 amd::RuntimeTearDown::~RuntimeTearDown (this=<optimized out>)
at /usr/src/rocm-hipamd-7.1.0-0ubuntu2/rocclr/platform/runtime.cpp:113
#23 0x00007ffff5f790e2 in __cxa_finalize (d=0x7ffff6a7e000) at
./stdlib/cxa_finalize.c:97
#24 0x00007ffff658bc57 in __do_global_dtors_aux () from
/usr/lib/x86_64-linux-gnu/libamdhip64.so.7
#25 0x00007fffffffe300 in ?? ()
#26 0x00007ffff7fc30d2 in _dl_call_fini (closure_map=0x7ffff7fb7170) at
./elf/dl-call_fini.c:43
--
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/2142805
Title:
Failed to free ptr in hsa_shutdown
To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/rocr-runtime/+bug/2142805/+subscriptions
--
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs