Support multi-thread hierarchical simulation (#2583) (#5871)

This commit is contained in:
Bartłomiej Chmiel
2025-03-24 18:39:29 -04:00
committed by GitHub
parent 7521c2c644
commit fabded95df
22 changed files with 505 additions and 142 deletions
+18
View File
@@ -88,6 +88,7 @@
#include "V3HierBlock.h"
#include "V3Config.h"
#include "V3EmitV.h"
#include "V3File.h"
#include "V3Os.h"
@@ -188,6 +189,23 @@ V3StringList V3HierBlock::commandArgs(bool forCMake) const {
if (!params().gTypeParams().empty())
opts.push_back(" --hierarchical-params-file " + typeParametersFilename());
const int blockThreads = V3Config::getHierWorkers(m_modp->origName());
if (blockThreads > 1) {
if (hasParent()) {
V3Config::getHierWorkersFileLine()->v3warn(
E_UNSUPPORTED, "Specifying workers for nested hierarchical blocks");
} else {
if (v3Global.opt.threads() < blockThreads) {
m_modp->v3error("Hierarchical blocks cannot be scheduled on more threads than in "
"thread pool, threads = "
<< v3Global.opt.threads()
<< " hierarchical block threads = " << blockThreads);
}
opts.push_back(" --threads " + std::to_string(blockThreads));
}
}
return opts;
}