/home/runner/work/HiCR/HiCR/include/hicr/core/processingUnit.hpp Source File

HiCR: /home/runner/work/HiCR/HiCR/include/hicr/core/processingUnit.hpp Source File
HiCR
processingUnit.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
23#pragma once
24
25#include <memory>
26#include <hicr/core/definitions.hpp>
30#include <utility>
31
32namespace HiCR
33{
34class ComputeManager;
35}
36
37namespace HiCR
38{
39
49{
50 friend class HiCR::ComputeManager;
51
52 public:
53
89
93 ProcessingUnit() = delete;
94
100 __INLINE__ ProcessingUnit(std::shared_ptr<HiCR::ComputeResource> computeResource)
101 : _computeResource(std::move(computeResource)) {};
102
106 virtual ~ProcessingUnit() = default;
107
113 [[nodiscard]] __INLINE__ ProcessingUnit::state_t getState() const { return _state; }
114
120 __INLINE__ std::shared_ptr<ComputeResource> getComputeResource() { return _computeResource; }
121
127 virtual std::string getType() = 0;
128
129 private:
130
136 __INLINE__ void setState(const ProcessingUnit::state_t state) { _state = state; }
137
142
146 const std::shared_ptr<HiCR::ComputeResource> _computeResource;
147};
148
149} // namespace HiCR
Definition computeManager.hpp:48
Definition processingUnit.hpp:49
__INLINE__ std::shared_ptr< ComputeResource > getComputeResource()
Definition processingUnit.hpp:120
virtual std::string getType()=0
__INLINE__ ProcessingUnit::state_t getState() const
Definition processingUnit.hpp:113
virtual ~ProcessingUnit()=default
__INLINE__ ProcessingUnit(std::shared_ptr< HiCR::ComputeResource > computeResource)
Definition processingUnit.hpp:100
state_t
Definition processingUnit.hpp:58
@ terminating
Definition processingUnit.hpp:82
@ uninitialized
Definition processingUnit.hpp:62
@ running
Definition processingUnit.hpp:72
@ ready
Definition processingUnit.hpp:67
@ terminated
Definition processingUnit.hpp:87
@ suspended
Definition processingUnit.hpp:77
Provides a base definition for a HiCR ComputeResource class.
Provides a base definition for a HiCR Execution State class.
Provides a base definition for a HiCR Execution Unit class.