diff options
author | Tom Smeding <tom@tomsmeding.com> | 2024-11-08 12:37:51 +0100 |
---|---|---|
committer | Tom Smeding <tom@tomsmeding.com> | 2024-11-08 12:37:51 +0100 |
commit | 83692cf41f76272423445c9cbbad65561ee3b50c (patch) | |
tree | 49f56f498a68722a7302b4ce0b41402a9b9da9ef /src/Simplify.hs | |
parent | 58d4d0b47f5e609e21132f48b727de37d06b6777 (diff) |
WIP custom derivatives
Diffstat (limited to 'src/Simplify.hs')
-rw-r--r-- | src/Simplify.hs | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/Simplify.hs b/src/Simplify.hs index 66a4004..d3ee03c 100644 --- a/src/Simplify.hs +++ b/src/Simplify.hs @@ -121,6 +121,11 @@ simplify' = \case EIdx _ a b -> EIdx ext <$> simplify' a <*> simplify' b EShape _ e -> EShape ext <$> simplify' e EOp _ op e -> EOp ext op <$> simplify' e + ECustom _ s t a b c e1 e2 -> + ECustom ext s t <$> (let ?accumInScope = False in simplify' a) + <*> (let ?accumInScope = False in simplify' b) + <*> (let ?accumInScope = False in simplify' c) + <*> simplify' e1 <*> simplify' e2 EWith e1 e2 -> EWith <$> simplify' e1 <*> (let ?accumInScope = True in simplify' e2) EAccum i e1 e2 e3 -> EAccum i <$> simplify' e1 <*> simplify' e2 <*> simplify' e3 EZero t -> pure $ EZero t @@ -160,6 +165,7 @@ hasAdds = \case ESum1Inner _ e -> hasAdds e EUnit _ e -> hasAdds e EReplicate1Inner _ a b -> hasAdds a || hasAdds b + ECustom _ _ _ a b c d e -> hasAdds a || hasAdds b || hasAdds c || hasAdds d || hasAdds e EConst _ _ _ -> False EIdx0 _ e -> hasAdds e EIdx1 _ a b -> hasAdds a || hasAdds b |