Skip to content

Commit

Permalink
Use Ints instead of Doubles and print out rank maps.
Browse files Browse the repository at this point in the history
  • Loading branch information
zfnmxt committed Feb 20, 2024
1 parent 7616bcc commit 870f97f
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions src/Language/Futhark/TypeChecker/Rank.hs
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@ import Language.Futhark.TypeChecker.Constraints
import Language.Futhark.TypeChecker.Monad
import System.IO.Unsafe

type LSum = LP.LSum VName Double
type LSum = LP.LSum VName Int

type Constraint = LP.Constraint VName Double
type Constraint = LP.Constraint VName Int

type LinearProg = LP.LinearProg VName Double
type LinearProg = LP.LinearProg VName Int

type ScalarType = ScalarTypeBase SComp NoUniqueness

Expand Down Expand Up @@ -181,7 +181,14 @@ solveRankILP loc prog = do
]
case enumerateRankSols prog of
[] -> typeError loc mempty "Rank ILP cannot be solved."
rs -> pure rs
rs -> do
traceM "## rank maps"
forM (zip [0 :: Int ..] rs) $ \(i, r) ->
traceM $
unlines $
"\n## rank map " <> prettyString i
: map prettyString (M.toList r)
pure rs

rankAnalysis :: (MonadTypeChecker m) => SrcLoc -> [Ct] -> TyVars -> m [([Ct], TyVars)]
rankAnalysis _ [] tyVars = pure [([], tyVars)]
Expand Down

0 comments on commit 870f97f

Please sign in to comment.