RAJA
RAJA provides a collection of platform portability abstractions for C++ HPC applications.
Conditional.hpp
Go to the documentation of this file.
1 
11 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~//
12 // Copyright (c) Lawrence Livermore National Security, LLC and other
13 // RAJA Project Developers. See top-level LICENSE and COPYRIGHT
14 // files for dates and other details. No copyright assignment is required
15 // to contribute to RAJA.
16 //
17 // SPDX-License-Identifier: (BSD-3-Clause)
18 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~//
19 
20 #ifndef RAJA_policy_sycl_kernel_Conditional_HPP
21 #define RAJA_policy_sycl_kernel_Conditional_HPP
22 
23 #include "RAJA/config.hpp"
24 
25 #include <iostream>
26 #include <type_traits>
27 
28 #include "RAJA/util/macros.hpp"
29 #include "RAJA/util/types.hpp"
30 
32 
34 
35 namespace RAJA
36 {
37 namespace internal
38 {
39 
40 
41 template<typename Data,
42  typename Conditional,
43  typename... EnclosedStmts,
44  typename Types>
45 struct SyclStatementExecutor<Data,
46  statement::If<Conditional, EnclosedStmts...>,
47  Types>
48 {
49 
50  using stmt_list_t = StatementList<EnclosedStmts...>;
51  using enclosed_stmts_t = SyclStatementListExecutor<Data, stmt_list_t, Types>;
52 
53  static inline RAJA_DEVICE void exec(Data& data,
54  ::sycl::nd_item<3> item,
55  bool thread_active)
56  {
57  if (Conditional::eval(data))
58  {
59 
60  // execute enclosed statements
61  enclosed_stmts_t::exec(data, item, thread_active);
62  }
63  }
64 
65  static inline LaunchDims calculateDimensions(Data const& data)
66  {
67  return enclosed_stmts_t::calculateDimensions(data);
68  }
69 };
70 
71 
72 } // namespace internal
73 } // end namespace RAJA
74 
75 
76 #endif
Header file for common RAJA internal macro definitions.
#define RAJA_DEVICE
Definition: macros.hpp:66
camp::list< Stmts... > StatementList
Definition: StatementList.hpp:41
Definition: AlignedRangeIndexSetBuilders.cpp:35
Header file for kernel conditional templates.
RAJA header file containing constructs used to run kernel traversals on GPU with SYCL.
static RAJA_DEVICE void exec(Data &data, ::sycl::nd_item< 3 > item, bool thread_active)
Definition: Conditional.hpp:53
static LaunchDims calculateDimensions(Data const &data)
Definition: Conditional.hpp:65
SyclStatementListExecutor< Data, stmt_list_t, Types > enclosed_stmts_t
Definition: Conditional.hpp:51
Header file for RAJA type definitions.