diff --git a/src/Data/Array/Accelerate/Trafo/Partitioning/ILP/Solve.hs b/src/Data/Array/Accelerate/Trafo/Partitioning/ILP/Solve.hs index ea6493295..cd5e6f221 100644 --- a/src/Data/Array/Accelerate/Trafo/Partitioning/ILP/Solve.hs +++ b/src/Data/Array/Accelerate/Trafo/Partitioning/ILP/Solve.hs @@ -162,7 +162,7 @@ makeILP obj (Info - myConstraints = acyclic <> infusible <> manifestC <> numberOfClustersConstraint <> readConstraints <> finalize (S.toList nodes) + myConstraints = acyclic <> infusible <> manifestC <> numberOfClustersConstraint <> readConstraints <> inputConstraints <> finalize (S.toList nodes) -- x_ij <= pi_j - pi_i <= n*x_ij for all edges acyclic = foldMap @@ -181,6 +181,11 @@ makeILP obj (Info (\(i :-> j) -> notB (fused i j) `impliesB` manifest i) edges + + inputConstraints = flip foldMap fuseEdges $ \(lIn :-> l) -> + timesN (fused lIn l) .>=. c (InDir l) .-. c (OutDir lIn) + <> (-1) .*. timesN (fused lIn l) .<=. c (InDir l) .-. c (OutDir lIn) + myBounds :: Bounds op -- 0 <= pi_i <= n myBounds = foldMap (\i -> lowerUpper 0 (Pi i) n)