This repository has been archived by the owner on Mar 29, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
sim: Refcount signals, only generate temps when refcount > 1
This is to reduce the amount of (unnecessary) bindings in the generated prop fn, as this has been found to have nonlinear time and mem scaling in the rust compiler currently (see rust-lang/rust#79671 and an initial/related workaround in 7c2ff85), and it's been recommended to reduce these. As expected, this appears to be quite effective! A side effect of this is that IR expressions can now have unbounded depth, so lowering those also has to be iterative instead of recursive. I've introduced parens in some cases which may be unnecessary (to avoid the complexity of determining whether or not we actually need them), so we now mark the impl item with an attribute to ignore these. There are a couple cases like Signal::bits which ends up being lowered to a shift and a bitmask in addition to a cast (if necessary). If a user builds a graph with several of these calls on the same Signal, the intermediates between these steps aren't refcounted like normal Signals are (refcounting happens too late for that) - so we won't be able to flatten these to a single temporary. There are a few other such cases as well. I've chosen to simply ignore all of them - they're not practically an issue, and we can always revisit them later if need be (though this will likey require the introduction of yet another IR and perhaps more complex passes such as CSE on it to be effective). Also rename Node -> Frame for the intermediate types used when traversing the graph iteratively, as this less ambiguously describes what these types represent.
- Loading branch information
Showing
7 changed files
with
695 additions
and
602 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.