Skip to content

Batch arena records for reverse-mode matrix arithmetic #3391

Description

@sims1253

I've been working on the allocation and registration cost of scalar autodiff records produced by Matrix<var> arithmetic. The idea is to allocate output records together and register one span, while keeping the existing expression interface.

The PR on my Math fork covers addition, subtraction, division, elementwise multiplication, and matrix multiplication. It also updates adjoint reset, nested recovery, and profiling to account for the spans.

An earlier hier_2pl benchmark showed 5–7% less wall time and 17.8% fewer whole-run instructions. The current version passes 39 focused tests, including nested memory lifetimes, repeated gradients, empty matrices, and mixed storage orders.

Would this approach be worth bringing upstream? I could start with the allocation/lifecycle support and one operation if you'd prefer a smaller first PR.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions