meta-pytorch / meta-pytorch/data
[RFC] Performance Profiling Tools
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 1.3k
- Forks
- 179
- Avg merge
- 6d 1h
- Merged PRs (30d)
- 2
Description
🚀 The feature
-
Store usage statistics in
Prefetcher- By tracking statistics within
Prefetcher, we can reasonably determine whether upstream processes or downstream processes are faster. For example, the emptiness of the buffer queue may imply consumers are faster than producers. Users can insert this into various points in the pipeline to examine various behaviors. A common pattern we expect is to examine whether the pipeline is IO bound or compute bound. - #1141
- By tracking statistics within
-
DataLoader2main processtorchprofilers (e.g.torch.profiler.profile) currently work withDataLoader2, however, it only tracks functions and DataPipes that are executed within the main process. Nonetheless, we should validate that the information is helpful if most of the computations take place within the main process (e.g. usingInProcessReadingServiceor dispatching process.- After 1 is completed, we can add APIs to
DataLoader2to fetch the relevant statistics fromPrefetcher's buffer, such as the one that exists at the end of the main loop. It should allow users to examine whether the model is consuming faster than the preparation of samples. - PR pending
- Tutorial pending
-
DataLoader2worker process profiling- Two main options under considerations are:
- Attaching the profiler to worker process in order to get worker level metrics/trace. This will allow us to use existing profilers without re-implementing their features.
MultiprocessingReadingServicecan provide methods to retrieve and aggregate metrics from certain DataPipes (mainlyPrefetcher)
- Two main options under considerations are:
-
Integration with other tools (e.g. tracers)
- We will likely want main and worker processes' to be visible within tracers (e.g. useful when integrated with TorchTNT).
Motivation, pitch
This set of tools and features aim to answer the questions:
- Is my model training bottlenecked by data loading?
- If so, which part of the pipeline? IO? Compute?
Alternatives
No response
Additional context
Comments and suggestions are welcomed.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reading the Prefetcher and DataLoader2 entry points, including InProcessReadingService and MultiprocessingReadingService, then review how torch.profiler.profile currently observes the main process. The RFC is complete only when the profiling scope, worker-process metrics, aggregation APIs, and tracer integration have concrete designs and validation plans.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- data, performance
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 20/100