Skip to content

Commit

Permalink
move direction constraint from native to shared ilp
Browse files Browse the repository at this point in the history
  • Loading branch information
dpvanbalen committed May 16, 2024
1 parent 5b70e87 commit 54a1a86
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/Data/Array/Accelerate/Trafo/Partitioning/ILP/Solve.hs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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)
Expand Down

0 comments on commit 54a1a86

Please sign in to comment.