HIP icon indicating copy to clipboard operation
HIP copied to clipboard

Trivial GPU-printf hello causes hang on gfx803

Open BryantLam opened this issue 4 years ago • 4 comments

I'm running a trivial hello program on gfx803 with a printf statement inside the GPU kernel. The host code appears to get stuck in hipDeviceSynchronize and the GPU kernel never prints (the program hangs). rocm-smi reports 100% GPU.

The expected behavior / no problem occurs on gfx900: the GPU prints 8 lines and the code returns.

// hello.cpp
#include <hip/hip_runtime.h>
#include <stdio.h>

__global__ void hello(void)
{
  int id = threadIdx.x;
  printf("Hello world from GPU thread %d!\n", id);
  return;
}

int main(void)
{
  hipLaunchKernelGGL(hello, dim3(1), dim3(8), 0, 0);
  hipDeviceSynchronize();
  return 0;
}
$  /opt/rocm/bin/hipcc  hello.cpp  -o hello

Environment

  • ROCm 3.9.0
  • HIP version: 3.9.20412-6d111f85
  • gfx803: AMD Radeon Fury Nano
    • repro'd on three different devices

BryantLam avatar May 03 '21 18:05 BryantLam

Hi, I have the same problem on MI50 (gfx906). Have you solved this?

francis0407 avatar May 24 '21 02:05 francis0407

I am still observing the same behavior with ROCm 3.9.0 and 4.2. Hang on gfx803; okay on gfx900.

BryantLam avatar May 24 '21 15:05 BryantLam

Still hangs on gfx803 with ROCm 5.6...

Interestingly, only /opt/rocm/bin/hipcc hello.cpp hangs. /opt/rocm/llvm/bin/clang++ -x hip -l amdhip64 -L /opt/rocm/lib hello.cpp does not hang, but nothing is printed to stdout.

lahwaacz avatar Aug 06 '23 16:08 lahwaacz

ROCm 5.7.0 includes a fallback to OpenCL-based printf that may resolve this issue. https://rocm.docs.amd.com/en/docs-5.7.0/release.html#non-hostcall-hip-printf

bdenhollander avatar Sep 16 '23 14:09 bdenhollander

@BryantLam, Sorry for the lack of response. Please try latest ROCm 6.0.2 (HIP 6.0.32831) to see if your issue still exists? If resolved, please close the ticket. Thanks.

ppanchad-amd avatar Mar 20 '24 17:03 ppanchad-amd

@ppanchad-amd Still hangs on gfx803 with HIP 6.0.32831.

lahwaacz avatar Mar 29 '24 16:03 lahwaacz

@lahwaacz Unfortunately, gfx803 had been dropped official support from ROCm-4.0. Closing bug. Thanks!

ppanchad-amd avatar Apr 01 '24 14:04 ppanchad-amd