From 3fd8d35cca2a23c137934a170c67e8ce310edf13 Mon Sep 17 00:00:00 2001 From: Tom Smeding Date: Tue, 29 Apr 2025 15:54:12 +0200 Subject: Complete monoidal accumulator rewrite --- bench/Main.hs | 21 --------------------- 1 file changed, 21 deletions(-) (limited to 'bench') diff --git a/bench/Main.hs b/bench/Main.hs index af83ef7..358ba31 100644 --- a/bench/Main.hs +++ b/bench/Main.hs @@ -12,7 +12,6 @@ module Main where import Control.DeepSeq import Criterion.Main -import Data.Coerce import Data.Int (Int64) import Data.Kind (Constraint) import GHC.Exts (withDict) @@ -38,26 +37,6 @@ gradCHAD config term = simplifyFix $ unMonoid $ simplifyFix $ ELet ext (EConst ext STF64 1.0) $ chad' config knownEnv term -instance KnownTy t => NFData (Value t) where - rnf = \(Value x) -> go (knownTy @t) x - where - go :: STy t' -> Rep t' -> () - go STNil () = () - go (STPair a b) (x, y) = go a x `seq` go b y - go (STEither a _) (Left x) = go a x - go (STEither _ b) (Right y) = go b y - go (STMaybe _) Nothing = () - go (STMaybe t) (Just x) = go t x - go (STArr (_ :: SNat n) (t :: STy t2)) arr = - withDict @(KnownTy t2) t $ rnf (coerce @(Array n (Rep t2)) @(Array n (Value t2)) arr) - go (STScal t) x = case t of - STI32 -> rnf x - STI64 -> rnf x - STF32 -> rnf x - STF64 -> rnf x - STBool -> rnf x - go STAccum{} _ = error "Cannot rnf accumulators" - type AllNFDataRep :: [Ty] -> Constraint type family AllNFDataRep env where AllNFDataRep '[] = () -- cgit v1.2.3-70-g09d2