Skip to content

Commit

Permalink
constrain xpu boxing's cost (#1288)
Browse files Browse the repository at this point in the history
  • Loading branch information
xhuohai authored Jan 8, 2025
1 parent ae1ef36 commit 64d5095
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions modules/Nncase.Modules.CPU/Evaluator/CPU/Boxing.cs
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,11 @@ public Cost Visit(ICostEvaluateContext context, Boxing target)
{
[CostFactorNames.MemoryStore] = (UInt128)((gatherPart - 1) * (float)CostUtility.GetMemoryAccess(DistributedUtility.GetDividedTensorType(a)) / gatherPart),
};

if (a.Placement.HierarchyKind == HierarchyKind.SMT && (a.NdSBP[1] is SBPPartialSum))
{
cost[CostFactorNames.MemoryStore] *= 8;
}
}

if (scatterPart > 1f)
Expand Down

0 comments on commit 64d5095

Please sign in to comment.