Skip to content

Commit

Permalink
Fix compiling code using Kokkos::printf for OpenMPTarget on Intel GPUs (
Browse files Browse the repository at this point in the history
kokkos#6443)

* Fix compiling code using Kokkos::printf for OpenMPTarget on Intel GPUs

* Also guard test case
  • Loading branch information
masterleinad committed Sep 19, 2023
1 parent 36af9d6 commit 8239de5
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
7 changes: 5 additions & 2 deletions core/src/impl/Kokkos_Printf.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,14 @@ KOKKOS_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);
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))
else
::printf(format, args...);
#endif
#endif
}

} // namespace Kokkos
Expand Down
4 changes: 4 additions & 0 deletions core/unit_test/TestPrintf.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,8 @@ void test_kokkos_printf() {
ASSERT_EQ(captured, expected_string);
}

// FIXME_OPENMPTARGET non-string-literal argument used in printf is not
// supported for spir64
#if !(defined(KOKKOS_ENABLE_OPENMPTARGET) && defined(KOKKOS_ARCH_INTEL_GPU))
TEST(TEST_CATEGORY, kokkos_printf) { test_kokkos_printf<TEST_EXECSPACE>(); }
#endif

0 comments on commit 8239de5

Please sign in to comment.