/home/runner/work/HiCR/HiCR/include/hicr/backends/boost/computeManager.hpp Source File

HiCR: /home/runner/work/HiCR/HiCR/include/hicr/backends/boost/computeManager.hpp Source File
HiCR
computeManager.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 <memory>
30
31namespace HiCR::backend::boost
32{
33
40{
41 public:
42
47 : HiCR::ComputeManager()
48 {}
49
53 ~ComputeManager() override = default;
54
62 __INLINE__ static std::shared_ptr<HiCR::ExecutionUnit> createExecutionUnit(const Coroutine::coroutineFc_t &coroutineFunction)
63 {
64 return std::make_shared<boost::ExecutionUnit>(coroutineFunction);
65 }
66
74 __INLINE__ std::unique_ptr<HiCR::ExecutionState> createExecutionState(std::shared_ptr<HiCR::ExecutionUnit> executionUnit, void *const argument = nullptr) const override
75 {
76 // Creating and returning new execution state
77 return std::make_unique<boost::ExecutionState>(executionUnit, argument);
78 }
79
80 [[nodiscard]] __INLINE__ std::unique_ptr<HiCR::ProcessingUnit> createProcessingUnit(std::shared_ptr<HiCR::ComputeResource> computeResource) const override
81 {
82 {
83 HICR_THROW_LOGIC("This backend does not implement this function");
84 }
85 }
86
87 private:
88
89 __INLINE__ void initializeImpl(std::unique_ptr<HiCR::ProcessingUnit> &processingUnit) override
90 {
91 {
92 HICR_THROW_LOGIC("This backend does not implement this function");
93 }
94 }
95
96 __INLINE__ void startImpl(std::unique_ptr<HiCR::ProcessingUnit> &processingUnit, std::unique_ptr<HiCR::ExecutionState> &executionState) override
97 {
98 {
99 HICR_THROW_LOGIC("This backend does not implement this function");
100 }
101 }
102
103 __INLINE__ void suspendImpl(std::unique_ptr<HiCR::ProcessingUnit> &processingUnit) override
104 {
105 {
106 HICR_THROW_LOGIC("This backend does not implement this function");
107 }
108 }
109
110 __INLINE__ void resumeImpl(std::unique_ptr<HiCR::ProcessingUnit> &processingUnit) override
111 {
112 {
113 HICR_THROW_LOGIC("This backend does not implement this function");
114 }
115 }
116
117 __INLINE__ void terminateImpl(std::unique_ptr<HiCR::ProcessingUnit> &processingUnit) override
118 {
119 {
120 HICR_THROW_LOGIC("This backend does not implement this function");
121 }
122 }
123
124 __INLINE__ void awaitImpl(std::unique_ptr<HiCR::ProcessingUnit> &processingUnit) override
125 {
126 {
127 HICR_THROW_LOGIC("This backend does not implement this function");
128 }
129 }
130};
131
132} // namespace HiCR::backend::boost
This file implements the execution state class for the Boost backend.
Definition computeManager.hpp:48
Definition computeManager.hpp:40
__INLINE__ std::unique_ptr< HiCR::ProcessingUnit > createProcessingUnit(std::shared_ptr< HiCR::ComputeResource > computeResource) const override
Definition computeManager.hpp:80
ComputeManager()
Definition computeManager.hpp:46
__INLINE__ std::unique_ptr< HiCR::ExecutionState > createExecutionState(std::shared_ptr< HiCR::ExecutionUnit > executionUnit, void *const argument=nullptr) const override
Definition computeManager.hpp:74
static __INLINE__ std::shared_ptr< HiCR::ExecutionUnit > createExecutionUnit(const Coroutine::coroutineFc_t &coroutineFunction)
Definition computeManager.hpp:62
std::function< void(void *)> coroutineFc_t
Definition coroutine.hpp:49
Provides a definition for the abstract compute manager class.
Provides a failure model and corresponding exception classes.
#define HICR_THROW_LOGIC(...)
Definition exceptions.hpp:67