xaiefal
Loading...
Searching...
No Matches
xaiefal-rscmgr-backend-base.hpp
Go to the documentation of this file.
1#pragma once
2
3#include <iostream>
4#include <memory>
5#include <vector>
6#include <xaiengine.h>
7#include <xaiefal/common/xaiefal-common.hpp>
8#include <xaiefal/common/xaiefal-log.hpp>
9#include <xaiefal/rsc/xaiefal-rsc-base.hpp>
10
11namespace xaiefal {
12 class XAieDevHandle;
13
18
24 public:
27 AieHd(DevHd) {}
28
37 virtual AieRC request(XAieUserRsc& RscReq) {
38 (void)RscReq;
39 Logger::log(LogLevel::FAL_ERROR) << __func__ <<
40 " Not supported for base backend " << std::endl;
41 return XAIE_ERR;
42 }
43
52 AieRC request(std::vector<XAieUserRsc>& RscReq) {
53 AieRC RC;
54 for (uint32_t i = 0; i < RscReq.size(); i++) {
55 RC = request(RscReq[i]);
56 if (RC != XAIE_OK) {
57 RscReq.resize(i);
58 free(RscReq);
59 return RC;
60 }
61 }
62 return XAIE_OK;
63 }
64
73 virtual AieRC requestAllocated(XAieUserRsc& RscReq) {
74 (void)RscReq;
75 Logger::log(LogLevel::FAL_ERROR) << __func__ <<
76 " Not supported for base backend " << std::endl;
77 return XAIE_ERR;
78 }
79
89 AieRC requestAllocated(std::vector<XAieUserRsc>& RscReq) {
90 AieRC RC;
91 for (uint32_t i = 0; i < RscReq.size(); i++) {
92 RC = requestAllocated(RscReq[i]);
93 if (RC != XAIE_OK) {
94 RscReq.resize(i);
95 free(RscReq);
96 return RC;
97 }
98 }
99 return XAIE_OK;
100 }
101
110 virtual AieRC requestContiguous(std::vector<XAieUserRsc>& RscReq) {
111 (void)RscReq;
112 Logger::log(LogLevel::FAL_ERROR) << __func__ <<
113 " Not supported for base backend " << std::endl;
114 return XAIE_ERR;
115 }
116
126 virtual AieRC requestBc(std::vector<XAieUserRsc>& RscReq, bool isBcAll) {
127 (void)RscReq;
128 (void)isBcAll;
129 Logger::log(LogLevel::FAL_ERROR) << __func__ <<
130 " Not supported for base backend " << std::endl;
131 return XAIE_ERR;
132 }
133
142 virtual AieRC release(XAieUserRsc& RscRel) {
143 (void)RscRel;
144 Logger::log(LogLevel::FAL_ERROR) << __func__ <<
145 " Not supported for base backend " << std::endl;
146 return XAIE_ERR;
147 }
148
157 AieRC release(std::vector<XAieUserRsc>& RscRel) {
158 for (uint32_t i = 0; i < RscRel.size(); i++)
159 release(RscRel[i]);
160 return XAIE_OK;
161 }
162
170 virtual AieRC free(XAieUserRsc& RscFree) {
171 (void)RscFree;
172 Logger::log(LogLevel::FAL_ERROR) << __func__ <<
173 " Not supported for base backend " << std::endl;
174 return XAIE_ERR;
175 }
176
185 AieRC free(std::vector<XAieUserRsc>& RscFree) {
186 for (uint32_t i = 0; i < RscFree.size(); i++)
187 free(RscFree[i]);
188 return XAIE_OK;
189 }
190
200 virtual AieRC getRscStats(std::vector<XAieUserRscStat> &vStats,
201 XAieRscBitmapType BType) {
202 (void)vStats;
203 (void)BType;
204 Logger::log(LogLevel::FAL_ERROR) << __func__ <<
205 " Not supported for base backend " << std::endl;
206 return XAIE_ERR;
207 }
208
219 virtual AieRC writeRscBitmaps(std::ofstream &Fs, uint64_t &NumRscs) {
220 (void)Fs;
221 (void)NumRscs;
222 Logger::log(LogLevel::FAL_ERROR) << __func__ <<
223 " Not supported for selected backend " << std::endl;
224 return XAIE_ERR;
225 }
226
236 virtual AieRC loadRscBitmaps(const char *MetaData, uint64_t NumBitmaps) {
237 (void)MetaData;
238 (void)NumBitmaps;
239 Logger::log(LogLevel::FAL_ERROR) << __func__ <<
240 " Not supported for selected backend " << std::endl;
241 return XAIE_ERR;
242 }
243
244 XAie_DevInst *dev() {
245 return AieHd->dev();
246 }
247 protected:
249 }; /* class XAieRscMgrBackend */
250} /* namespace xaiefal */
static std::ostream & log(LogLevel Lvl=LogLevel::FAL_MAX)
Definition xaiefal-log.hpp:50
AI engine low level device pointer handle.
Definition xaiefal-base.hpp:104
AieRC requestAllocated(std::vector< XAieUserRsc > &RscReq)
Definition xaiefal-rscmgr-backend-base.hpp:89
virtual AieRC request(XAieUserRsc &RscReq)
Definition xaiefal-rscmgr-backend-base.hpp:37
virtual AieRC requestAllocated(XAieUserRsc &RscReq)
Definition xaiefal-rscmgr-backend-base.hpp:73
AieRC request(std::vector< XAieUserRsc > &RscReq)
Definition xaiefal-rscmgr-backend-base.hpp:52
virtual AieRC loadRscBitmaps(const char *MetaData, uint64_t NumBitmaps)
Definition xaiefal-rscmgr-backend-base.hpp:236
virtual AieRC release(XAieUserRsc &RscRel)
Definition xaiefal-rscmgr-backend-base.hpp:142
XAie_DevInst * dev()
Definition xaiefal-rscmgr-backend-base.hpp:244
XAieDevHandle * AieHd
Definition xaiefal-rscmgr-backend-base.hpp:248
virtual AieRC getRscStats(std::vector< XAieUserRscStat > &vStats, XAieRscBitmapType BType)
Definition xaiefal-rscmgr-backend-base.hpp:200
virtual AieRC writeRscBitmaps(std::ofstream &Fs, uint64_t &NumRscs)
Definition xaiefal-rscmgr-backend-base.hpp:219
AieRC free(std::vector< XAieUserRsc > &RscFree)
Definition xaiefal-rscmgr-backend-base.hpp:185
virtual AieRC free(XAieUserRsc &RscFree)
Definition xaiefal-rscmgr-backend-base.hpp:170
virtual AieRC requestContiguous(std::vector< XAieUserRsc > &RscReq)
Definition xaiefal-rscmgr-backend-base.hpp:110
XAieRscMgrBackend(XAieDevHandle *DevHd)
Definition xaiefal-rscmgr-backend-base.hpp:26
AieRC release(std::vector< XAieUserRsc > &RscRel)
Definition xaiefal-rscmgr-backend-base.hpp:157
virtual AieRC requestBc(std::vector< XAieUserRsc > &RscReq, bool isBcAll)
Definition xaiefal-rscmgr-backend-base.hpp:126
c Accompany it with the information you received as to the offer to distribute corresponding source complete source code means all the source code for all modules it plus any associated interface definition plus the scripts used to control compilation and installation of the executable as a special the source code distributed need not include anything that is normally and so on of the operating system on which the executable unless that component itself accompanies the executable If distribution of executable or object code is made by offering access to copy from a designated then offering equivalent access to copy the source code from the same place counts as distribution of the source even though third parties are not compelled to copy the source along with the object code You may not or distribute the Program except as expressly provided under this License Any attempt otherwise to sublicense or distribute the Program is void
Definition license.txt:197
Definition xaiefal-base.hpp:23
XAieRscBitmapType
Definition xaiefal-rscmgr-backend-base.hpp:14
@ XAIE_STATIC_RSC
Definition xaiefal-rscmgr-backend-base.hpp:15
@ XAIE_AVAIL_RSC
Definition xaiefal-rscmgr-backend-base.hpp:16
@ FAL_ERROR
Definition xaiefal-log.hpp:14
Data needed to make a resource request.
Definition xaiefal-rsc-base.hpp:27