Skip to content

Commit

Permalink
Patch for printf issue in Alpaka SYCL
Browse files Browse the repository at this point in the history
  • Loading branch information
Stewart Martin-Haugh committed Dec 10, 2024
1 parent 6563111 commit fc8b56f
Show file tree
Hide file tree
Showing 2 changed files with 55 additions and 2 deletions.
9 changes: 7 additions & 2 deletions extern/alpaka/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,13 @@ message( STATUS "Building Alpaka as part of the TRACCC project" )
set( TRACCC_ALPAKA_SOURCE
"URL;https://github.com/alpaka-group/alpaka/archive/refs/tags/1.2.0.tar.gz;URL_MD5;0e2dcf4ddf7987532835d7b2b3680843"
CACHE STRING "Source for Alpaka, when built as part of this project" )
mark_as_advanced( TRACCC_ALPAKA_SOURCE )
FetchContent_Declare( Alpaka SYSTEM ${TRACCC_ALPAKA_SOURCE} )
#Patch for alpaka printf macro
set( TRACCC_ALPAKA_PATCH
"PATCH_COMMAND;patch;-p1;<;${CMAKE_CURRENT_SOURCE_DIR}/alpaka-1.2.0.patch"
CACHE STRING "Patch for alpaka, when built as part of this project" )

mark_as_advanced( TRACCC_ALPAKA_SOURCE TRACCC_ALPAKA_PATCH )
FetchContent_Declare( Alpaka SYSTEM ${TRACCC_ALPAKA_SOURCE} ${TRACCC_ALPAKA_PATCH})

# Turn off build testing.
set( BUILD_TESTING FALSE )
Expand Down
48 changes: 48 additions & 0 deletions extern/alpaka/alpaka-1.2.0.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
Only in alpaka-1.2.0-orig: .clang-format
Only in alpaka-1.2.0-orig: .dockerignore
Only in alpaka-1.2.0-orig: .git
Only in alpaka-1.2.0-orig: .github
Only in alpaka-1.2.0-orig: .gitignore
Only in alpaka-1.2.0-orig: .gitlab-ci.yml
diff -ur alpaka-1.2.0-orig/include/alpaka/core/Sycl.hpp alpaka-1.2.0-fixed/include/alpaka/core/Sycl.hpp
--- alpaka-1.2.0-orig/include/alpaka/core/Sycl.hpp 2024-12-09 18:48:17.584316863 +0100
+++ alpaka-1.2.0-fixed/include/alpaka/core/Sycl.hpp 2024-12-10 17:18:28.416146705 +0100
@@ -24,35 +24,6 @@

# include <sycl/sycl.hpp>

-// if SYCL is enabled with the AMD backend the printf will be killed because of missing compiler support
-# ifdef __AMDGCN__
-# define printf(...)
-# else
-
-# ifdef __SYCL_DEVICE_ONLY__
-using AlpakaFormat = char const* [[clang::opencl_constant]];
-# else
-using AlpakaFormat = char const*;
-# endif
-
-# if BOOST_COMP_CLANG
-# pragma clang diagnostic push
-# pragma clang diagnostic ignored "-Wgnu-zero-variadic-macro-arguments"
-# endif
-
-# define printf(FORMAT, ...) \
- do \
- { \
- static auto const format = AlpakaFormat{FORMAT}; \
- sycl::ext::oneapi::experimental::printf(format, ##__VA_ARGS__); \
- } while(false)
-
-# if BOOST_COMP_CLANG
-# pragma clang diagnostic pop
-# endif
-
-# endif
-
// SYCL vector types trait specializations.
namespace alpaka
{
Only in alpaka-1.2.0-orig: .pre-commit-config.yaml
Only in alpaka-1.2.0-orig: .readthedocs.yml
Only in alpaka-1.2.0-orig: .zenodo.json

0 comments on commit fc8b56f

Please sign in to comment.