From c22b4fdea1f2804262e7dab61d76ce3767cc789d Mon Sep 17 00:00:00 2001 From: kjayapra-amd Date: Tue, 7 Jan 2025 15:35:07 -0500 Subject: [PATCH] SWDEV-504749 - Call hipStreamSynchronize before exiting the program to avoid memleaks. Change-Id: Icd5d4c8f27b04caaeb315eb93673234f274b5c5b --- .../1_Utils/hipDispatchLatency/hipDispatchEnqueueRateMT.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/samples/1_Utils/hipDispatchLatency/hipDispatchEnqueueRateMT.cpp b/samples/1_Utils/hipDispatchLatency/hipDispatchEnqueueRateMT.cpp index aced502d8f..2dff0bb3a6 100644 --- a/samples/1_Utils/hipDispatchLatency/hipDispatchEnqueueRateMT.cpp +++ b/samples/1_Utils/hipDispatchLatency/hipDispatchEnqueueRateMT.cpp @@ -98,8 +98,10 @@ void hipModuleLaunchKernel_enqueue_rate(const std::vector& buffer, std::at auto stop = std::chrono::high_resolution_clock::now(); results[i] = std::chrono::duration(stop - start).count(); } + checkHipErrors(hipModuleUnload(module)); print_timing("Thread ID : " + std::to_string(tid) + " , " + "hipModuleLaunchKernel enqueue rate", results); + checkHipErrors(hipStreamSynchronize(stream)); checkHipErrors(hipStreamDestroy(stream)); } @@ -122,6 +124,7 @@ void hipLaunchKernelGGL_enqueue_rate(const std::vector& buffer, std::atomi results[i] = std::chrono::duration(stop - start).count(); } print_timing("Thread ID : " + std::to_string(tid) + " , " + "hipLaunchKernelGGL enqueue rate", results); + checkHipErrors(hipStreamSynchronize(stream)); checkHipErrors(hipStreamDestroy(stream)); } @@ -183,5 +186,7 @@ int main(int argc, char* argv[]) task.start(hipLaunchKernelGGL_enqueue_rate); task.finish(); } + + return 0; }