-
Notifications
You must be signed in to change notification settings - Fork 86
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
Make cutsets smaller in DataLang #1042
Comments
As an addon here, the bvi-to-data compilation sometimes produces a sub-optimal sequence when computing CBV arguments to functions. For example, this tail call:
becomes:
Notice that the constants stored in variables 1,2, 3 are unnecessarily stored into cutsets, when they should really be computed much later. After some discussion with @myreen , we should at least try to do constant propagation before Another related optimization is to modify the order in which arguments are computed in |
@tanyongkiam noticed that cutsets are sometimes too large.
For example, the explorer output reveals:
Here 4 and 5 are in the cutset (
{4,5}
) only because they are used as arguments toMult
. Ideally, the cutset should be empty because 4 and 5 are not used afterMult
.The reason they are in the cutset can be seen in the semantics of DataLang, here:
cakeml/compiler/backend/semantics/dataSemScript.sml
Lines 1146 to 1153 in 48a421d
This needs to be corrected so that the arguments are read (
get_vars
) before the cutset is applied (cut_state_opt
). With this changedata_live
can make the cutsets smaller. Thedata_to_word
proofs need updating.The text was updated successfully, but these errors were encountered: