/home/runner/work/HiCR/HiCR/include/hicr/backends/acl/memorySpace.hpp Source File

HiCR: /home/runner/work/HiCR/HiCR/include/hicr/backends/acl/memorySpace.hpp Source File
HiCR
memorySpace.hpp
Go to the documentation of this file.
1/*
2 * Copyright 2025 Huawei Technologies Co., Ltd.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
24#pragma once
25
26#include <nlohmann_json/json.hpp>
27#include <hicr/core/definitions.hpp>
30
31namespace HiCR::backend::acl
32{
33
37class Device;
38
42class MemorySpace final : public HiCR::MemorySpace
43{
44 public:
45
52 MemorySpace(const std::weak_ptr<acl::Device> device, const size_t size)
53 : HiCR::MemorySpace(size),
54 _device(device)
55 {
56 _type = "Huawei Device RAM";
57 };
58
63 : HiCR::MemorySpace()
64 {
65 _type = "Huawei Device RAM";
66 }
67
71 ~MemorySpace() = default;
72
80 MemorySpace(const nlohmann::json &input)
81 : HiCR::MemorySpace()
82 {
83 deserialize(input);
84 }
85
91 __INLINE__ const std::weak_ptr<const acl::Device> getDevice() const { return _device; }
92
93 private:
94
95 __INLINE__ void serializeImpl(nlohmann::json &output) const override
96 {
97 // No additional information to serialize for now
98 }
99
100 __INLINE__ void deserializeImpl(const nlohmann::json &input) override
101 {
102 // No additional information to deserialize for now
103 }
104
110 std::weak_ptr<acl::Device> _device;
111};
112
113} // namespace HiCR::backend::acl
Provides a definition for the local memory slot class for the acl backend.
Definition memorySpace.hpp:45
__INLINE__ void deserialize(const nlohmann::json &input)
Definition memorySpace.hpp:143
std::string _type
Definition memorySpace.hpp:196
Definition memorySpace.hpp:43
MemorySpace(const nlohmann::json &input)
Definition memorySpace.hpp:80
MemorySpace()
Definition memorySpace.hpp:62
MemorySpace(const std::weak_ptr< acl::Device > device, const size_t size)
Definition memorySpace.hpp:52
__INLINE__ const std::weak_ptr< const acl::Device > getDevice() const
Definition memorySpace.hpp:91
Provides a base definition for a HiCR MemorySpace class.