From 54a1a863efb0383595d4718916b2134277a9418e Mon Sep 17 00:00:00 2001 From: David van Balen Date: Thu, 16 May 2024 11:04:52 +0200 Subject: [PATCH] move direction constraint from native to shared ilp --- src/Data/Array/Accelerate/Trafo/Partitioning/ILP/Solve.hs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) 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)