13#include <xaiefal/common/xaiefal-common.hpp>
14#include <xaiefal/common/xaiefal-log.hpp>
70 std::map<std::tuple<uint8_t, uint8_t, uint32_t, uint32_t>,
88 std::tuple<uint8_t, uint8_t, uint32_t, uint32_t> rKey {
89 Loc.Col, Loc.Row,
static_cast<uint32_t
>(Mod),
90 static_cast<uint32_t
>(RscType)};
93 Rscs[rKey] += NumRscs;
111 uint32_t NumRscs = 0;
112 std::tuple<uint8_t, uint8_t, uint32_t, uint32_t> rKey {
113 Loc.Col, Loc.Row,
static_cast<uint32_t
>(Mod),
114 static_cast<uint32_t
>(RscType)};
116 if (
Rscs.find(rKey) !=
Rscs.end()) {
117 NumRscs =
Rscs[rKey];
130 return (
Rscs.size() == 0) ? false :
true;
138 for (
auto const& r :
Rscs) {
139 std::string Str =
"\t(" +
140 std::to_string(
static_cast<uint32_t
>(std::get<0>(r.first))) +
142 std::to_string(
static_cast<uint32_t
>(std::get<1>(r.first))) +
145 switch (std::get<2>(r.first)) {
161 switch (std::get<3>(r.first)) {
166 Str +=
"UserEvents ";
175 Str +=
"SSEventsPorts ";
181 Str +=
"ComboEvents ";
184 Str +=
"GroupEvents ";
187 Str +=
"TraceEvents ";
193 Str +=
": " + std::to_string(r.second);
194 std::cout << Str << std::endl;
206 const std::string &Name =
""):
320 virtual AieRC
addRsc(std::shared_ptr<XAieRsc> Rsc) {
322 throw std::invalid_argument(
"Add Rsc not supported, rsc group: " +
FuncName);
342 uint32_t RscId)
const {
350 throw std::invalid_argument(
"Get rsc stat not supported, rsc group: " +
FuncName);
355 std::vector<XAie_LocType> vLocs;
357 vLocs.push_back(Loc);
370 XAie_DevInst *DevInst) {
371 std::vector<XAie_LocType> vLocs(DevInst->NumCols *
373 uint8_t Col = 0, Row = 0;
375 for (std::vector<XAie_LocType>::iterator
it = vLocs.begin() ;
376 it != vLocs.end(); ++
it) {
377 *
it = XAie_TileLoc(Col, Row);
380 if (Row == DevInst->NumRows) {
402 XAie_DevInst *DevInst,
403 const std::vector<XAie_LocType> &vLocs,
405 uint32_t NumStats = 0;
406 uint32_t MaxNumRscs =
static_cast<uint32_t
>(
XAIE_MAXRSC);
407 uint32_t ShimModNumRscs = 0, CoreModNumRscs = 0;
408 uint32_t CoreMemModNumRscs = 0, MemModNumRscs = 0;
409 uint32_t NumTiles = 0, NumCoreTiles = 0, NumShimTiles = 0;
410 uint32_t i, MdmPresent = 0;
413 throw std::invalid_argument(
"Invalid Rsc Type to get rsc stat");
416 if (XAie_IsUcModulePresent(DevInst, DevInst->ShimRow)) {
424 Mod == XAIE_PL_MOD) {
426 ShimModNumRscs = MdmPresent ? MaxNumRscs - 1 : MaxNumRscs - 2;
430 ShimModNumRscs = MdmPresent;
436 Mod == XAIE_CORE_MOD) {
438 CoreModNumRscs = MaxNumRscs - 1;
447 Mod == XAIE_MEM_MOD) {
449 MemModNumRscs = MaxNumRscs - 2;
450 CoreMemModNumRscs = MaxNumRscs - 3;
453 CoreMemModNumRscs = 0;
456 CoreMemModNumRscs = 0;
460 CoreMemModNumRscs = 0;
462 CoreMemModNumRscs = 1;
467 for (
auto L: vLocs) {
470 throw std::invalid_argument(
"Invalid tile location to get rsc stat");
475 }
else if (L.Row >= DevInst->AieTileRowStart) {
481 NumStats += NumShimTiles * ShimModNumRscs;
482 NumStats += NumCoreTiles * CoreModNumRscs;
483 NumStats += NumCoreTiles * CoreMemModNumRscs;
484 NumStats += (NumTiles - NumShimTiles - NumCoreTiles) * MemModNumRscs;
486 std::vector<XAieUserRscStat> RscsStats(NumStats);
490 for (
auto L: vLocs) {
493 if (ShimModNumRscs == 0) {
496 if (ShimModNumRscs == 1) {
497 RscsStats[i].Loc = L;
498 RscsStats[i].Mod = XAIE_PL_MOD;
499 RscsStats[i].RscType = RscType;
500 RscsStats[i].NumRscs = 0;
510 if (MdmPresent == 0) {
514 RscsStats[i].Loc = L;
515 RscsStats[i].Mod = XAIE_PL_MOD;
516 RscsStats[i].RscType =
static_cast<XAieRscType>(Rsc);
517 RscsStats[i].NumRscs = 0;
520 }
else if (L.Row >= DevInst->AieTileRowStart) {
522 if (CoreModNumRscs == 1) {
523 RscsStats[i].Loc = L;
524 RscsStats[i].Mod = XAIE_CORE_MOD;
525 RscsStats[i].RscType = RscType;
526 RscsStats[i].NumRscs = 0;
528 }
else if (CoreModNumRscs > 1) {
534 RscsStats[i].Loc = L;
535 RscsStats[i].Mod = XAIE_CORE_MOD;
536 RscsStats[i].RscType =
static_cast<XAieRscType>(Rsc);
537 RscsStats[i].NumRscs = 0;
543 if (CoreMemModNumRscs == 0) {
546 if (CoreMemModNumRscs == 1) {
547 RscsStats[i].Loc = L;
548 RscsStats[i].Mod = XAIE_MEM_MOD;
549 RscsStats[i].RscType = RscType;
550 RscsStats[i].NumRscs = 0;
561 RscsStats[i].Loc = L;
562 RscsStats[i].Mod = XAIE_MEM_MOD;
563 RscsStats[i].RscType =
static_cast<XAieRscType>(Rsc);
564 RscsStats[i].NumRscs = 0;
569 if (MemModNumRscs == 0) {
572 if (MemModNumRscs == 1) {
573 RscsStats[i].Loc = L;
574 RscsStats[i].Mod = XAIE_MEM_MOD;
575 RscsStats[i].RscType = RscType;
576 RscsStats[i].NumRscs = 0;
586 RscsStats[i].Loc = L;
587 RscsStats[i].Mod = XAIE_MEM_MOD;
588 RscsStats[i].RscType =
static_cast<XAieRscType>(Rsc);
589 RscsStats[i].NumRscs = 0;
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
std::weak_ptr< XAieDevHandle > AieHd
Definition xaiefal-rsc-group.hpp:327
XAieRscStat getRscStat(XAie_LocType Loc, XAieRscType RscType) const
Definition xaiefal-rsc-group.hpp:241
XAieRscStat getRscStat(XAie_LocType Loc, XAie_ModuleType Mod) const
Definition xaiefal-rsc-group.hpp:254
virtual XAieRscStat _getRscStat(const std::vector< XAie_LocType > &vLocs, XAie_ModuleType Mod, XAieRscType RscType, uint32_t RscId) const
Definition xaiefal-rsc-group.hpp:340
static std::vector< XAie_LocType > _getAllTilesLocs(XAie_DevInst *DevInst)
Definition xaiefal-rsc-group.hpp:369
~XAieRscGroupBase()
Definition xaiefal-rsc-group.hpp:209
XAieRscStat getRscStat(const std::vector< XAie_LocType > &vLocs, XAieRscType RscType) const
Definition xaiefal-rsc-group.hpp:297
virtual AieRC addRsc(std::shared_ptr< XAieRsc > Rsc)
Definition xaiefal-rsc-group.hpp:320
XAieRscStat getRscStat(XAie_LocType Loc, XAie_ModuleType Mod, XAieRscType RscType, uint32_t RscId) const
Definition xaiefal-rsc-group.hpp:283
XAieRscGroupBase(std::shared_ptr< XAieDevHandle > DevHd, const std::string &Name="")
Definition xaiefal-rsc-group.hpp:205
std::string FuncName
Definition xaiefal-rsc-group.hpp:326
XAieRscGroupBase()
Definition xaiefal-rsc-group.hpp:208
XAieRscStat getRscStat(const std::vector< XAie_LocType > &vLocs, XAieRscType RscType, uint32_t RscId) const
Definition xaiefal-rsc-group.hpp:314
static std::vector< XAieUserRscStat > _createDrvRscStats(XAie_DevInst *DevInst, const std::vector< XAie_LocType > &vLocs, XAie_ModuleType Mod, XAieRscType RscType)
Definition xaiefal-rsc-group.hpp:401
XAieRscStat getRscStat(XAie_LocType Loc, XAie_ModuleType Mod, XAieRscType RscType) const
Definition xaiefal-rsc-group.hpp:267
XAieRscStat _getRscStatTile(XAie_LocType Loc, XAie_ModuleType Mod, XAieRscType RscType, uint32_t RscId) const
Definition xaiefal-rsc-group.hpp:353
XAieRscStat getRscStat(XAie_LocType Loc) const
Definition xaiefal-rsc-group.hpp:228
XAieRscStat getRscStat() const
Definition xaiefal-rsc-group.hpp:217
Base AI engine resource class. It defines resource operations and maintains resource state machine.
Definition xaiefal-rsc-base.hpp:69
and that you know you can do these things To protect your we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights These restrictions translate to certain responsibilities for you if you distribute copies of the or if you modify it For if you distribute copies of such a whether gratis or for a you must give the recipients all the rights that you have You must make sure that receive or can get the source code And you must show them these terms so they know their rights We protect your rights with two distribute and or modify the software for each author s protection and we want to make certain that everyone understands that there is no warranty for this free software If the software is modified by someone else and passed we want its recipients to know that what they have is not the so that any problems introduced by others will not reflect on the original authors reputations any free program is threatened constantly by software patents We wish to avoid the danger that redistributors of a free program will individually obtain patent in effect making the program proprietary To prevent we have made it clear that any patent must be licensed for everyone s free use or not licensed at all The precise terms and conditions for distribution and modification follow GNU GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR DISTRIBUTION AND MODIFICATION This License applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License The refers to any such program or and a work based on the Program means either the Program or any derivative work under copyright a work containing the Program or a portion of it
Definition license.txt:89
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
XAieRscType
Enums representing all requestable resources.
Definition xaiefal-rsc-group.hpp:27
@ XAIE_COMBOEVENT
Definition xaiefal-rsc-group.hpp:34
@ XAIE_MDMPERFCNT
Definition xaiefal-rsc-group.hpp:36
@ XAIE_GROUPEVENT
Definition xaiefal-rsc-group.hpp:35
@ XAIE_SSEVENT
Definition xaiefal-rsc-group.hpp:32
@ XAIE_PERFCOUNT
Definition xaiefal-rsc-group.hpp:28
@ XAIE_TRACEEVENT
Definition xaiefal-rsc-group.hpp:38
@ XAIE_PCEVENT
Definition xaiefal-rsc-group.hpp:31
@ XAIE_MAXRSC
Definition xaiefal-rsc-group.hpp:37
@ XAIE_TRACECTRL
Definition xaiefal-rsc-group.hpp:30
@ XAIE_BROADCAST
Definition xaiefal-rsc-group.hpp:33
@ XAIE_USEREVENT
Definition xaiefal-rsc-group.hpp:29
@ FAL_INFO
Definition xaiefal-log.hpp:12
Definition xaiefal-rsc-base.hpp:609
struct of resource usage statistics
Definition xaiefal-rsc-group.hpp:66
std::map< std::tuple< uint8_t, uint8_t, uint32_t, uint32_t >, uint32_t > Rscs
Definition xaiefal-rsc-group.hpp:71
uint32_t getNumRsc(XAie_LocType Loc, XAie_ModuleType Mod, XAieRscType RscType)
Definition xaiefal-rsc-group.hpp:109
std::string GroupName
Definition xaiefal-rsc-group.hpp:69
XAieRscStat(const std::string &Name="")
Definition xaiefal-rsc-group.hpp:67
void show() const
Definition xaiefal-rsc-group.hpp:136
bool hasRsc() const
Definition xaiefal-rsc-group.hpp:129
void addRscStat(XAie_LocType Loc, XAie_ModuleType Mod, XAieRscType RscType, uint32_t NumRscs)
Definition xaiefal-rsc-group.hpp:82
Data needed to make resource statistics request.
Definition xaiefal-rsc-group.hpp:45
XAie_LocType Loc
Definition xaiefal-rsc-group.hpp:47
XAieRscType RscType
Definition xaiefal-rsc-group.hpp:55
XAie_ModuleType Mod
Definition xaiefal-rsc-group.hpp:51
uint32_t NumRscs
Definition xaiefal-rsc-group.hpp:59
#define XAIE_RSC_TYPE_ANY
Definition xaiefal-common.hpp:8
#define XAIE_LOC_ANY
Definition xaiefal-common.hpp:10
#define XAIE_MOD_ANY
Definition xaiefal-common.hpp:9
#define XAIE_RSC_ID_ANY
Definition xaiefal-common.hpp:7