Kokkos Core Kernels Package  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
Kokkos_HIP_Space.hpp
1 /*
2 //@HEADER
3 // ************************************************************************
4 //
5 // Kokkos v. 3.0
6 // Copyright (2020) National Technology & Engineering
7 // Solutions of Sandia, LLC (NTESS).
8 //
9 // Under the terms of Contract DE-NA0003525 with NTESS,
10 // the U.S. Government retains certain rights in this software.
11 //
12 // Redistribution and use in source and binary forms, with or without
13 // modification, are permitted provided that the following conditions are
14 // met:
15 //
16 // 1. Redistributions of source code must retain the above copyright
17 // notice, this list of conditions and the following disclaimer.
18 //
19 // 2. Redistributions in binary form must reproduce the above copyright
20 // notice, this list of conditions and the following disclaimer in the
21 // documentation and/or other materials provided with the distribution.
22 //
23 // 3. Neither the name of the Corporation nor the names of the
24 // contributors may be used to endorse or promote products derived from
25 // this software without specific prior written permission.
26 //
27 // THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
28 // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
29 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
30 // PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
31 // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
32 // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
33 // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
34 // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
35 // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
36 // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
37 // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
38 //
39 // Questions? Contact Christian R. Trott (crtrott@sandia.gov)
40 //
41 // ************************************************************************
42 //@HEADER
43 */
44 
45 #ifndef KOKKOS_HIPSPACE_HPP
46 #define KOKKOS_HIPSPACE_HPP
47 
48 #include <Kokkos_Core_fwd.hpp>
49 
50 #if defined(KOKKOS_ENABLE_HIP)
51 
52 #include <iosfwd>
53 #include <typeinfo>
54 #include <string>
55 #include <cstddef>
56 #include <iosfwd>
57 
58 #include <Kokkos_HostSpace.hpp>
59 #include <Kokkos_Layout.hpp>
60 #include <Kokkos_ScratchSpace.hpp>
61 
62 #include <impl/Kokkos_Profiling_Interface.hpp>
63 
64 #include <hip/hip_runtime_api.h>
65 /*--------------------------------------------------------------------------*/
66 
67 namespace Kokkos {
68 namespace Experimental {
71 class HIPSpace {
72  public:
74  using memory_space = HIPSpace;
75  using execution_space = Kokkos::Experimental::HIP;
76  using device_type = Kokkos::Device<execution_space, memory_space>;
77 
78  using size_type = unsigned int;
79 
80  /*--------------------------------*/
81 
82  HIPSpace();
83  HIPSpace(HIPSpace&& rhs) = default;
84  HIPSpace(const HIPSpace& rhs) = default;
85  HIPSpace& operator=(HIPSpace&& rhs) = default;
86  HIPSpace& operator=(const HIPSpace& rhs) = default;
87  ~HIPSpace() = default;
88 
90  void* allocate(const size_t arg_alloc_size) const;
91 
93  void deallocate(void* const arg_alloc_ptr, const size_t arg_alloc_size) const;
94 
96  static constexpr const char* name() { return "HIP"; }
97 
98  /*--------------------------------*/
100  static void access_error();
101  static void access_error(const void* const);
102 
103  private:
104  int m_device;
105 
106  friend class Kokkos::Impl::SharedAllocationRecord<
107  Kokkos::Experimental::HIPSpace, void>;
108 };
109 
110 } // namespace Experimental
111 
112 namespace Impl {
113 
120 void init_lock_arrays_hip_space();
121 
129 int* atomic_lock_array_hip_space_ptr(bool deallocate = false);
130 
138 int* scratch_lock_array_hip_space_ptr(bool deallocate = false);
139 
146 int* threadid_lock_array_hip_space_ptr(bool deallocate = false);
147 } // namespace Impl
148 } // namespace Kokkos
149 
150 /*--------------------------------------------------------------------------*/
151 /*--------------------------------------------------------------------------*/
152 
153 namespace Kokkos {
154 namespace Experimental {
158 class HIPHostPinnedSpace {
159  public:
161 
162  using execution_space = HostSpace::execution_space;
163  using memory_space = HIPHostPinnedSpace;
164  using device_type = Kokkos::Device<execution_space, memory_space>;
165  using size_type = unsigned int;
166 
167  /*--------------------------------*/
168 
169  HIPHostPinnedSpace();
170  HIPHostPinnedSpace(HIPHostPinnedSpace&& rhs) = default;
171  HIPHostPinnedSpace(const HIPHostPinnedSpace& rhs) = default;
172  HIPHostPinnedSpace& operator=(HIPHostPinnedSpace&& rhs) = default;
173  HIPHostPinnedSpace& operator=(const HIPHostPinnedSpace& rhs) = default;
174  ~HIPHostPinnedSpace() = default;
175 
177  void* allocate(const size_t arg_alloc_size) const;
178 
180  void deallocate(void* const arg_alloc_ptr, const size_t arg_alloc_size) const;
181 
183  static constexpr const char* name() { return "HIPHostPinned"; }
184 
185  /*--------------------------------*/
186 };
187 } // namespace Experimental
188 } // namespace Kokkos
189 
190 /*--------------------------------------------------------------------------*/
191 /*--------------------------------------------------------------------------*/
192 
193 namespace Kokkos {
194 namespace Impl {
195 
196 static_assert(
197  Kokkos::Impl::MemorySpaceAccess<Kokkos::Experimental::HIPSpace,
198  Kokkos::Experimental::HIPSpace>::assignable,
199  "");
200 
201 //----------------------------------------
202 
203 template <>
204 struct MemorySpaceAccess<Kokkos::HostSpace, Kokkos::Experimental::HIPSpace> {
205  enum { assignable = false };
206  enum { accessible = false };
207  enum { deepcopy = true };
208 };
209 
210 template <>
211 struct MemorySpaceAccess<Kokkos::HostSpace,
212  Kokkos::Experimental::HIPHostPinnedSpace> {
213  // HostSpace::execution_space == HIPHostPinnedSpace::execution_space
214  enum { assignable = true };
215  enum { accessible = true };
216  enum { deepcopy = true };
217 };
218 
219 //----------------------------------------
220 
221 template <>
222 struct MemorySpaceAccess<Kokkos::Experimental::HIPSpace, Kokkos::HostSpace> {
223  enum { assignable = false };
224  enum { accessible = false };
225  enum { deepcopy = true };
226 };
227 
228 template <>
229 struct MemorySpaceAccess<Kokkos::Experimental::HIPSpace,
230  Kokkos::Experimental::HIPHostPinnedSpace> {
231  // HIPSpace::execution_space != HIPHostPinnedSpace::execution_space
232  enum { assignable = false };
233  enum { accessible = true }; // HIPSpace::execution_space
234  enum { deepcopy = true };
235 };
236 
237 //----------------------------------------
238 // HIPHostPinnedSpace::execution_space == HostSpace::execution_space
239 // HIPHostPinnedSpace accessible to both HIP and Host
240 
241 template <>
242 struct MemorySpaceAccess<Kokkos::Experimental::HIPHostPinnedSpace,
244  enum { assignable = false }; // Cannot access from HIP
245  enum { accessible = true }; // HIPHostPinnedSpace::execution_space
246  enum { deepcopy = true };
247 };
248 
249 template <>
250 struct MemorySpaceAccess<Kokkos::Experimental::HIPHostPinnedSpace,
251  Kokkos::Experimental::HIPSpace> {
252  enum { assignable = false }; // Cannot access from Host
253  enum { accessible = false };
254  enum { deepcopy = true };
255 };
256 
257 }; // namespace Impl
258 //----------------------------------------
259 
260 } // namespace Kokkos
261 
262 /*--------------------------------------------------------------------------*/
263 /*--------------------------------------------------------------------------*/
264 
265 namespace Kokkos {
266 namespace Impl {
267 
268 void DeepCopyAsyncHIP(void* dst, const void* src, size_t n);
269 
270 template <>
271 struct DeepCopy<Kokkos::Experimental::HIPSpace, Kokkos::Experimental::HIPSpace,
272  Kokkos::Experimental::HIP> {
273  DeepCopy(void* dst, const void* src, size_t);
274  DeepCopy(const Kokkos::Experimental::HIP&, void* dst, const void* src,
275  size_t);
276 };
277 
278 template <>
279 struct DeepCopy<Kokkos::Experimental::HIPSpace, HostSpace,
280  Kokkos::Experimental::HIP> {
281  DeepCopy(void* dst, const void* src, size_t);
282  DeepCopy(const Kokkos::Experimental::HIP&, void* dst, const void* src,
283  size_t);
284 };
285 
286 template <>
287 struct DeepCopy<HostSpace, Kokkos::Experimental::HIPSpace,
288  Kokkos::Experimental::HIP> {
289  DeepCopy(void* dst, const void* src, size_t);
290  DeepCopy(const Kokkos::Experimental::HIP&, void* dst, const void* src,
291  size_t);
292 };
293 
294 template <class ExecutionSpace>
295 struct DeepCopy<Kokkos::Experimental::HIPSpace, Kokkos::Experimental::HIPSpace,
296  ExecutionSpace> {
297  inline DeepCopy(void* dst, const void* src, size_t n) {
298  (void)DeepCopy<Kokkos::Experimental::HIPSpace,
299  Kokkos::Experimental::HIPSpace, Kokkos::Experimental::HIP>(
300  dst, src, n);
301  }
302 
303  inline DeepCopy(const ExecutionSpace& exec, void* dst, const void* src,
304  size_t n) {
305  exec.fence();
306  DeepCopyAsyncHIP(dst, src, n);
307  }
308 };
309 
310 template <class ExecutionSpace>
311 struct DeepCopy<Kokkos::Experimental::HIPSpace, HostSpace, ExecutionSpace> {
312  inline DeepCopy(void* dst, const void* src, size_t n) {
313  (void)DeepCopy<Kokkos::Experimental::HIPSpace, HostSpace,
314  Kokkos::Experimental::HIP>(dst, src, n);
315  }
316 
317  inline DeepCopy(const ExecutionSpace& exec, void* dst, const void* src,
318  size_t n) {
319  exec.fence();
320  DeepCopyAsyncHIP(dst, src, n);
321  }
322 };
323 
324 template <class ExecutionSpace>
325 struct DeepCopy<HostSpace, Kokkos::Experimental::HIPSpace, ExecutionSpace> {
326  inline DeepCopy(void* dst, const void* src, size_t n) {
327  (void)DeepCopy<HostSpace, Kokkos::Experimental::HIPSpace,
328  Kokkos::Experimental::HIP>(dst, src, n);
329  }
330 
331  inline DeepCopy(const ExecutionSpace& exec, void* dst, const void* src,
332  size_t n) {
333  exec.fence();
334  DeepCopyAsyncHIP(dst, src, n);
335  }
336 };
337 
338 template <>
339 struct DeepCopy<Kokkos::Experimental::HIPHostPinnedSpace,
340  Kokkos::Experimental::HIPHostPinnedSpace,
341  Kokkos::Experimental::HIP> {
342  DeepCopy(void* dst, const void* src, size_t);
343  DeepCopy(const Kokkos::Experimental::HIP&, void* dst, const void* src,
344  size_t);
345 };
346 
347 template <>
348 struct DeepCopy<Kokkos::Experimental::HIPHostPinnedSpace, HostSpace,
349  Kokkos::Experimental::HIP> {
350  DeepCopy(void* dst, const void* src, size_t);
351  DeepCopy(const Kokkos::Experimental::HIP&, void* dst, const void* src,
352  size_t);
353 };
354 
355 template <>
356 struct DeepCopy<HostSpace, Kokkos::Experimental::HIPHostPinnedSpace,
357  Kokkos::Experimental::HIP> {
358  DeepCopy(void* dst, const void* src, size_t);
359  DeepCopy(const Kokkos::Experimental::HIP&, void* dst, const void* src,
360  size_t);
361 };
362 
363 template <class ExecutionSpace>
364 struct DeepCopy<Kokkos::Experimental::HIPSpace,
365  Kokkos::Experimental::HIPHostPinnedSpace, ExecutionSpace> {
366  inline DeepCopy(void* dst, const void* src, size_t n) {
367  (void)DeepCopy<Kokkos::Experimental::HIPSpace, HostSpace,
368  Kokkos::Experimental::HIP>(dst, src, n);
369  }
370 
371  inline DeepCopy(const ExecutionSpace& exec, void* dst, const void* src,
372  size_t n) {
373  exec.fence();
374  DeepCopyAsyncHIP(dst, src, n);
375  }
376 };
377 
378 template <class ExecutionSpace>
379 struct DeepCopy<Kokkos::Experimental::HIPHostPinnedSpace,
380  Kokkos::Experimental::HIPSpace, ExecutionSpace> {
381  inline DeepCopy(void* dst, const void* src, size_t n) {
382  (void)DeepCopy<HostSpace, Kokkos::Experimental::HIPSpace,
383  Kokkos::Experimental::HIP>(dst, src, n);
384  }
385 
386  inline DeepCopy(const ExecutionSpace& exec, void* dst, const void* src,
387  size_t n) {
388  exec.fence();
389  DeepCopyAsyncHIP(dst, src, n);
390  }
391 };
392 
393 template <class ExecutionSpace>
394 struct DeepCopy<Kokkos::Experimental::HIPHostPinnedSpace,
395  Kokkos::Experimental::HIPHostPinnedSpace, ExecutionSpace> {
396  inline DeepCopy(void* dst, const void* src, size_t n) {
397  (void)DeepCopy<Kokkos::Experimental::HIPHostPinnedSpace,
398  Kokkos::Experimental::HIPHostPinnedSpace,
399  Kokkos::Experimental::HIP>(dst, src, n);
400  }
401 
402  inline DeepCopy(const ExecutionSpace& exec, void* dst, const void* src,
403  size_t n) {
404  exec.fence();
405  DeepCopyAsyncHIP(dst, src, n);
406  }
407 };
408 
409 template <class ExecutionSpace>
410 struct DeepCopy<Kokkos::Experimental::HIPHostPinnedSpace, HostSpace,
411  ExecutionSpace> {
412  inline DeepCopy(void* dst, const void* src, size_t n) {
413  (void)DeepCopy<Kokkos::Experimental::HIPHostPinnedSpace, HostSpace,
414  Kokkos::Experimental::HIP>(dst, src, n);
415  }
416 
417  inline DeepCopy(const ExecutionSpace& exec, void* dst, const void* src,
418  size_t n) {
419  exec.fence();
420  DeepCopyAsyncHIP(dst, src, n);
421  }
422 };
423 
424 template <class ExecutionSpace>
425 struct DeepCopy<HostSpace, Kokkos::Experimental::HIPHostPinnedSpace,
426  ExecutionSpace> {
427  inline DeepCopy(void* dst, const void* src, size_t n) {
428  (void)DeepCopy<HostSpace, Kokkos::Experimental::HIPHostPinnedSpace,
429  Kokkos::Experimental::HIP>(dst, src, n);
430  }
431 
432  inline DeepCopy(const ExecutionSpace& exec, void* dst, const void* src,
433  size_t n) {
434  exec.fence();
435  DeepCopyAsyncHIP(dst, src, n);
436  }
437 };
438 } // namespace Impl
439 } // namespace Kokkos
440 
441 //----------------------------------------------------------------------------
442 //----------------------------------------------------------------------------
443 
444 namespace Kokkos {
445 namespace Impl {
446 
448 template <>
449 struct VerifyExecutionCanAccessMemorySpace<Kokkos::Experimental::HIPSpace,
451  enum { value = false };
452  KOKKOS_INLINE_FUNCTION static void verify(void) {
453  Kokkos::abort("HIP code attempted to access HostSpace memory");
454  }
455 
456  KOKKOS_INLINE_FUNCTION static void verify(const void*) {
457  Kokkos::abort("HIP code attempted to access HostSpace memory");
458  }
459 };
460 
462 template <>
463 struct VerifyExecutionCanAccessMemorySpace<
464  Kokkos::Experimental::HIPSpace, Kokkos::Experimental::HIPHostPinnedSpace> {
465  enum { value = true };
466  KOKKOS_INLINE_FUNCTION static void verify(void) {}
467  KOKKOS_INLINE_FUNCTION static void verify(const void*) {}
468 };
469 
471 template <class OtherSpace>
472 struct VerifyExecutionCanAccessMemorySpace<
473  typename std::enable_if<
474  !std::is_same<Kokkos::Experimental::HIPSpace, OtherSpace>::value,
475  Kokkos::Experimental::HIPSpace>::type,
476  OtherSpace> {
477  enum { value = false };
478  KOKKOS_INLINE_FUNCTION static void verify(void) {
479  Kokkos::abort("HIP code attempted to access unknown Space memory");
480  }
481 
482  KOKKOS_INLINE_FUNCTION static void verify(const void*) {
483  Kokkos::abort("HIP code attempted to access unknown Space memory");
484  }
485 };
486 
487 //----------------------------------------------------------------------------
489 template <>
490 struct VerifyExecutionCanAccessMemorySpace<Kokkos::HostSpace,
491  Kokkos::Experimental::HIPSpace> {
492  enum { value = false };
493  inline static void verify(void) {
494  Kokkos::Experimental::HIPSpace::access_error();
495  }
496  inline static void verify(const void* p) {
497  Kokkos::Experimental::HIPSpace::access_error(p);
498  }
499 };
500 
502 template <>
503 struct VerifyExecutionCanAccessMemorySpace<
504  Kokkos::HostSpace, Kokkos::Experimental::HIPHostPinnedSpace> {
505  enum { value = true };
506  KOKKOS_INLINE_FUNCTION static void verify(void) {}
507  KOKKOS_INLINE_FUNCTION static void verify(const void*) {}
508 };
509 } // namespace Impl
510 } // namespace Kokkos
511 
512 //----------------------------------------------------------------------------
513 //----------------------------------------------------------------------------
514 
515 namespace Kokkos {
516 namespace Impl {
517 
518 template <>
519 class SharedAllocationRecord<Kokkos::Experimental::HIPSpace, void>
520  : public SharedAllocationRecord<void, void> {
521  private:
522  typedef SharedAllocationRecord<void, void> RecordBase;
523 
524  SharedAllocationRecord(const SharedAllocationRecord&) = delete;
525  SharedAllocationRecord& operator=(const SharedAllocationRecord&) = delete;
526 
527  static void deallocate(RecordBase*);
528 
529 #ifdef KOKKOS_DEBUG
530  static RecordBase s_root_record;
531 #endif
532 
533  const Kokkos::Experimental::HIPSpace m_space;
534 
535  protected:
536  ~SharedAllocationRecord();
537 
538  SharedAllocationRecord(
539  const Kokkos::Experimental::HIPSpace& arg_space,
540  const std::string& arg_label, const size_t arg_alloc_size,
541  const RecordBase::function_type arg_dealloc = &deallocate);
542 
543  public:
544  std::string get_label() const;
545 
546  static SharedAllocationRecord* allocate(
547  const Kokkos::Experimental::HIPSpace& arg_space,
548  const std::string& arg_label, const size_t arg_alloc_size);
549 
551  static void* allocate_tracked(const Kokkos::Experimental::HIPSpace& arg_space,
552  const std::string& arg_label,
553  const size_t arg_alloc_size);
554 
556  static void* reallocate_tracked(void* const arg_alloc_ptr,
557  const size_t arg_alloc_size);
558 
560  static void deallocate_tracked(void* const arg_alloc_ptr);
561 
562  static SharedAllocationRecord* get_record(void* arg_alloc_ptr);
563 
564  static void print_records(std::ostream&,
565  const Kokkos::Experimental::HIPSpace&,
566  bool detail = false);
567 };
568 
569 template <>
570 class SharedAllocationRecord<Kokkos::Experimental::HIPHostPinnedSpace, void>
571  : public SharedAllocationRecord<void, void> {
572  private:
573  typedef SharedAllocationRecord<void, void> RecordBase;
574 
575  SharedAllocationRecord(const SharedAllocationRecord&) = delete;
576  SharedAllocationRecord& operator=(const SharedAllocationRecord&) = delete;
577 
578  static void deallocate(RecordBase*);
579 
580 #ifdef KOKKOS_DEBUG
581  static RecordBase s_root_record;
582 #endif
583 
584  const Kokkos::Experimental::HIPHostPinnedSpace m_space;
585 
586  protected:
587  ~SharedAllocationRecord();
588  SharedAllocationRecord() : RecordBase(), m_space() {}
589 
590  SharedAllocationRecord(
591  const Kokkos::Experimental::HIPHostPinnedSpace& arg_space,
592  const std::string& arg_label, const size_t arg_alloc_size,
593  const RecordBase::function_type arg_dealloc = &deallocate);
594 
595  public:
596  std::string get_label() const;
597 
598  static SharedAllocationRecord* allocate(
599  const Kokkos::Experimental::HIPHostPinnedSpace& arg_space,
600  const std::string& arg_label, const size_t arg_alloc_size);
602  static void* allocate_tracked(
603  const Kokkos::Experimental::HIPHostPinnedSpace& arg_space,
604  const std::string& arg_label, const size_t arg_alloc_size);
605 
607  static void* reallocate_tracked(void* const arg_alloc_ptr,
608  const size_t arg_alloc_size);
609 
611  static void deallocate_tracked(void* const arg_alloc_ptr);
612 
613  static SharedAllocationRecord* get_record(void* arg_alloc_ptr);
614 
615  static void print_records(std::ostream&,
616  const Kokkos::Experimental::HIPHostPinnedSpace&,
617  bool detail = false);
618 };
619 } // namespace Impl
620 } // namespace Kokkos
621 
622 //----------------------------------------------------------------------------
623 //----------------------------------------------------------------------------
624 
625 namespace Kokkos {
626 namespace Experimental {
627 namespace Impl {
628 class HIPInternal;
629 }
632 class HIP {
633  public:
634  //------------------------------------
636 
637 
639  using execution_space = HIP;
640  using memory_space = HIPSpace;
641  using device_type = Kokkos::Device<execution_space, memory_space>;
642 
643  using array_layout = LayoutLeft;
644  using size_type = HIPSpace::size_type;
645 
646  using scratch_memory_space = ScratchMemorySpace<HIP>;
647 
648  ~HIP() = default;
649  HIP();
650  // explicit HIP( const int instance_id );
651 
652  HIP(HIP&&) = default;
653  HIP(const HIP&) = default;
654  HIP& operator=(HIP&&) = default;
655  HIP& operator=(const HIP&) = default;
656 
658  //------------------------------------
660 
661 
662  KOKKOS_INLINE_FUNCTION static int in_parallel() {
663 #if defined(__HIP_ARCH__)
664  return true;
665 #else
666  return false;
667 #endif
668  }
669 
671  static void impl_static_fence();
672  void fence() const;
673 
675  static void print_configuration(std::ostream&, const bool detail = false);
676 
678  static void impl_finalize();
679 
683  struct SelectDevice {
684  int hip_device_id;
685  SelectDevice() : hip_device_id(0) {}
686  explicit SelectDevice(int id) : hip_device_id(id) {}
687  };
688 
689  int hip_device() const;
690 
691  static void impl_initialize(const SelectDevice = SelectDevice());
692 
693  static int impl_is_initialized();
694 
695  // static size_type device_arch();
696 
697  // static size_type detect_device_count();
698 
699  static int concurrency();
700  static const char* name();
701 
702  inline Impl::HIPInternal* impl_internal_space_instance() const {
703  return m_space_instance;
704  }
705 
706  uint32_t impl_instance_id() const noexcept { return 0; }
707 
708  private:
709  Impl::HIPInternal* m_space_instance;
710 };
711 } // namespace Experimental
712 namespace Profiling {
713 namespace Experimental {
714 template <>
715 struct DeviceTypeTraits<Kokkos::Experimental::HIP> {
716  static constexpr DeviceType id = DeviceType::HIP;
717 };
718 } // namespace Experimental
719 } // namespace Profiling
720 } // namespace Kokkos
721 
722 namespace Kokkos {
723 namespace Impl {
724 
725 template <>
726 struct MemorySpaceAccess<Kokkos::Experimental::HIPSpace,
727  Kokkos::Experimental::HIP::scratch_memory_space> {
728  enum { assignable = false };
729  enum { accessible = true };
730  enum { deepcopy = false };
731 };
732 
733 template <>
734 struct VerifyExecutionCanAccessMemorySpace<
735  Kokkos::Experimental::HIP::memory_space,
736  Kokkos::Experimental::HIP::scratch_memory_space> {
737  enum { value = true };
738  KOKKOS_INLINE_FUNCTION static void verify(void) {}
739  KOKKOS_INLINE_FUNCTION static void verify(const void*) {}
740 };
741 
742 template <>
743 struct VerifyExecutionCanAccessMemorySpace<
744  Kokkos::HostSpace, Kokkos::Experimental::HIP::scratch_memory_space> {
745  enum { value = false };
746  inline static void verify(void) {
747  Kokkos::Experimental::HIPSpace::access_error();
748  }
749  inline static void verify(const void* p) {
750  Kokkos::Experimental::HIPSpace::access_error(p);
751  }
752 };
753 
754 } // namespace Impl
755 } // namespace Kokkos
756 
757 #endif /* #if defined( KOKKOS_ENABLE_HIP ) */
758 #endif /* #define KOKKOS_HIPSPACE_HPP */
void print_configuration(std::ostream &, const bool detail=false)
Print &quot;Bill of Materials&quot;.
Memory management for host memory.
Declaration of various MemoryLayout options.
Access relationship between DstMemorySpace and SrcMemorySpace.