diff --git a/MetaBrush.cabal b/MetaBrush.cabal index daf9a81..5893218 100644 --- a/MetaBrush.cabal +++ b/MetaBrush.cabal @@ -159,15 +159,17 @@ common gtk , gi-gtk >= 4.0.3 && < 4.1 , haskell-gi - >= 0.26 && < 0.27 + >= 0.26.10 && < 0.27 , haskell-gi-base - >= 0.26 && < 0.27 + >= 0.26.10 && < 0.27 -- Workaround for https://github.com/haskell/cabal/issues/4237 -- See https://github.com/commercialhaskell/stack/issues/2197 if flag(gtk-410) pkgconfig-depends: gtk4 >= 4.10 cpp-options: -DMIN_VERSION_GTK_4_10 + else + pkgconfig-depends: gtk4 < 4.10 library metabrushes diff --git a/brush-strokes/brush-strokes.cabal b/brush-strokes/brush-strokes.cabal index f695bea..36703eb 100644 --- a/brush-strokes/brush-strokes.cabal +++ b/brush-strokes/brush-strokes.cabal @@ -199,11 +199,18 @@ library cbits/lp_2d.cpp cxx-options: -std=c++20 - -mavx2 -mfma - -frounding-math -fno-math-errno -fno-signed-zeros - -fno-trapping-math -fno-signaling-nans - -Wno-unused-result -Wsign-compare -Wno-switch - -march=native -mtune=native + -mavx2 + -mfma + -frounding-math + -ffp-contract=off + -fno-math-errno + -fno-signed-zeros + -fno-trapping-math + -Wno-unused-result + -Wno-sign-compare + -Wno-switch + -march=native + -mtune=native -O3 -DNDEBUG build-depends: system-cxx-std-lib diff --git a/brush-strokes/src/lib/Math/Interval/Internal.hs b/brush-strokes/src/lib/Math/Interval/Internal.hs index 026e090..3a81335 100644 --- a/brush-strokes/src/lib/Math/Interval/Internal.hs +++ b/brush-strokes/src/lib/Math/Interval/Internal.hs @@ -131,6 +131,12 @@ instance Transcendental ( 𝕀 Double ) where sin = withHW Prelude.sin atan = withHW Prelude.atan +{- +TODO: consider using https://github.com/JishinMaster/simd_utils/blob/160c50f07e08d2077ae4368f0aed2f10f7173c67/simd_utils_sse_double.h#L530 +for sin/cos? Or Intel SVML? Or metalibm? + +-} + {-# INLINE withHW #-} -- | Internal function: use @rounded-hw@ to define a function on intervals. withHW :: (Interval.Interval a -> Interval.Interval b) -> 𝕀 a -> 𝕀 b diff --git a/brush-strokes/src/lib/Math/Root/Isolation.hs b/brush-strokes/src/lib/Math/Root/Isolation.hs index 70f93a6..16d6b2c 100644 --- a/brush-strokes/src/lib/Math/Root/Isolation.hs +++ b/brush-strokes/src/lib/Math/Root/Isolation.hs @@ -65,6 +65,10 @@ import qualified Data.List.NonEmpty as NE import GHC.TypeNats ( Nat ) +-- parallel +--import Control.Parallel.Strategies +-- ( Strategy, using, parTraversable, rpar ) + -- transformers import Control.Monad.Trans.Writer.CPS ( Writer, runWriter, tell ) @@ -248,10 +252,18 @@ isolateRootsIn ( RootIsolationOptions { rootIsolationAlgorithms } ) -> [ Box n ] -> Writer ( DoneBoxes n ) [ RootIsolationTree ( Box n ) ] recur step r cands = do - rest <- traverse ( \ c -> do { trees <- r c; return [ (c, tree) | tree <- trees ] } ) cands - return [ RootIsolationStep step $ concat rest ] + let rest :: [ ( [ ( Box n, RootIsolationTree ( Box n ) ) ], DoneBoxes n ) ] + rest = + map ( \ c -> runWriter $ do { trees <- r c; return [ (c, tree) | tree <- trees ] } ) cands + ( rest2, dones ) = unzip rest --( rest `using` myParTraversable rpar ) + tell ( mconcat dones ) + return [ RootIsolationStep step $ concat rest2 ] {-# INLINEABLE isolateRootsIn #-} +--myParTraversable :: Strategy a -> Strategy [a] +--myParTraversable _ [] = return [] +--myParTraversable strat (a:as) = (a:) <$> parTraversable strat as + -- | Execute a root isolation strategy, replacing the input box with -- (hopefully smaller) output boxes. doStrategy diff --git a/cabal.project b/cabal.project index 5042c09..38c14c5 100644 --- a/cabal.project +++ b/cabal.project @@ -41,12 +41,6 @@ allow-newer: waargonaut:vector, waargonaut:witherable, --- Fix "ERROR: couldn't find API description for GLib.time_t" -source-repository-package - type: git - location: https://github.com/sheaf/haskell-gi - tag: ec11dd69ab6a3a9f7f7e967f5f7ffa7d9206cd2a - -------------- -- GHC 9.10 -- --------------