Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion tools/projmgr/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,14 @@ SET(PROJMGR_SOURCE_FILES ProjMgr.cpp ProjMgrKernel.cpp ProjMgrCallback.cpp
ProjMgrCbuildBase.cpp ProjMgrCbuild.cpp ProjMgrCbuildIdx.cpp
ProjMgrCbuildGenIdx.cpp ProjMgrCbuildPack.cpp ProjMgrCbuildSet.cpp
ProjMgrCbuildRun.cpp ProjMgrRunDebug.cpp
ProjMgrCbuildMlops.cpp ProjMgrMlops.cpp
ProjMgrRpcServer.cpp ProjMgrRpcServerData.cpp
)
SET(PROJMGR_HEADER_FILES ProjMgr.h ProjMgrKernel.h ProjMgrCallback.h
ProjMgrParser.h ProjMgrWorker.h ProjMgrGenerator.h ProjMgrXmlParser.h
ProjMgrYamlParser.h ProjMgrLogger.h ProjMgrYamlSchemaChecker.h
ProjMgrYamlEmitter.h ProjMgrUtils.h ProjMgrExtGenerator.h
ProjMgrCbuildBase.h ProjMgrRunDebug.h
ProjMgrCbuildBase.h ProjMgrRunDebug.h ProjMgrMlops.h
ProjMgrRpcServer.h ProjMgrRpcServerData.h
)

Expand Down
2 changes: 2 additions & 0 deletions tools/projmgr/include/ProjMgr.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
#include "ProjMgrGenerator.h"
#include "ProjMgrYamlEmitter.h"
#include "ProjMgrRunDebug.h"
#include "ProjMgrMlops.h"
#include "ProjMgrRpcServer.h"

#include <cxxopts.hpp>
Expand Down Expand Up @@ -192,6 +193,7 @@ class ProjMgr {
ProjMgrGenerator m_generator;
ProjMgrYamlEmitter m_emitter;
ProjMgrRunDebug m_runDebug;
ProjMgrMlops m_mlops;
ProjMgrRpcServer m_rpcServer;

std::string m_csolutionFile;
Expand Down
138 changes: 138 additions & 0 deletions tools/projmgr/include/ProjMgrMlops.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,138 @@
/*
* Copyright (c) 2026 Arm Limited. All rights reserved.
*
* SPDX-License-Identifier: Apache-2.0
*/

#ifndef PROJMGRMLOPS_H
#define PROJMGRMLOPS_H

#include "ProjMgrWorker.h"

struct CsolutionItem;
struct ContextItem;
struct CustomItem;
struct MlopsItem;
struct TargetSetItem;
struct TargetType;

/**
* @brief mlops processor type containing
* processor type
*/
struct MlopsProcessorType {
std::string type;
};

/**
* @brief mlops NPU type containing
* NPU type,
* number of MACs
*/
struct MlopsNpuType {
std::string type;
std::string macs;
};

/**
* @brief mlops Vela type containing
* path to INI file,
* option string
*/
struct MlopsVelaType {
std::string ini;
std::string options;
};

/**
* @brief mlops model type containing
* path to AI clayer,
* model name
*/
struct MlopsModelType {
std::string clayer;
std::string name;
};

/**
* @brief Mlops output type
*/
struct MlopsOutputType {
std::string file;
std::string type;
};

/**
* @brief mlops run type containing
* active target-set,
* cbuild-run file
* output artifacts
*/
struct MlopsRunType {
std::string active;
std::string cbuildRun;
std::vector<MlopsOutputType> output;
};

/**
* @brief mlops simulator type containing
* active target-set,
* cbuild-run file
* output artifacts
* simulator model,
* simulator configuration file
*/
struct MlopsSimulatorType : MlopsRunType {
std::string model;
std::string configFile;
};

/**
* @brief mlops type
*/
struct MlopsType {
std::string description;
MlopsProcessorType processor;
MlopsNpuType npu;
MlopsVelaType vela;
MlopsModelType model;
MlopsRunType hardware;
MlopsSimulatorType simulator;
};

/**
* @brief projmgr mlops management class
*/
class ProjMgrMlops {
public:
/**
* @brief class constructor
*/
ProjMgrMlops(ProjMgrWorker* worker);

/**
* @brief class destructor
*/
~ProjMgrMlops(void);

/**
* @brief collect mlops information
* @param csolution csolution settings
* @param mlops output settings
* @return true if executed successfully
*/
bool CollectSettings(const CsolutionItem& csolution, MlopsType& mlops);

private:
ProjMgrWorker* m_worker = nullptr;
bool FindTargetType(const CsolutionItem& csolution, const std::string& typeName, TargetType& targetType) const;
bool GetTargetSetItemRef(const TargetType& targetType, const std::string& targetTypeName,
const std::string& targetSetName, bool simulatorDefault, TargetSetItem& targetSet) const;
std::string BuildActive(const std::string& targetType, const std::string& targetSet) const;
std::string GetCustomScalar(const CustomItem& custom, const std::string& key) const;
std::string BuildVelaOptions(const MlopsNpuType& npu, const MlopsVelaItem& vela) const;
void SetMlopsRunType(MlopsRunType& run, const std::string& targetType, const std::string& targetSet,
const std::vector<ContextItem>& contexts, const std::string& outBaseDir, const std::string& solutionName) const;
};

#endif // PROJMGRMLOPS_H
66 changes: 66 additions & 0 deletions tools/projmgr/include/ProjMgrParser.h
Original file line number Diff line number Diff line change
Expand Up @@ -542,6 +542,71 @@ struct CdefaultItem {

typedef std::vector<std::pair<std::string, BuildType>> BuildTypes;
typedef std::vector<std::pair<std::string, TargetType>> TargetTypes;

/**
* @brief mlops NPU item containing
* NPU type,
* number of MACs
*/
struct MlopsNpuItem {
std::string type;
std::string macs;
};

/**
* @brief mlops Vela item containing
* path to INI file,
* system configuration selector,
* memory configuration selector,
* additional Vela options string
*/
struct MlopsVelaItem {
std::string ini;
std::string system;
std::string memory;
std::string misc;
};

/**
* @brief mlops model item containing
* path to AI clayer,
* model name
*/
struct MlopsModelItem {
std::string clayer;
std::string name;
};

/**
* @brief mlops hardware/simulator target item containing
* explicit target-type name,
* explicit target-set name
*/
struct MlopsTargetItem {
std::string targetType;
std::string targetSet;
};

/**
* @brief mlops item containing
* enable flag
* description,
* NPU configuration,
* Vela compiler configuration,
* ML model configuration,
* hardware target for testing,
* simulator target for testing
*/
struct MlopsItem {
bool enabled = false;
std::string description;
MlopsNpuItem npu;
MlopsVelaItem vela;
MlopsModelItem model;
MlopsTargetItem hardware;
MlopsTargetItem simulator;
};

/**
* @brief solution item containing
* csolution name,
Expand Down Expand Up @@ -583,6 +648,7 @@ struct CsolutionItem {
std::vector<ExecutesItem> executes;
std::vector<std::string> ymlOrderedBuildTypes;
std::vector<std::string> ymlOrderedTargetTypes;
MlopsItem mlops;
};

/**
Expand Down
39 changes: 36 additions & 3 deletions tools/projmgr/include/ProjMgrWorker.h
Original file line number Diff line number Diff line change
Expand Up @@ -1175,6 +1175,42 @@ class ProjMgrWorker {
*/
bool ElaborateVariablesConfigurations();

/**
* @brief Resolve access sequences and normalize a path relative to a reference directory.
*
* This expands static and dynamic access sequences in `item`, optionally records
* context dependencies for cross-context references, and converts the final path
* to be relative to `outDir` using `ref` as the input base directory when no
* context-based replacement is performed.
*
* @param context current context used for variable expansion and dependency tracking
* @param item input string to process; replaced in-place with the resolved value
* @param ref base directory used to resolve relative paths
* @param genDep add referenced contexts to `context.dependsOn` when true
* @param outDir output directory used when rebasing the resulting path; defaults to the context cprj directory when empty
* @param withHeadingDot preserve a leading `./` when generating relative paths
* @param solutionLevel allow solution-level context matching for access sequences
* @return true if the sequence was resolved successfully, otherwise false
*/
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);

/**
* @brief parse and load context layers
* @param context item
* @return true if there is no error
*/
bool ParseContextLayers(ContextItem& context);

/**
* @brief process context precedences
* @param context item
* @param scope: process board, device or both
* @param rerun flag to reprocess
* @return true if there is no error
*/
bool ProcessPrecedences(ContextItem& context, BoardOrDevice process = BoardOrDevice::None, bool rerun = false);

/**
* @brief clear worker members for reloading a solution
* @return true if there is no error
Expand Down Expand Up @@ -1259,7 +1295,6 @@ class ProjMgrWorker {
bool CheckContextFilters(const TypeFilter& typeFilter, const ContextItem& context);
bool GetTypeContent(ContextItem& context);
bool GetProjectSetup(ContextItem& context);
bool ProcessPrecedences(ContextItem& context, BoardOrDevice process = BoardOrDevice::None, bool rerun = false);
bool ProcessPrecedence(StringCollection& item);
bool ProcessCompilerPrecedence(StringCollection& item, bool acceptRedefinition = false);
bool ProcessDevicePrecedence(StringCollection& item);
Expand All @@ -1279,7 +1314,6 @@ class ProjMgrWorker {
bool ProcessSequencesRelatives(ContextItem& context, bool rerun);
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);
bool ProcessSequencesRelatives(ContextItem& context, BuildType& build, const std::string& ref = std::string());
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);
bool ProcessOutputFilenames(ContextItem& context);
bool ProcessLinkerOptions(ContextItem& context);
bool ProcessLinkerOptions(ContextItem& context, const LinkerItem& linker, const std::string& ref);
Expand Down Expand Up @@ -1336,7 +1370,6 @@ class ProjMgrWorker {
bool GetGeneratorDir(const RteGenerator* generator, ContextItem& context, const std::string& layer, std::string& genDir);
bool GetGeneratorOptions(ContextItem& context, const std::string& layer, GeneratorOptionsItem& options);
bool GetExtGeneratorOptions(ContextItem& context, const std::string& layer, GeneratorOptionsItem& options);
bool ParseContextLayers(ContextItem& context);
bool AddPackRequirements(ContextItem& context, const std::vector<PackItem>& packRequirements);
void InsertPackRequirements(const std::vector<PackItem>& src, std::vector<PackItem>& dst, std::string base);
void CheckTypeFilterSpelling(const TypeFilter& typeFilter);
Expand Down
10 changes: 9 additions & 1 deletion tools/projmgr/include/ProjMgrYamlEmitter.h
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
/*
* Copyright (c) 2020-2025 Arm Limited. All rights reserved.
* Copyright (c) 2020-2026 Arm Limited. All rights reserved.
*
* SPDX-License-Identifier: Apache-2.0
*/

#ifndef PROJMGRYAMLEMITTER_H
#define PROJMGRYAMLEMITTER_H

#include "ProjMgrMlops.h"
#include "ProjMgrRunDebug.h"
#include "ProjMgrWorker.h"

Expand Down Expand Up @@ -103,6 +104,13 @@ class ProjMgrYamlEmitter {
*/
bool GenerateCbuildRun(const RunDebugType& debugRun);

/**
* @brief generate cbuild mlops file
* @param reference to struct with mlops info
* @return true if executed successfully
*/
bool GenerateMlops(const MlopsType& mlops);

protected:
ProjMgrParser* m_parser = nullptr;
ProjMgrWorker* m_worker = nullptr;
Expand Down
Loading
Loading