Currently Enzyme checkpoints every loop carried values and referenced mutable reference. It could be smarter about what to save since in the reverse, we are not interested about the primal result but rather only the pushed values.
Also if a mutable memory is not written to between the primal and reverse steps and dominates primal/reverse locations, then it could be used as is, and not checkpointed.
Currently Enzyme checkpoints every loop carried values and referenced mutable reference. It could be smarter about what to save since in the reverse, we are not interested about the primal result but rather only the pushed values.
Also if a mutable memory is not written to between the primal and reverse steps and dominates primal/reverse locations, then it could be used as is, and not checkpointed.