Lightning-AI / Lightning-AI/lightning-thunder

[Profile-Guided Optimization][Feature] Let practitioners specify a trade-off between speed and memory when selecting backends for FX graphs

Open
#2,059 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

profile guided optimization ux
Dominant language
Python
Stars
1.5k
Forks
121
PR merge metrics
No merged PRs in 30d

Description

fyi @kiya00

Currently our profile-guided optimization attempts to pick a backend for each FX graph by looking at speed or memory use. We should consider letting practitioners specify a function of speed and memory to decide on a backend. This would essentially be letting practitioners customize the generic compilation function with a mechanism to select a backend based on the statistics the auto-benchmarking gathered.

A further refinement of this idea is that we should make the backend selection global -- considering all FX graphs at the same time -- and update our default compilation to select the fastest backends s.t. we don't OOM when storing grads for every FX graph.

We should consider these refinements once we have the optimization of FX graphs in isolation with a focus on speed working as expected.

cc @borda

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by locating the profile-guided optimization and FX graph backend-selection entry points, then review how auto-benchmarking statistics currently support speed- or memory-based choices. Clarify the intended speed/memory trade-off API and whether global selection is in scope; done should include a defined selection mechanism that works for isolated FX graph optimization before the proposed global refinement.

Written by the indexing model from the issue text.

Assessment

Tech stack
python, pytorch
Domain
compilers, performance
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.