-
Notifications
You must be signed in to change notification settings - Fork 243
Expand file tree
/
Copy pathruntime.hpp
More file actions
49 lines (40 loc) · 1.27 KB
/
runtime.hpp
File metadata and controls
49 lines (40 loc) · 1.27 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#pragma once
#include "../core.hpp"
#include "../../device/runtime_api.hpp"
#include "../allocator/allocator.hpp"
#include "../../device/device_resource.hpp"
namespace llaisys::core {
class Runtime {
private:
llaisysDeviceType_t _device_type;
int _device_id;
const LlaisysRuntimeAPI *_api;
MemoryAllocator *_allocator;
llaisys::device::DeviceResource *_device_resource = nullptr;
bool _is_active;
void _activate();
void _deactivate();
llaisysStream_t _stream;
Runtime(llaisysDeviceType_t device_type, int device_id);
public:
friend class Context;
~Runtime();
// Prevent copying
Runtime(const Runtime &) = delete;
Runtime &operator=(const Runtime &) = delete;
// Prevent moving
Runtime(Runtime &&) = delete;
Runtime &operator=(Runtime &&) = delete;
llaisysDeviceType_t deviceType() const;
int deviceId() const;
bool isActive() const;
const LlaisysRuntimeAPI *api() const;
llaisys::device::DeviceResource *deviceResource() const { return _device_resource; }
storage_t allocateDeviceStorage(size_t size);
;
storage_t allocateHostStorage(size_t size);
void freeStorage(Storage *storage);
llaisysStream_t stream() const;
void synchronize() const;
};
} // namespace llaisys::core