From baaca0f9566e1f9fddffd93824235b42755db854 Mon Sep 17 00:00:00 2001 From: "systems-assistant[bot]" <221163467+systems-assistant[bot]@users.noreply.github.com> Date: Wed, 3 Sep 2025 20:35:42 +0530 Subject: [PATCH] SWDEV-545485 - Fix memory leaks in memset performance tests (#541) Co-authored-by: Satyanvesh Dittakavi Co-authored-by: Satyanvesh Dittakavi <53337087+satyanveshd@users.noreply.github.com> --- projects/hip-tests/catch/performance/memset/hipMemset2DAsync.cc | 1 + projects/hip-tests/catch/performance/memset/hipMemset3DAsync.cc | 1 + projects/hip-tests/catch/performance/memset/hipMemsetAsync.cc | 1 + projects/hip-tests/catch/performance/memset/hipMemsetD16Async.cc | 1 + projects/hip-tests/catch/performance/memset/hipMemsetD32Async.cc | 1 + projects/hip-tests/catch/performance/memset/hipMemsetD8Async.cc | 1 + 6 files changed, 6 insertions(+) diff --git a/projects/hip-tests/catch/performance/memset/hipMemset2DAsync.cc b/projects/hip-tests/catch/performance/memset/hipMemset2DAsync.cc index 828a6ab4ca..fcaa237221 100644 --- a/projects/hip-tests/catch/performance/memset/hipMemset2DAsync.cc +++ b/projects/hip-tests/catch/performance/memset/hipMemset2DAsync.cc @@ -40,6 +40,7 @@ class Memset2DAsyncBenchmark : public Benchmark { HIP_CHECK(hipMemset2DAsync(dst_.ptr(), dst_.pitch(), 17, dst_.width(), dst_.height(), stream_.stream())); } + HIP_CHECK(hipStreamSynchronize(stream_.stream())); } private: diff --git a/projects/hip-tests/catch/performance/memset/hipMemset3DAsync.cc b/projects/hip-tests/catch/performance/memset/hipMemset3DAsync.cc index a99be883e1..93a4e390af 100644 --- a/projects/hip-tests/catch/performance/memset/hipMemset3DAsync.cc +++ b/projects/hip-tests/catch/performance/memset/hipMemset3DAsync.cc @@ -39,6 +39,7 @@ class Memset3DAsyncBenchmark : public Benchmark { TIMED_SECTION_STREAM(kTimerTypeEvent, stream_.stream()) { HIP_CHECK(hipMemset3DAsync(dst_.pitched_ptr(), 17, dst_.extent(), stream_.stream())); } + HIP_CHECK(hipStreamSynchronize(stream_.stream())); } private: diff --git a/projects/hip-tests/catch/performance/memset/hipMemsetAsync.cc b/projects/hip-tests/catch/performance/memset/hipMemsetAsync.cc index 0ca01d551c..9f05ff14f6 100644 --- a/projects/hip-tests/catch/performance/memset/hipMemsetAsync.cc +++ b/projects/hip-tests/catch/performance/memset/hipMemsetAsync.cc @@ -39,6 +39,7 @@ class MemsetAsyncBenchmark : public Benchmark { TIMED_SECTION_STREAM(kTimerTypeEvent, stream_.stream()) { HIP_CHECK(hipMemsetAsync(dst_.ptr(), 17, size_, stream_.stream())); } + HIP_CHECK(hipStreamSynchronize(stream_.stream())); } private: diff --git a/projects/hip-tests/catch/performance/memset/hipMemsetD16Async.cc b/projects/hip-tests/catch/performance/memset/hipMemsetD16Async.cc index 4045a170c3..d3ad42fa5d 100644 --- a/projects/hip-tests/catch/performance/memset/hipMemsetD16Async.cc +++ b/projects/hip-tests/catch/performance/memset/hipMemsetD16Async.cc @@ -40,6 +40,7 @@ class MemsetD16AsyncBenchmark : public Benchmark { HIP_CHECK(hipMemsetD16Async(reinterpret_cast(dst_.ptr()), 311, size_, stream_.stream())); } + HIP_CHECK(hipStreamSynchronize(stream_.stream())); } private: diff --git a/projects/hip-tests/catch/performance/memset/hipMemsetD32Async.cc b/projects/hip-tests/catch/performance/memset/hipMemsetD32Async.cc index f1aefd34f6..5255d7c2d6 100644 --- a/projects/hip-tests/catch/performance/memset/hipMemsetD32Async.cc +++ b/projects/hip-tests/catch/performance/memset/hipMemsetD32Async.cc @@ -40,6 +40,7 @@ class MemsetD32AsyncBenchmark : public Benchmark { HIP_CHECK(hipMemsetD32Async(reinterpret_cast(dst_.ptr()), 123'456, size_, stream_.stream())); } + HIP_CHECK(hipStreamSynchronize(stream_.stream())); } private: diff --git a/projects/hip-tests/catch/performance/memset/hipMemsetD8Async.cc b/projects/hip-tests/catch/performance/memset/hipMemsetD8Async.cc index 70690b3f73..7b8ef5b77b 100644 --- a/projects/hip-tests/catch/performance/memset/hipMemsetD8Async.cc +++ b/projects/hip-tests/catch/performance/memset/hipMemsetD8Async.cc @@ -40,6 +40,7 @@ class MemsetD8AsyncBenchmark : public Benchmark { HIP_CHECK(hipMemsetD8Async(reinterpret_cast(dst_.ptr()), 17, size_, stream_.stream())); } + HIP_CHECK(hipStreamSynchronize(stream_.stream())); } private: