20 #ifndef RAJA_pattern_launch_core_HPP
21 #define RAJA_pattern_launch_core_HPP
23 #include "RAJA/config.hpp"
35 #if defined(RAJA_HIP_ACTIVE)
37 #elif defined(RAJA_CUDA_ACTIVE)
41 #include "camp/camp.hpp"
42 #include "camp/concepts.hpp"
43 #include "camp/tuple.hpp"
46 #if defined(RAJA_GPU_DEVICE_COMPILE_PASS_ACTIVE) && !defined(RAJA_SYCL_ACTIVE)
47 #define RAJA_TEAM_SHARED __shared__
49 #define RAJA_TEAM_SHARED
68 template<
typename HOST_POLICY
69 #if defined(RAJA_GPU_ACTIVE)
71 typename DEVICE_POLICY = HOST_POLICY
78 #if defined(RAJA_GPU_ACTIVE)
79 using device_policy_t = DEVICE_POLICY;
83 template<
typename HOST_POLICY
84 #if defined(RAJA_GPU_ACTIVE)
86 typename DEVICE_POLICY = HOST_POLICY
92 #if defined(RAJA_GPU_ACTIVE)
93 using device_policy_t = DEVICE_POLICY;
174 size_t in_shared_mem_size = 0)
188 Threads apply(Threads
const& a) {
return (
threads = a); }
200 #if defined(RAJA_SYCL_ACTIVE)
202 mutable ::sycl::nd_item<3>* itm;
221 return static_cast<T*
>(mem_ptr);
234 #if defined(RAJA_GPU_DEVICE_COMPILE_PASS_ACTIVE) && defined(RAJA_SYCL_ACTIVE)
235 itm->barrier(::sycl::access::fence_space::local_space);
238 #if defined(RAJA_GPU_DEVICE_COMPILE_PASS_ACTIVE) && !defined(RAJA_SYCL_ACTIVE)
252 #if defined(RAJA_HIP_ACTIVE)
255 #elif defined(RAJA_CUDA_ACTIVE)
262 template<
typename LAUNCH_POLICY>
267 template<
typename LAUNCH_POLICY,
typename... ReduceParams>
269 ReduceParams&&... rest_of_launch_args)
273 std::forward<ReduceParams>(rest_of_launch_args)...);
276 std::string kernel_name =
285 util::make_context<typename LAUNCH_POLICY::host_policy_t>(
286 std::move(kernel_name))};
299 typename LAUNCH_POLICY::host_policy_t>::type;
301 launch_t::exec(Res::get_default(), launch_params, p_body, reducers);
309 template<
typename POLICY_LIST,
typename BODY>
312 launch<POLICY_LIST>(place, params,
body);
317 template<
typename POLICY_LIST,
typename... ReduceParams>
320 ReduceParams&&... rest_of_launch_args)
330 typename POLICY_LIST::host_policy_t>::type;
331 launch<LaunchPolicy<typename POLICY_LIST::host_policy_t>>(
332 Res::get_default(), launch_params,
333 std::forward<ReduceParams>(rest_of_launch_args)...);
336 #if defined(RAJA_GPU_ACTIVE)
340 typename POLICY_LIST::device_policy_t>::type;
341 launch<LaunchPolicy<typename POLICY_LIST::device_policy_t>>(
342 Res::get_default(), launch_params,
343 std::forward<ReduceParams>(rest_of_launch_args)...);
355 #if defined(RAJA_ENABLE_CUDA) || defined(RAJA_ENABLE_HIP) || \
356 defined(RAJA_ENABLE_SYCL)
357 template<
typename T,
typename U>
358 RAJA::resources::Resource Get_Runtime_Resource(T host_res,
364 return RAJA::resources::Resource(device_res);
368 return RAJA::resources::Resource(host_res);
381 return RAJA::resources::Resource(host_res);
388 template<
typename POLICY_LIST,
typename... ReduceParams>
389 resources::EventProxy<resources::Resource>
launch(
390 RAJA::resources::Resource res,
392 ReduceParams&&... rest_of_launch_args)
397 std::forward<ReduceParams>(rest_of_launch_args)...);
399 std::string kernel_name =
406 if (res.get_platform() == RAJA::Platform::host)
418 #if defined(RAJA_GPU_ACTIVE)
421 ? util::make_context<typename POLICY_LIST::host_policy_t>(
422 std::move(kernel_name))
423 : util::make_context<typename POLICY_LIST::device_policy_t>(
424 std::move(kernel_name))};
427 util::make_context<typename POLICY_LIST::host_policy_t>(
428 std::move(kernel_name))};
445 resources::EventProxy<resources::Resource> e_proxy =
446 launch_t::exec(res, launch_params, p_body, reducers);
450 #if defined(RAJA_GPU_ACTIVE)
454 resources::EventProxy<resources::Resource> e_proxy =
455 launch_t::exec(res, launch_params, p_body, reducers);
469 return resources::EventProxy<resources::Resource>(res);
472 template<
typename POLICY_LIST>
473 #if defined(RAJA_GPU_DEVICE_COMPILE_PASS_ACTIVE)
474 using loop_policy =
typename POLICY_LIST::device_policy_t;
479 template<
typename POLICY,
typename SEGMENT>
482 template<
typename POLICY,
typename SEGMENT>
486 template<
typename POLICY_LIST,
491 SEGMENT
const& segment,
498 template<
typename POLICY_LIST,
503 SEGMENT
const& segment,
515 template<
typename POLICY_LIST,
520 SEGMENT
const& segment0,
521 SEGMENT
const& segment1,
530 template<
typename POLICY_LIST,
535 SEGMENT
const& segment0,
536 SEGMENT
const& segment1,
545 template<
typename POLICY_LIST,
550 SEGMENT
const& segment0,
551 SEGMENT
const& segment1,
552 SEGMENT
const& segment2,
561 template<
typename POLICY_LIST,
566 SEGMENT
const& segment0,
567 SEGMENT
const& segment1,
568 SEGMENT
const& segment2,
573 ctx, segment0, segment1, segment2,
body);
578 template<
typename POLICY,
typename SEGMENT>
581 template<
typename POLICY,
typename SEGMENT>
584 template<
typename POLICY_LIST,
591 SEGMENT
const& segment,
599 template<
typename POLICY_LIST,
606 SEGMENT
const& segment,
616 template<
typename POLICY_LIST,
624 SEGMENT
const& segment0,
625 SEGMENT
const& segment1,
630 ctx, tile_size0, tile_size1, segment0, segment1,
body);
633 template<
typename POLICY_LIST,
641 SEGMENT
const& segment0,
642 SEGMENT
const& segment1,
647 ctx, tile_size0, tile_size1, segment0, segment1,
body);
650 template<
typename POLICY_LIST,
659 SEGMENT
const& segment0,
660 SEGMENT
const& segment1,
661 SEGMENT
const& segment2,
666 ctx, tile_size0, tile_size1, tile_size2, segment0, segment1, segment2,
670 template<
typename POLICY_LIST,
679 SEGMENT
const& segment0,
680 SEGMENT
const& segment1,
681 SEGMENT
const& segment2,
686 ctx, tile_size0, tile_size1, tile_size2, segment0, segment1, segment2,
RAJA header file defining Layout, a N-dimensional index calculator with compile-time defined sizes an...
Definition: launch_core.hpp:192
void * shared_mem_ptr
Definition: launch_core.hpp:197
size_t shared_mem_offset
Definition: launch_core.hpp:196
RAJA_HOST_DEVICE void teamSync()
Definition: launch_core.hpp:231
RAJA_HOST_DEVICE LaunchContextBase()
Definition: launch_core.hpp:205
RAJA_HOST_DEVICE void releaseSharedMemory()
Definition: launch_core.hpp:224
RAJA_HOST_DEVICE T * getSharedMemory(size_t bytes)
Definition: launch_core.hpp:212
Definition: launch_core.hpp:246
Definition: launch_context_policy.hpp:30
Header file containing RAJA CUDA policy definitions.
Header file containing RAJA HIP policy definitions.
RAJA header file containing a helper to determine the launch context type.
Header file for common RAJA internal macro definitions.
RAJA_HOST_DEVICE void RAJA_ABORT_OR_THROW(const char *str)
Definition: macros.hpp:143
#define RAJA_HOST_DEVICE
Definition: macros.hpp:65
#define RAJA_SUPPRESS_HD_WARN
Definition: macros.hpp:68
RAJA_SUPPRESS_HD_WARN RAJA_HOST_DEVICE RAJA_INLINE void loop(CONTEXT const &ctx, SEGMENT const &segment0, SEGMENT const &segment1, BODY const &body)
Definition: launch_core.hpp:519
std::string get_kernel_name(Args &&... args)
Definition: forall.hpp:442
constexpr auto && get_lambda(Args &&... args)
Definition: forall.hpp:396
RAJA_SUPPRESS_HD_WARN RAJA_HOST_DEVICE RAJA_INLINE void loop_icount(CONTEXT const &ctx, SEGMENT const &segment0, SEGMENT const &segment1, BODY const &body)
Definition: launch_core.hpp:534
RAJA_HOST_DEVICE RAJA_INLINE void tile_tcount(CONTEXT const &ctx, TILE_T tile_size0, TILE_T tile_size1, SEGMENT const &segment0, SEGMENT const &segment1, BODY const &body)
Definition: launch_core.hpp:638
RAJA_HOST_DEVICE RAJA_INLINE void tile(CONTEXT const &ctx, TILE_T tile_size0, TILE_T tile_size1, SEGMENT const &segment0, SEGMENT const &segment1, BODY const &body)
Definition: launch_core.hpp:621
constexpr auto make_forall_param_pack(Args &&... args)
Definition: forall.hpp:377
RAJA_INLINE void callPreLaunchPlugins(const PluginContext &p)
Definition: plugins.hpp:56
RAJA_INLINE void callPostCapturePlugins(const PluginContext &p)
Definition: plugins.hpp:46
RAJA_INLINE auto trigger_updates_before(T &&item) -> typename std::remove_reference< T >::type
Definition: plugins.hpp:29
RAJA_INLINE void callPostLaunchPlugins(const PluginContext &p)
Definition: plugins.hpp:66
RAJA_INLINE void callPreCapturePlugins(const PluginContext &p)
Definition: plugins.hpp:36
Definition: AlignedRangeIndexSetBuilders.cpp:35
LaunchContextType ctx
Definition: launch.hpp:185
RAJA_HOST_DEVICE RAJA_INLINE void tile(CONTEXT const &ctx, TILE_T tile_size, SEGMENT const &segment, BODY const &body)
Definition: launch_core.hpp:589
RAJA_HOST_DEVICE RAJA_INLINE void loop_icount(CONTEXT const &ctx, SEGMENT const &segment, BODY const &body)
Definition: launch_core.hpp:502
RAJA_SUPPRESS_HD_WARN RAJA_HOST_DEVICE RAJA_INLINE void loop(CONTEXT const &ctx, SEGMENT const &segment, BODY const &body)
Definition: launch_core.hpp:490
void launch(LaunchParams const &launch_params, ReduceParams &&... rest_of_launch_args)
Definition: launch_core.hpp:268
ExecPlace
Definition: launch_core.hpp:58
auto & body
Definition: launch.hpp:177
typename POLICY_LIST::host_policy_t loop_policy
Definition: launch_core.hpp:476
RAJA_HOST_DEVICE RAJA_INLINE void tile_tcount(CONTEXT const &ctx, TILE_T tile_size, SEGMENT const &segment, BODY const &body)
Definition: launch_core.hpp:604
RAJA::resources::Resource Get_Host_Resource(T host_res, RAJA::ExecPlace device)
Definition: launch_core.hpp:374
Definition: launch_core.hpp:148
int value
Definition: launch_core.hpp:149
RAJA_INLINE constexpr RAJA_HOST_DEVICE Lanes()
Definition: launch_core.hpp:154
RAJA_INLINE constexpr RAJA_HOST_DEVICE Lanes(int i)
Definition: launch_core.hpp:159
Definition: launch_core.hpp:263
Definition: launch_core.hpp:163
RAJA_INLINE LaunchParams()=default
size_t shared_mem_size
Definition: launch_core.hpp:167
Teams teams
Definition: launch_core.hpp:165
LaunchParams(Teams in_teams, Threads in_threads, size_t in_shared_mem_size=0)
Definition: launch_core.hpp:172
Threads threads
Definition: launch_core.hpp:166
Definition: launch_core.hpp:90
HOST_POLICY host_policy_t
Definition: launch_core.hpp:91
Definition: launch_core.hpp:480
Definition: launch_core.hpp:483
Definition: launch_core.hpp:76
HOST_POLICY host_policy_t
Definition: launch_core.hpp:77
Definition: launch_core.hpp:98
int value[3]
Definition: launch_core.hpp:99
RAJA_INLINE constexpr RAJA_HOST_DEVICE Teams()
Definition: launch_core.hpp:104
RAJA_INLINE constexpr RAJA_HOST_DEVICE Teams(int i, int j)
Definition: launch_core.hpp:114
RAJA_INLINE constexpr RAJA_HOST_DEVICE Teams(int i, int j, int k)
Definition: launch_core.hpp:119
RAJA_INLINE constexpr RAJA_HOST_DEVICE Teams(int i)
Definition: launch_core.hpp:109
Definition: launch_core.hpp:123
RAJA_INLINE constexpr RAJA_HOST_DEVICE Threads(int i, int j, int k)
Definition: launch_core.hpp:144
int value[3]
Definition: launch_core.hpp:124
RAJA_INLINE constexpr RAJA_HOST_DEVICE Threads(int i, int j)
Definition: launch_core.hpp:139
RAJA_INLINE constexpr RAJA_HOST_DEVICE Threads(int i)
Definition: launch_core.hpp:134
RAJA_INLINE constexpr RAJA_HOST_DEVICE Threads()
Definition: launch_core.hpp:129
Definition: launch_core.hpp:579
Definition: launch_core.hpp:582
Definition: launch_core.hpp:65
Definition: resource.hpp:48
Definition: PluginContext.hpp:26
Header file for RAJA type definitions.