tspooner / aegir

Strongly-typed, compile-time autodifferentiation in Rust.
MIT License
9 stars 0 forks source link

Call Pruning #2

Closed tspooner closed 1 year ago

tspooner commented 1 year ago

THis PR introduces the concept of a buffer Spec. This type is a kind of "lifted" representation for a buffer B: Buffer that aims to reduces compute/memory overhead. Namely, if B is a homogeneous array, then we can need only know it's shape and one present value to perform our typical operations.

With this in mind, we extend the Function trait to allow users to return a Spec in place of a buffer. This facilitates optimised execution up the tree, by avoiding costly operations when the output is guaranteed to be a special case.