diff --git a/openmp/libomptarget/DeviceRTL/include/Debug.h b/openmp/libomptarget/DeviceRTL/include/Debug.h --- a/openmp/libomptarget/DeviceRTL/include/Debug.h +++ b/openmp/libomptarget/DeviceRTL/include/Debug.h @@ -23,8 +23,15 @@ ///} -// TODO: We need to allow actual printf. -#define PRINTF(fmt, ...) (void)fmt; +/// Print +/// { +extern "C" { +int printf(const char *format, ...); +} + +#define PRINTF(fmt, ...) (void)printf(fmt, __VA_ARGS__); #define PRINT(str) PRINTF("%s", str) +///} + #endif diff --git a/openmp/libomptarget/DeviceRTL/src/Debug.cpp b/openmp/libomptarget/DeviceRTL/src/Debug.cpp --- a/openmp/libomptarget/DeviceRTL/src/Debug.cpp +++ b/openmp/libomptarget/DeviceRTL/src/Debug.cpp @@ -28,4 +28,18 @@ } } +/// AMDGCN implementations of the printf. +/// +///{ +#pragma omp begin declare variant match(device = {arch(amdgcn)}) + +extern "C" { +inline __attribute__((always_inline)) int printf(const char *format, ...) { + return 0; +} +} + +#pragma omp end declare variant +///} + #pragma omp end declare target