Skip to content

Commit 2834dc7

Browse files
authored
[projmgr] Introduce MLOps management
1 parent f9c518a commit 2834dc7

30 files changed

Lines changed: 1222 additions & 6 deletions

tools/projmgr/CMakeLists.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,13 +39,14 @@ SET(PROJMGR_SOURCE_FILES ProjMgr.cpp ProjMgrKernel.cpp ProjMgrCallback.cpp
3939
ProjMgrCbuildBase.cpp ProjMgrCbuild.cpp ProjMgrCbuildIdx.cpp
4040
ProjMgrCbuildGenIdx.cpp ProjMgrCbuildPack.cpp ProjMgrCbuildSet.cpp
4141
ProjMgrCbuildRun.cpp ProjMgrRunDebug.cpp
42+
ProjMgrCbuildMlops.cpp ProjMgrMlops.cpp
4243
ProjMgrRpcServer.cpp ProjMgrRpcServerData.cpp
4344
)
4445
SET(PROJMGR_HEADER_FILES ProjMgr.h ProjMgrKernel.h ProjMgrCallback.h
4546
ProjMgrParser.h ProjMgrWorker.h ProjMgrGenerator.h ProjMgrXmlParser.h
4647
ProjMgrYamlParser.h ProjMgrLogger.h ProjMgrYamlSchemaChecker.h
4748
ProjMgrYamlEmitter.h ProjMgrUtils.h ProjMgrExtGenerator.h
48-
ProjMgrCbuildBase.h ProjMgrRunDebug.h
49+
ProjMgrCbuildBase.h ProjMgrRunDebug.h ProjMgrMlops.h
4950
ProjMgrRpcServer.h ProjMgrRpcServerData.h
5051
)
5152

tools/projmgr/include/ProjMgr.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
#include "ProjMgrGenerator.h"
1313
#include "ProjMgrYamlEmitter.h"
1414
#include "ProjMgrRunDebug.h"
15+
#include "ProjMgrMlops.h"
1516
#include "ProjMgrRpcServer.h"
1617

1718
#include <cxxopts.hpp>
@@ -192,6 +193,7 @@ class ProjMgr {
192193
ProjMgrGenerator m_generator;
193194
ProjMgrYamlEmitter m_emitter;
194195
ProjMgrRunDebug m_runDebug;
196+
ProjMgrMlops m_mlops;
195197
ProjMgrRpcServer m_rpcServer;
196198

197199
std::string m_csolutionFile;
Lines changed: 138 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,138 @@
1+
/*
2+
* Copyright (c) 2026 Arm Limited. All rights reserved.
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*/
6+
7+
#ifndef PROJMGRMLOPS_H
8+
#define PROJMGRMLOPS_H
9+
10+
#include "ProjMgrWorker.h"
11+
12+
struct CsolutionItem;
13+
struct ContextItem;
14+
struct CustomItem;
15+
struct MlopsItem;
16+
struct TargetSetItem;
17+
struct TargetType;
18+
19+
/**
20+
* @brief mlops processor type containing
21+
* processor type
22+
*/
23+
struct MlopsProcessorType {
24+
std::string type;
25+
};
26+
27+
/**
28+
* @brief mlops NPU type containing
29+
* NPU type,
30+
* number of MACs
31+
*/
32+
struct MlopsNpuType {
33+
std::string type;
34+
std::string macs;
35+
};
36+
37+
/**
38+
* @brief mlops Vela type containing
39+
* path to INI file,
40+
* option string
41+
*/
42+
struct MlopsVelaType {
43+
std::string ini;
44+
std::string options;
45+
};
46+
47+
/**
48+
* @brief mlops model type containing
49+
* path to AI clayer,
50+
* model name
51+
*/
52+
struct MlopsModelType {
53+
std::string clayer;
54+
std::string name;
55+
};
56+
57+
/**
58+
* @brief Mlops output type
59+
*/
60+
struct MlopsOutputType {
61+
std::string file;
62+
std::string type;
63+
};
64+
65+
/**
66+
* @brief mlops run type containing
67+
* active target-set,
68+
* cbuild-run file
69+
* output artifacts
70+
*/
71+
struct MlopsRunType {
72+
std::string active;
73+
std::string cbuildRun;
74+
std::vector<MlopsOutputType> output;
75+
};
76+
77+
/**
78+
* @brief mlops simulator type containing
79+
* active target-set,
80+
* cbuild-run file
81+
* output artifacts
82+
* simulator model,
83+
* simulator configuration file
84+
*/
85+
struct MlopsSimulatorType : MlopsRunType {
86+
std::string model;
87+
std::string configFile;
88+
};
89+
90+
/**
91+
* @brief mlops type
92+
*/
93+
struct MlopsType {
94+
std::string description;
95+
MlopsProcessorType processor;
96+
MlopsNpuType npu;
97+
MlopsVelaType vela;
98+
MlopsModelType model;
99+
MlopsRunType hardware;
100+
MlopsSimulatorType simulator;
101+
};
102+
103+
/**
104+
* @brief projmgr mlops management class
105+
*/
106+
class ProjMgrMlops {
107+
public:
108+
/**
109+
* @brief class constructor
110+
*/
111+
ProjMgrMlops(ProjMgrWorker* worker);
112+
113+
/**
114+
* @brief class destructor
115+
*/
116+
~ProjMgrMlops(void);
117+
118+
/**
119+
* @brief collect mlops information
120+
* @param csolution csolution settings
121+
* @param mlops output settings
122+
* @return true if executed successfully
123+
*/
124+
bool CollectSettings(const CsolutionItem& csolution, MlopsType& mlops);
125+
126+
private:
127+
ProjMgrWorker* m_worker = nullptr;
128+
bool FindTargetType(const CsolutionItem& csolution, const std::string& typeName, TargetType& targetType) const;
129+
bool GetTargetSetItemRef(const TargetType& targetType, const std::string& targetTypeName,
130+
const std::string& targetSetName, bool simulatorDefault, TargetSetItem& targetSet) const;
131+
std::string BuildActive(const std::string& targetType, const std::string& targetSet) const;
132+
std::string GetCustomScalar(const CustomItem& custom, const std::string& key) const;
133+
std::string BuildVelaOptions(const MlopsNpuType& npu, const MlopsVelaItem& vela) const;
134+
void SetMlopsRunType(MlopsRunType& run, const std::string& targetType, const std::string& targetSet,
135+
const std::vector<ContextItem>& contexts, const std::string& outBaseDir, const std::string& solutionName) const;
136+
};
137+
138+
#endif // PROJMGRMLOPS_H

tools/projmgr/include/ProjMgrParser.h

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -542,6 +542,71 @@ struct CdefaultItem {
542542

543543
typedef std::vector<std::pair<std::string, BuildType>> BuildTypes;
544544
typedef std::vector<std::pair<std::string, TargetType>> TargetTypes;
545+
546+
/**
547+
* @brief mlops NPU item containing
548+
* NPU type,
549+
* number of MACs
550+
*/
551+
struct MlopsNpuItem {
552+
std::string type;
553+
std::string macs;
554+
};
555+
556+
/**
557+
* @brief mlops Vela item containing
558+
* path to INI file,
559+
* system configuration selector,
560+
* memory configuration selector,
561+
* additional Vela options string
562+
*/
563+
struct MlopsVelaItem {
564+
std::string ini;
565+
std::string system;
566+
std::string memory;
567+
std::string misc;
568+
};
569+
570+
/**
571+
* @brief mlops model item containing
572+
* path to AI clayer,
573+
* model name
574+
*/
575+
struct MlopsModelItem {
576+
std::string clayer;
577+
std::string name;
578+
};
579+
580+
/**
581+
* @brief mlops hardware/simulator target item containing
582+
* explicit target-type name,
583+
* explicit target-set name
584+
*/
585+
struct MlopsTargetItem {
586+
std::string targetType;
587+
std::string targetSet;
588+
};
589+
590+
/**
591+
* @brief mlops item containing
592+
* enable flag
593+
* description,
594+
* NPU configuration,
595+
* Vela compiler configuration,
596+
* ML model configuration,
597+
* hardware target for testing,
598+
* simulator target for testing
599+
*/
600+
struct MlopsItem {
601+
bool enabled = false;
602+
std::string description;
603+
MlopsNpuItem npu;
604+
MlopsVelaItem vela;
605+
MlopsModelItem model;
606+
MlopsTargetItem hardware;
607+
MlopsTargetItem simulator;
608+
};
609+
545610
/**
546611
* @brief solution item containing
547612
* csolution name,
@@ -583,6 +648,7 @@ struct CsolutionItem {
583648
std::vector<ExecutesItem> executes;
584649
std::vector<std::string> ymlOrderedBuildTypes;
585650
std::vector<std::string> ymlOrderedTargetTypes;
651+
MlopsItem mlops;
586652
};
587653

588654
/**

tools/projmgr/include/ProjMgrWorker.h

Lines changed: 36 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1175,6 +1175,42 @@ class ProjMgrWorker {
11751175
*/
11761176
bool ElaborateVariablesConfigurations();
11771177

1178+
/**
1179+
* @brief Resolve access sequences and normalize a path relative to a reference directory.
1180+
*
1181+
* This expands static and dynamic access sequences in `item`, optionally records
1182+
* context dependencies for cross-context references, and converts the final path
1183+
* to be relative to `outDir` using `ref` as the input base directory when no
1184+
* context-based replacement is performed.
1185+
*
1186+
* @param context current context used for variable expansion and dependency tracking
1187+
* @param item input string to process; replaced in-place with the resolved value
1188+
* @param ref base directory used to resolve relative paths
1189+
* @param genDep add referenced contexts to `context.dependsOn` when true
1190+
* @param outDir output directory used when rebasing the resulting path; defaults to the context cprj directory when empty
1191+
* @param withHeadingDot preserve a leading `./` when generating relative paths
1192+
* @param solutionLevel allow solution-level context matching for access sequences
1193+
* @return true if the sequence was resolved successfully, otherwise false
1194+
*/
1195+
bool ProcessSequenceRelative(ContextItem& context, std::string& item, const std::string& ref = std::string(),
1196+
bool genDep = true, std::string outDir = std::string(), bool withHeadingDot = false, bool solutionLevel = false);
1197+
1198+
/**
1199+
* @brief parse and load context layers
1200+
* @param context item
1201+
* @return true if there is no error
1202+
*/
1203+
bool ParseContextLayers(ContextItem& context);
1204+
1205+
/**
1206+
* @brief process context precedences
1207+
* @param context item
1208+
* @param scope: process board, device or both
1209+
* @param rerun flag to reprocess
1210+
* @return true if there is no error
1211+
*/
1212+
bool ProcessPrecedences(ContextItem& context, BoardOrDevice process = BoardOrDevice::None, bool rerun = false);
1213+
11781214
/**
11791215
* @brief clear worker members for reloading a solution
11801216
* @return true if there is no error
@@ -1259,7 +1295,6 @@ class ProjMgrWorker {
12591295
bool CheckContextFilters(const TypeFilter& typeFilter, const ContextItem& context);
12601296
bool GetTypeContent(ContextItem& context);
12611297
bool GetProjectSetup(ContextItem& context);
1262-
bool ProcessPrecedences(ContextItem& context, BoardOrDevice process = BoardOrDevice::None, bool rerun = false);
12631298
bool ProcessPrecedence(StringCollection& item);
12641299
bool ProcessCompilerPrecedence(StringCollection& item, bool acceptRedefinition = false);
12651300
bool ProcessDevicePrecedence(StringCollection& item);
@@ -1279,7 +1314,6 @@ class ProjMgrWorker {
12791314
bool ProcessSequencesRelatives(ContextItem& context, bool rerun);
12801315
bool ProcessSequencesRelatives(ContextItem& context, std::vector<std::string>& src, const std::string& ref = std::string(), std::string outDir = std::string(), bool withHeadingDot = false, bool solutionLevel = false);
12811316
bool ProcessSequencesRelatives(ContextItem& context, BuildType& build, const std::string& ref = std::string());
1282-
bool ProcessSequenceRelative(ContextItem& context, std::string& item, const std::string& ref = std::string(), bool genDep = true, std::string outDir = std::string(), bool withHeadingDot = false, bool solutionLevel = false);
12831317
bool ProcessOutputFilenames(ContextItem& context);
12841318
bool ProcessLinkerOptions(ContextItem& context);
12851319
bool ProcessLinkerOptions(ContextItem& context, const LinkerItem& linker, const std::string& ref);
@@ -1336,7 +1370,6 @@ class ProjMgrWorker {
13361370
bool GetGeneratorDir(const RteGenerator* generator, ContextItem& context, const std::string& layer, std::string& genDir);
13371371
bool GetGeneratorOptions(ContextItem& context, const std::string& layer, GeneratorOptionsItem& options);
13381372
bool GetExtGeneratorOptions(ContextItem& context, const std::string& layer, GeneratorOptionsItem& options);
1339-
bool ParseContextLayers(ContextItem& context);
13401373
bool AddPackRequirements(ContextItem& context, const std::vector<PackItem>& packRequirements);
13411374
void InsertPackRequirements(const std::vector<PackItem>& src, std::vector<PackItem>& dst, std::string base);
13421375
void CheckTypeFilterSpelling(const TypeFilter& typeFilter);

tools/projmgr/include/ProjMgrYamlEmitter.h

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
/*
2-
* Copyright (c) 2020-2025 Arm Limited. All rights reserved.
2+
* Copyright (c) 2020-2026 Arm Limited. All rights reserved.
33
*
44
* SPDX-License-Identifier: Apache-2.0
55
*/
66

77
#ifndef PROJMGRYAMLEMITTER_H
88
#define PROJMGRYAMLEMITTER_H
99

10+
#include "ProjMgrMlops.h"
1011
#include "ProjMgrRunDebug.h"
1112
#include "ProjMgrWorker.h"
1213

@@ -103,6 +104,13 @@ class ProjMgrYamlEmitter {
103104
*/
104105
bool GenerateCbuildRun(const RunDebugType& debugRun);
105106

107+
/**
108+
* @brief generate cbuild mlops file
109+
* @param reference to struct with mlops info
110+
* @return true if executed successfully
111+
*/
112+
bool GenerateMlops(const MlopsType& mlops);
113+
106114
protected:
107115
ProjMgrParser* m_parser = nullptr;
108116
ProjMgrWorker* m_worker = nullptr;

0 commit comments

Comments
 (0)