RAJA
RAJA provides a collection of platform portability abstractions for C++ HPC applications.
Lambda.hpp
Go to the documentation of this file.
1 
12 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~//
13 // Copyright (c) Lawrence Livermore National Security, LLC and other
14 // RAJA Project Developers. See top-level LICENSE and COPYRIGHT
15 // files for dates and other details. No copyright assignment is required
16 // to contribute to RAJA.
17 //
18 // SPDX-License-Identifier: (BSD-3-Clause)
19 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~//
20 
21 #ifndef RAJA_policy_sycl_kernel_Lambda_HPP
22 #define RAJA_policy_sycl_kernel_Lambda_HPP
23 
24 #include "RAJA/config.hpp"
25 
26 #if defined(RAJA_ENABLE_SYCL)
27 
28 #include <cassert>
29 #include <climits>
30 
31 #include "camp/camp.hpp"
32 
33 #include "RAJA/util/macros.hpp"
34 #include "RAJA/util/types.hpp"
35 
36 #include "RAJA/pattern/kernel.hpp"
38 
39 namespace RAJA
40 {
41 namespace internal
42 {
43 
44 // SyclStatementExecutor for actually invoking the lambda
45 
46 template<typename Data,
47  camp::idx_t LambdaIndex,
48  typename... Args,
49  typename Types>
50 struct SyclStatementExecutor<Data,
51  statement::Lambda<LambdaIndex, Args...>,
52  Types>
53 {
54 
55  static inline RAJA_DEVICE void exec(Data& data,
56  ::sycl::nd_item<3> RAJA_UNUSED_ARG(item),
57  bool thread_active)
58  {
59  // Only execute the lambda if it hasn't been masked off
60  if (thread_active)
61  {
62  StatementExecutor<statement::Lambda<LambdaIndex, Args...>, Types>::exec(
63  data);
64  }
65  }
66 
67  static inline LaunchDims calculateDimensions(
68  Data const& RAJA_UNUSED_ARG(data))
69  {
70  return LaunchDims();
71  }
72 };
73 
74 } // namespace internal
75 } // namespace RAJA
76 
77 #endif // closing endif for RAJA_ENABLE_SYCL guard
78 
79 #endif // closing endif for header file include guard
Header file for common RAJA internal macro definitions.
#define RAJA_UNUSED_ARG(x)
Definition: macros.hpp:97
#define RAJA_DEVICE
Definition: macros.hpp:66
Definition: AlignedRangeIndexSetBuilders.cpp:35
Header file for kernel lambda executor.
RAJA header file containing user interface for RAJA::kernel.
Header file for RAJA type definitions.