Public bug reported:

# What was expected

I created a program main.cpp:

#include <stdio.h>
#include <stdlib.h>
#include <hip/hip_runtime.h>

#define CHECK_HIP(expr) do {              \
  hipError_t result = (expr);             \
  if (result != hipSuccess) {             \
    fprintf(stderr, "%s:%d: %s (%d)\n",   \
      __FILE__, __LINE__,                 \
      hipGetErrorString(result), result); \
    exit(EXIT_FAILURE);                   \
  }                                       \
} while(0)

__global__ void sq_arr(float *arr, int n) {
  int tid = blockDim.x*blockIdx.x + threadIdx.x;
  if (tid < n) {
    arr[tid] = arr[tid] * arr[tid];
  }
}

int main() {
  enum { N = 5 };
  float hArr[N] = { 1, 2, 3, 4, 5 };
  float *dArr;
  CHECK_HIP(hipMalloc(&dArr, sizeof(float) * N));
  CHECK_HIP(hipMemcpy(dArr, hArr, sizeof(float) * N, hipMemcpyHostToDevice));
  sq_arr<<<dim3(1), dim3(32,1,1), 0, 0>>>(dArr, N);
  CHECK_HIP(hipMemcpy(hArr, dArr, sizeof(float) * N, hipMemcpyDeviceToHost));
  for (int i = 0; i < N; ++i) {
    printf("%f\n", hArr[i]);
  }
  CHECK_HIP(hipFree(dArr));
  return 0;
}

I built the program with hipcc, then ran it.

hipcc main.cpp
./a.out

The resulting output was:

1.000000
4.000000
9.000000
16.000000
25.000000
Failed to free ptr:0x7f980f800000 size:2097152

# What was expected

The output should not include "Failed to free ptr:0x7f980f800000
size:2097152".

ltrace seems to indicate that this message is printed during
hsa_shut_down.

# System Info

## lsb_release -rd
Description: Ubuntu Resolute Raccoon (development branch)
Release: 26.04

# apt-cache policy libhsa-runtime64-1
libhsa-runtime64-1:
  Installed: 7.1.0+dfsg-0ubuntu6
  Candidate: 7.1.0+dfsg-0ubuntu6
  Version table:
 *** 7.1.0+dfsg-0ubuntu6 500
        500 http://archive.ubuntu.com/ubuntu resolute/universe amd64 Packages
        100 /var/lib/dpkg/status

** Affects: rocr-runtime (Ubuntu)
     Importance: Undecided
         Status: New

-- 
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

Reply via email to