You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[vulkan] Failed: Some allocations were not freed before destruction of this memory block #2948
Hello, I'm facing the error "Check failed: m_pMetadata->IsEmpty() && "Some allocations were not freed before destruction of this memory block!" while running simple.mlir on Samsung S9 (QP1A.190711.020.G960FXXSBETH1)
starlte:/data/local/tmp $ ./iree-benchmark-module -driver=vulkan -input_file=simple-vulkan.vmfb -entry_function=abs -inputs="i32=2"
2020-08-20 00:37:18
Running ./iree-benchmark-module
Run on (8 X 1794 MHz CPU s)
***WARNING*** CPU scaling is enabled, the benchmark real time measurements may be noisy and will incur extra overhead.
I ../iree/tools/vm_util.cc:227] Creating driver and device for 'vulkan'...
I ../iree/hal/vulkan/vulkan_driver.cc:298] Created Vulkan Device: Mali-G72
F ../third_party/vulkan_memory_allocator/src/vk_mem_alloc.h:11175] Check failed: m_pMetadata->IsEmpty() && "Some allocations were not freed before destruction of this memory block!"
Aborted
@antiagainst can you please share, have you seen this issue?
Hi @denis0x0D, thanks for the report! Sorry for the late reply; I'm on leave at the moment.
I haven't hit such issues thus far and I don't have a S9 with me. But wondering whether one can reproduce it on S10. @hanhanW could you give it a try to see whether this is reproducible?
Regression just never ends. :( We probably want to put iree-benchmark-module in the tests too by controlling the total run time to get basic check for it.
iree-run-module is fine; so I'd be curious of the differences between iree-run-module and iree-benchmark-module. Likely because we have an loop in it trying to creating resources multiple times but without proper releasing?
Hello, I want to report the same issue on desktop GPU but with python binding. What I do is basically wrapping the SyetemContext in a loop and this error occurred every time after like 10 iterations. Here is the error message when this occurred.
I iree/hal/vulkan/vulkan_driver.cc:298] Created Vulkan Device: Tesla P100-PCIE-16GB
Created IREE driver vulkan: <pyiree.rt.binding.HalDriver object at 0x7fd370087960>
I iree/hal/vulkan/vulkan_driver.cc:298] Created Vulkan Device: Tesla P100-PCIE-16GB
SystemContext driver=<pyiree.rt.binding.HalDriver object at 0x7fd370087960>
F external/vulkan_memory_allocator/src/vk_mem_alloc.h:11175] Check failed: m_pMetadata->IsEmpty() && "Some allocations were not freed before destruction of this memory block!"
Hopefully, this can help with finding the root cause.
Can you try with #2800 ? That would be nice to land, but it's tricky to know for sure if each of the changes in that area are fixing issues without causing more :/
That is working with another change I have. We need to release the input before others. Ie, add inputs.reset(); after the loop. I'll send out the PR for releasing inputs.
It seems the same Vulkan memory leak problem is still in the python binding. The simplest way to reproduce the error is to take colab's low level invoke example. Put everything except the import in an infinite loop. Also, change the driver_name to "vulkan" and run it.
On my machine with Nvidia P100 GPU, the exception: "Check failed: m_pMetadata->IsEmpty() && "Some allocations were not freed before destruction of this memory block!" always pops up in the iteration 83.
Activity
antiagainst commentedon Aug 24, 2020
Hi @denis0x0D, thanks for the report! Sorry for the late reply; I'm on leave at the moment.
I haven't hit such issues thus far and I don't have a S9 with me. But wondering whether one can reproduce it on S10. @hanhanW could you give it a try to see whether this is reproducible?
hanhanW commentedon Aug 24, 2020
Oh, sorry I didn't see the issue. Yes, I will take a look if this is reproducible on S10.
hanhanW commentedon Aug 24, 2020
Yes, this is reproducible on S10. I also tried, this is reproducible on desktop GPU as well.
The full log
hanhanW commentedon Aug 24, 2020
It seems like the same issue #2455 ?
@benvanik is there any PRs that might cause this issue recently?
I'll investigate if this can be revealed via ASAN for other backends.
hanhanW commentedon Aug 24, 2020
Can't reproduce with ASAN in VMLA, seems to be vulkan specific issue.
antiagainst commentedon Aug 24, 2020
Regression just never ends. :( We probably want to put
iree-benchmark-modulein the tests too by controlling the total run time to get basic check for it.iree-run-moduleis fine; so I'd be curious of the differences betweeniree-run-moduleandiree-benchmark-module. Likely because we have an loop in it trying to creating resources multiple times but without proper releasing?A few things that helps to debug:
IREE_VERBOSE_REF_PTRIREE_DISPATCH_LOGGINGto 1lioujheyu commentedon Aug 24, 2020
Hello, I want to report the same issue on desktop GPU but with python binding. What I do is basically wrapping the SyetemContext in a loop and this error occurred every time after like 10 iterations. Here is the error message when this occurred.
Hopefully, this can help with finding the root cause.
denis0x0D commentedon Aug 26, 2020
@antiagainst @hanhanW thanks for looking on this issue and suggestions!
hanhanW commentedon Aug 26, 2020
The benchmarking tool will try to iterate 10, 100, 1000, 10000... times
https://github.com/google/iree/blob/6bd3b1dc13236566d1f8ee651cd3ab9b03dd8a1d/iree/tools/benchmark_module_main.cc#L137-L149
It works if you break the loop earlier, like right after the 127 iteration, on vulkan.
I count on the iterations, it seems that it can only execute 128 times in the loop.
It looks like it's related to kMaxInFlightFenceCount. If I set it to 64 then it can only iterate 64 times.
https://github.com/google/iree/blob/6bd3b1dc13236566d1f8ee651cd3ab9b03dd8a1d/iree/hal/vulkan/timepoint_util.h#L123
hanhanW commentedon Aug 26, 2020
And 256 times if I set the number to 256.
hanhanW commentedon Aug 26, 2020
@ScottTodd could you take a look at this?
ScottTodd commentedon Aug 26, 2020
Can you try with #2800 ? That would be nice to land, but it's tricky to know for sure if each of the changes in that area are fixing issues without causing more :/
hanhanW commentedon Aug 26, 2020
That is working with another change I have. We need to release the input before others. Ie, add
inputs.reset();after the loop. I'll send out the PR for releasing inputs.hanhanW commentedon Aug 26, 2020
hmm, it just works with my patch. I remembered I tried it this afternoon, but it's not working. Anyway, I'll send out the PR to fix this.
Release inputs before closing the session.
Release inputs before closing the session.
Release inputs before closing the session. (#3004)
antiagainst commentedon Aug 27, 2020
Thanks for looking into it and fixing this, @hanhanW!
lioujheyu commentedon Oct 7, 2020
Hello,
It seems the same Vulkan memory leak problem is still in the python binding. The simplest way to reproduce the error is to take colab's low level invoke example. Put everything except the import in an infinite loop. Also, change the driver_name to "vulkan" and run it.
On my machine with Nvidia P100 GPU, the exception: "Check failed: m_pMetadata->IsEmpty() && "Some allocations were not freed before destruction of this memory block!" always pops up in the iteration 83.
hanhanW commentedon Oct 7, 2020
Can it be reproduced in tool level on your machine? Ie, compile the
simple_mulwithiree-translateand run oniree-run-benchmark.lioujheyu commentedon Oct 7, 2020
No, it cannot be reproduced in iree-translate/iree-benchmark-module. Think the issue is specific to the python binding.
hanhanW commentedon Oct 7, 2020
Let's move the discussion to #3381, since it only happens on python binding.