-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Try equality saturation for our simplifcation/vectorization rewriting system #103
Comments
The type-set rewrite rules in our Overleaf document may be a good start, but they don't cover the whole equational theory. |
Feel free to ask me any questions, I think the tutorial post might be a bit confusing at points. |
@alt-romes: thank you. Once a volunteer tackles that, we'd make sure to communicate. Actually, I think we should start with the simplification pass that happens after the transpose pass (AD backprop reverse pass). A this point vectorization is no longer a concern, but fusion and other kinds of simplification are and all transformation are permitted as long as in the end we get tensor code that is faster to execute than what we started with. |
I believe we cannot use |
Perhaps there's a generalization that could be made over the base functor, s.t. hegg accepts a type-indexed AST ? Sounds hard, I haven't seen the type-indexed AST in question (where is it?) |
Here is is: horde-ad/simplified/HordeAd/Core/Ast.hs Line 73 in 4e3eee4
|
@alt-romes here's a test case, if you can support this in data Expr a where
Let :: Expr a -> (Expr a -> Expr b) -> Expr b
LitF :: Double -> Expr Double
LitI :: Int -> Expr Int
ToF :: Expr Int -> Expr Double
Floor :: Expr Double -> Expr Int
Add :: Expr a -> Expr a -> Expr a All the rest is I think reducible to something of this form:
|
I will try branching Eventually I can even try using the more general representation by default and represent the non-indexed base functor through it, but I'll have to see if it is a good thing :) |
What type of rewrite rules would we apply to these expressions? One or two examples would be good, to test in the implementation. |
Here are the rules and here is their implementations (the first half in the first file, the second in the second) https://github.com/Mikolaj/horde-ad/blob/master/simplified/HordeAd/Core/AstVectorize.hs https://github.com/Mikolaj/horde-ad/blob/master/simplified/HordeAd/Core/AstSimplify.hs |
Look only at the ranked variant (types indexed with |
This is the hammer and it may just succeed: https://github.com/alt-romes/hegg
The text was updated successfully, but these errors were encountered: