Realm
A distributed, event-based tasking library
Loading...
Searching...
No Matches
hip_access.h
Go to the documentation of this file.
1/*
2 * Copyright 2025 Stanford University, NVIDIA Corporation
3 * SPDX-License-Identifier: Apache-2.0
4 *
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 */
17
18// HIP-specific instance layouts and accessors
19
20#ifndef REALM_HIP_ACCESS_H
21#define REALM_HIP_ACCESS_H
22
23#include "realm/inst_layout.h"
24
25namespace Realm {
26
28 public:
29 ExternalHipMemoryResource(int _cuda_device_id, uintptr_t _base, size_t _size_in_bytes,
30 bool _read_only);
31 ExternalHipMemoryResource(int _cuda_device_id, void *_base, size_t _size_in_bytes);
32 ExternalHipMemoryResource(int _cuda_device_id, const void *_base,
33 size_t _size_in_bytes);
34
35 virtual bool satisfies(const InstanceLayoutGeneric &layout) const;
36
37 // returns the suggested memory in which this resource should be created
39
40 virtual ExternalInstanceResource *clone(void) const;
41
42 template <typename S>
43 bool serialize(S &serializer) const;
44
45 template <typename S>
46 static ExternalInstanceResource *deserialize_new(S &deserializer);
47
48 protected:
50
54
55 virtual void print(std::ostream &os) const;
56
57 public:
59 uintptr_t base;
62 };
63
65 public:
66 ExternalHipPinnedHostResource(uintptr_t _base, size_t _size_in_bytes,
67 bool _read_only);
68 ExternalHipPinnedHostResource(void *_base, size_t _size_in_bytes);
69 ExternalHipPinnedHostResource(const void *_base, size_t _size_in_bytes);
70
71 // returns the suggested memory in which this resource should be created
73
74 virtual ExternalInstanceResource *clone(void) const;
75
76 template <typename S>
77 bool serialize(S &serializer) const;
78
79 template <typename S>
80 static ExternalInstanceResource *deserialize_new(S &deserializer);
81
82 protected:
84
88
89 virtual void print(std::ostream &os) const;
90 };
91
92}; // namespace Realm
93
94#include "realm/hip/hip_access.inl"
95
96#endif // ifndef REALM_HIP_ACCESS_H
Definition hip_access.h:27
static ExternalInstanceResource * deserialize_new(S &deserializer)
ExternalHipMemoryResource(int _cuda_device_id, void *_base, size_t _size_in_bytes)
static Serialization::PolymorphicSerdezSubclass< ExternalInstanceResource, ExternalHipMemoryResource > serdez_subclass
Definition hip_access.h:53
virtual bool satisfies(const InstanceLayoutGeneric &layout) const
bool read_only
Definition hip_access.h:61
virtual void print(std::ostream &os) const
int hip_device_id
Definition hip_access.h:58
bool serialize(S &serializer) const
uintptr_t base
Definition hip_access.h:59
ExternalHipMemoryResource(int _cuda_device_id, uintptr_t _base, size_t _size_in_bytes, bool _read_only)
virtual ExternalInstanceResource * clone(void) const
ExternalHipMemoryResource(int _cuda_device_id, const void *_base, size_t _size_in_bytes)
size_t size_in_bytes
Definition hip_access.h:60
Definition hip_access.h:64
ExternalHipPinnedHostResource(const void *_base, size_t _size_in_bytes)
virtual ExternalInstanceResource * clone(void) const
bool serialize(S &serializer) const
ExternalHipPinnedHostResource(void *_base, size_t _size_in_bytes)
ExternalHipPinnedHostResource(uintptr_t _base, size_t _size_in_bytes, bool _read_only)
virtual void print(std::ostream &os) const
static ExternalInstanceResource * deserialize_new(S &deserializer)
static Serialization::PolymorphicSerdezSubclass< ExternalInstanceResource, ExternalHipPinnedHostResource > serdez_subclass
Definition hip_access.h:87
Definition instance.h:405
Definition instance.h:443
Definition inst_layout.h:164
Definition memory.h:33
#define REALM_PUBLIC_API
Definition compiler_support.h:217
Definition activemsg.h:38