Do not create any empty ExecMTasks (#4987)

This commit is contained in:
Geza Lore 2024-03-16 12:00:32 +00:00 committed by GitHub
parent 878204db73
commit bf8a88a0ad
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -2383,12 +2383,20 @@ class Partitioner final {
} }
} }
// Set color to indicate an mtaskId on every underlying MTaskMoveVertex. // Set color to indicate the mtaskId on every underlying logic MTaskMoveVertex.
for (V3GraphVertex* itp = m_mTaskGraphp->verticesBeginp(); itp; // Remove any MTasks that have no logic in it rerouting the edges.
itp = itp->verticesNextp()) { for (V3GraphVertex *vtxp = m_mTaskGraphp->verticesBeginp(), *nextp; vtxp; vtxp = nextp) {
const LogicMTask* const mtaskp = static_cast<LogicMTask*>(itp); nextp = vtxp->verticesNextp();
for (MTaskMoveVertex* const mvertexp : mtaskp->vertexList()) { const LogicMTask* const mtaskp = vtxp->as<LogicMTask>();
mvertexp->color(mtaskp->id()); bool empty = true;
for (MTaskMoveVertex* const mVtxp : mtaskp->vertexList()) {
if (!mVtxp->logicp()) continue;
empty = false;
mVtxp->color(mtaskp->id());
}
if (empty) {
vtxp->rerouteEdges(m_mTaskGraphp.get());
vtxp->unlinkDelete(m_mTaskGraphp.get());
} }
} }
} }
@ -2516,6 +2524,7 @@ AstExecGraph* V3Order::createParallel(const OrderGraph& orderGraph, const std::s
// Emit functions with this MTaks's logic, and call them in the body. // Emit functions with this MTaks's logic, and call them in the body.
for (const OrderLogicVertex* lVtxp : state.m_logics) emitter.emitLogic(lVtxp); for (const OrderLogicVertex* lVtxp : state.m_logics) emitter.emitLogic(lVtxp);
for (AstActive* const activep : emitter.getAndClearActiveps()) bodyp->addStmtsp(activep); for (AstActive* const activep : emitter.getAndClearActiveps()) bodyp->addStmtsp(activep);
UASSERT_OBJ(bodyp->stmtsp(), bodyp, "Should not try to create empty MTask");
// Translate the LogicMTask graph into the corresponding ExecMTask // Translate the LogicMTask graph into the corresponding ExecMTask
// graph, which will outlive V3Order and persist for the remainder // graph, which will outlive V3Order and persist for the remainder