From dac779c834163304a31240e3fefd0d5b4130d3b0 Mon Sep 17 00:00:00 2001 From: Jaydeep Patel Date: Thu, 29 Aug 2024 06:34:06 +0000 Subject: [PATCH] SWDEV-481861 - Add hipEventDestory for every hipEventCreate in all samples. Change-Id: Ib1b860b02ef2640f321d54902b34ecf0e495ed65 --- samples/2_Cookbook/10_inline_asm/inline_asm.cpp | 3 +++ samples/2_Cookbook/13_occupancy/occupancy.cpp | 3 +++ samples/2_Cookbook/1_hipEvent/hipEvent.cpp | 3 +++ 3 files changed, 9 insertions(+) diff --git a/samples/2_Cookbook/10_inline_asm/inline_asm.cpp b/samples/2_Cookbook/10_inline_asm/inline_asm.cpp index 39bc86f1b6..1ced9af6d7 100644 --- a/samples/2_Cookbook/10_inline_asm/inline_asm.cpp +++ b/samples/2_Cookbook/10_inline_asm/inline_asm.cpp @@ -127,6 +127,9 @@ int main() { checkHipErrors(hipEventElapsedTime(&eventMs, start, stop)); + checkHipErrors(hipEventDestroy(start)); + checkHipErrors(hipEventDestroy(stop)); + printf("hipMemcpyDeviceToHost time taken = %6.3fms\n", eventMs); // CPU MatrixTranspose computation diff --git a/samples/2_Cookbook/13_occupancy/occupancy.cpp b/samples/2_Cookbook/13_occupancy/occupancy.cpp index 497b670f04..fa9ecb723a 100644 --- a/samples/2_Cookbook/13_occupancy/occupancy.cpp +++ b/samples/2_Cookbook/13_occupancy/occupancy.cpp @@ -80,6 +80,9 @@ void launchKernel(float* C, float* A, float* B, bool manual){ checkHipErrors(hipEventElapsedTime(&eventMs, start, stop)); printf("kernel Execution time = %6.3fms\n", eventMs); + checkHipErrors(hipEventDestroy(start)); + checkHipErrors(hipEventDestroy(stop)); + //Calculate Occupancy int numBlock = 0; checkHipErrors(hipOccupancyMaxActiveBlocksPerMultiprocessor(&numBlock, multiply, blockSize, 0)); diff --git a/samples/2_Cookbook/1_hipEvent/hipEvent.cpp b/samples/2_Cookbook/1_hipEvent/hipEvent.cpp index a4d5508f14..0ff6ab5547 100644 --- a/samples/2_Cookbook/1_hipEvent/hipEvent.cpp +++ b/samples/2_Cookbook/1_hipEvent/hipEvent.cpp @@ -129,6 +129,9 @@ int main() { printf("hipMemcpyDeviceToHost time taken = %6.3fms\n", eventMs); + checkHipErrors(hipEventDestroy(start)); + checkHipErrors(hipEventDestroy(stop)); + // CPU MatrixTranspose computation matrixTransposeCPUReference(cpuTransposeMatrix, Matrix, WIDTH);