operation reordering
**Operation reordering** is the **scheduling transformation that changes execution order of independent operations to improve performance** - reordering can reduce critical-path length, improve memory locality, and lower peak resource pressure.
**What Is Operation reordering?**
- **Definition**: Compiler or runtime rearrangement of semantically independent operations.
- **Goals**: Increase parallelism, reduce stalls, and minimize temporary tensor lifetime overlap.
- **Constraints**: Only legal when data dependencies and side effects are preserved.
- **Effect**: Can improve throughput and memory behavior without altering model outputs.
**Why Operation reordering Matters**
- **Critical Path Reduction**: Prioritizing unlock-heavy operations can shorten overall step time.
- **Memory Peak Control**: Smart ordering avoids simultaneous allocation of large intermediates.
- **Parallelism Exposure**: Independent ops can be moved to increase overlap opportunities.
- **Backend Efficiency**: Reordered graphs may map better to hardware scheduling behavior.
- **Compiler Leverage**: Creates opportunities for further fusion and elimination passes.
**How It Is Used in Practice**
- **Dependency Graphing**: Build precise data dependency graph before applying reorder transformations.
- **Heuristic Selection**: Choose objective such as latency minimization or memory-peak minimization.
- **Validation**: Run numerical checks and benchmark to confirm expected improvement.
Operation reordering is **a high-impact graph scheduling optimization** - legal dependency-aware rearrangement can materially improve runtime and memory efficiency.