This is an automated email from the ASF dual-hosted git repository. xiaozhenliu pushed a commit to branch xiaozhen-region-cost-memo in repository https://gitbox.apache.org/repos/asf/texera.git
commit 1d563cb723d14abab8ec693048e6b02e143938e7 Author: Xiao-zhen-Liu <[email protected]> AuthorDate: Sun Aug 10 16:49:19 2025 -0700 add cost momo. --- .../engine/architecture/scheduling/CostBasedScheduleGenerator.scala | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/core/amber/src/main/scala/edu/uci/ics/amber/engine/architecture/scheduling/CostBasedScheduleGenerator.scala b/core/amber/src/main/scala/edu/uci/ics/amber/engine/architecture/scheduling/CostBasedScheduleGenerator.scala index 1fa013049b..e5d0eb216f 100644 --- a/core/amber/src/main/scala/edu/uci/ics/amber/engine/architecture/scheduling/CostBasedScheduleGenerator.scala +++ b/core/amber/src/main/scala/edu/uci/ics/amber/engine/architecture/scheduling/CostBasedScheduleGenerator.scala @@ -42,6 +42,7 @@ import org.jgrapht.graph.{DirectedAcyclicGraph, DirectedPseudograph} import java.net.URI import java.util.concurrent.TimeoutException +import scala.collection.immutable.HashMap import scala.collection.mutable import scala.concurrent.ExecutionContext.Implicits.global import scala.concurrent.duration.DurationInt @@ -75,6 +76,8 @@ class CostBasedScheduleGenerator( actorId = actorId ) + private val regionCostMemo: mutable.Map[Region, (Region, Double)] = new mutable.HashMap() + def generate(): (Schedule, PhysicalPlan) = { val startTime = System.nanoTime() val regionDAG = createRegionDAG() @@ -606,7 +609,8 @@ class CostBasedScheduleGenerator( .map(level => level .map(region => { - val (newRegion, regionCost) = costEstimator.allocateResourcesAndEstimateCost(region, 1) + val (newRegion, regionCost) = regionCostMemo + .getOrElseUpdate(region, costEstimator.allocateResourcesAndEstimateCost(region, 1)) // Update the region in the regionDAG to be the new region with resources allocated. replaceVertex(regionDAG, region, newRegion) regionCost
