Skip to content

Commit

Permalink
Improve handling of printf in OMPT on Intel GPUs
Browse files Browse the repository at this point in the history
  • Loading branch information
masterleinad committed Dec 21, 2023
1 parent 52e44d6 commit 79164a4
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions core/src/Kokkos_Printf.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ namespace Kokkos {
// In contrast to std::printf, return void to get a consistent behavior across
// backends. The GPU backends always return 1 and NVHPC only compiles if we
// don't ask for the return value.
#if defined(KOKKOS_ENABLE_OPENMPTARGET) && defined(KOKKOS_ARCH_INTEL_GPU)
using ::printf;
#else
template <typename... Args>
KOKKOS_FORCEINLINE_FUNCTION void printf(const char* format, Args... args) {
#ifdef KOKKOS_ENABLE_SYCL
Expand All @@ -39,15 +42,13 @@ KOKKOS_FORCEINLINE_FUNCTION void printf(const char* format, Args... args) {
else
sycl::ext::oneapi::experimental::printf(format, args...);
#else
if constexpr (sizeof...(Args) == 0) ::printf("%s", format);
// FIXME_OPENMPTARGET non-string-literal argument used in printf is not
// supported for spir64
#if !(defined(KOKKOS_ENABLE_OPENMPTARGET) && defined(KOKKOS_ARCH_INTEL_GPU))
if constexpr (sizeof...(Args) == 0)
::printf("%s", format);
else
::printf(format, args...);
#endif
#endif
}
#endif

} // namespace Kokkos

Expand Down

0 comments on commit 79164a4

Please sign in to comment.