Back to Research Index
RFC•
2024-09-28
•Author: Swasthik Shetty•Status: ACCEPTED

RFC 002: Iterative Topological Tape Queue for Reverse-Mode Autograd

Designing a recursion-free execution queue for deep computational graphs

RFC 002: Iterative Topological Tape Queue for Reverse-Mode Autograd

RFC 2024-09-28 Authors: Swasthik Shetty

Abstract: Recursive backpropagation routines are vulnerable to execution stack exhaustion when evaluating very deep computational graphs. We specify an explicit iterative worklist queue based on Kahn topological sorting.

Key Finding: Iterative queue processes arbitrary graph depths with $O(1)$ stack frame consumption.

Architectural Design

The autograd graph is modeled as a Directed Acyclic Graph (DAG) $G = (V, E)$, where vertices $V$ represent operation closures (Node) and edges $E$ represent tensor dependencies.

Worklist Invariants

  1. A node v in V is enqueued for execution if and only if its in-degree deg^-(v) = 0.
  2. Gradient accumulation uses atomic in-place addition into the parent gradient buffer.