Add data-loading bottleneck diagnostic skill - #6466
Conversation
Signed-off-by: Rostan Tabet <rtabet@nvidia.com>
|
| Filename | Overview |
|---|---|
| skills/data-loading-bottleneck/SKILL.md | Defines the end-to-end diagnostic routing, equivalence requirements, verdict thresholds, and reporting contract. |
| skills/data-loading-bottleneck/references/profiling.md | Documents production-path NVTX instrumentation, Nsight capture validation, and evidence requirements for localization. |
| skills/data-loading-bottleneck/references/pytorch-dali.md | Documents bounded LoaderEvaluator construction and Real/Replay work-equivalence checks. |
| skills/data-loading-bottleneck/scripts/collect_preflight.py | Collects workload, environment, GPU, dependency, filesystem, and Git readiness into a preflight artifact. |
| skills/data-loading-bottleneck/scripts/summarize_nsys.py | Exports and summarizes the selected NVTX window, CUDA activity, worker coverage, and loader-wait overlap. |
| skills/data-loading-bottleneck/evals/evals.json | Defines representative input-bound, compute-bound, and inference scenarios for evaluating skill behavior. |
Flowchart
%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[Preflight workload and environment] --> B{Workload runnable?}
B -- No --> I[Report INCONCLUSIVE]
B -- Yes --> C[Run bounded Real workload]
C --> D{LoaderEvaluator available?}
D -- Yes --> E[Run equivalent Replay]
E --> F{Replay speedup}
F -- <= 1.10x --> N[Report NOT DETECTED]
F -- > 1.10x --> P[Profile production path]
D -- No --> P
P --> G{Validated input-path delay?}
G -- Yes --> H[Report DETECTED or POTENTIAL and localize]
G -- No --> I
Reviews (3): Last reviewed commit: "Add eval suite for data-loading bottlene..." | Re-trigger Greptile
|
/nvskills-ci |
Signed-off-by: Rostan Tabet <rtabet@nvidia.com>
Signed-off-by: Rostan Tabet <rtabet@nvidia.com>
|
/nvskills-ci |
| @@ -0,0 +1,225 @@ | |||
| --- | |||
| name: data-loading-bottleneck | |||
| description: "Diagnose input-bound PyTorch training. Use for low or bursty GPU utilization, slow batches, num_workers tuning, preprocessing regressions, or input stalls. Not for model/kernel optimization." | |||
There was a problem hiding this comment.
Is this useful only for only pyTorch based training?
There was a problem hiding this comment.
Partly, yes. The LoaderEvaluator tool assumes PyTorch's DataLoader. Most of the guidance was written with PyTorch in mind although a lot of it is library-agnostic.
I'd need to test with other frameworks to identify possible gaps and I'd rather leave it for a future version.
| - python | ||
| team: dali | ||
| domain: deep-learning | ||
| version: "1.0.0" |
There was a problem hiding this comment.
Is the intent to update version number manually? Can it re-use DALI versioning ?
There was a problem hiding this comment.
Since skills are distributed independently from DALI (consumed by NVIDIA/skills), I wouldn't be sure what version to use here. Should it be 2.3.0 or the current version in VERSION 2.4.0dev? Do we open a PR to update the skill versions each time we update DALI?
|
|
||
| ### 1. Preflight and route | ||
|
|
||
| Create an artifact directory for commands and raw output, then run preflight with the |
There was a problem hiding this comment.
The skill assumes that the platform that we run the preflight is configured so that it can run training.
Would it be possible to extend it to create virtual environment and execute pip install -f requiremnets.txt if such file exist?
There was a problem hiding this comment.
I think it's generally safe to assume that somebody interested in evaluating if training performance is bottlenecked by data loading has a working environment. We want to use this environment with the exact pinned library versions they are using. Those might not be the same as a potential requirements.txt file or it might not tell the full picture because it's not uncommon for projects to have other files like requirements.dev.txt.
Additionally, supporting requirements.txt only would be incomplete, pyproject.toml is also often used (with e.g. uv or poetry), some projects have a conda configuration instead, others rely on Docker containers, etc.
| - CUDA 13.x: `nvidia-dali-cuda130` | ||
| - Other or unknown: record the unsupported runtime and skip replay. | ||
|
|
||
| ```bash |
There was a problem hiding this comment.
Wouldn't it be better to create a venv?
There was a problem hiding this comment.
We want to reuse the user's env if it exist and not add a new library that they didn't request in it. pip install --target allows installing a library in a custom location for temporary use and the user doesn't have to even know about it.
| | Real | [value, invalid, or unavailable] | [value, invalid, or unavailable] | [value and percent, invalid, or unavailable] | | ||
| | Replay | [value, invalid, or unavailable] | [value, invalid, or unavailable] | [value and percent, invalid, or unavailable] | | ||
|
|
||
| **Result:** [Measured speedup, wait-only prediction from Real, their difference, and threshold |
There was a problem hiding this comment.
Would it be possible to add a graph (run a python script), that would show how much improvement we get for specific batch sizes and number or workers?
There was a problem hiding this comment.
Initially, the skill had instructions to explore solutions for detected issues (like changing the number of workers). It ended up increasing the (already long) time needed to run the skill because the agent could also need to handle OOMs created by increasing the number of workers, etc.
I preferred keeping it focused on identification and attribution, with suggestions that users can try (or ask the agent to try) if they want to.
| | Script | Purpose | Arguments | | ||
| |---|---|---| | ||
| | `scripts/collect_preflight.py` | Record environment, source, data, and optional-tool readiness in `preflight.json` | `--source-dir`, `--artifact-dir`, one of `--data-path` or `--data-source`; optional `--expected-visible-gpus` | | ||
| | `scripts/summarize_nsys.py` | Summarize the measured NVTX window, CUDA activity, and loader-wait/GPU-idle overlap | input `.nsys-rep` and required `--output` JSON path | |
There was a problem hiding this comment.
I guess this could be a skill, but I understand that we need 100% reproducibility, correct?
There was a problem hiding this comment.
The reason for having a script here is that I found that less capable models could have a hard time properly summarizing, even when given proper instructions. This would also consume a lot of unnecessary tokens, especially when agents would loop over failures such as trying why there SQL queries with joins over four tables didn't work the first time.
Category:
Other (e.g. Documentation, Tests, Configuration)
Description:
Create a skill allowing agent to detect and localize data loading bottlenecks in PyTorch training.
The workflow roughly contains two important phases:
LoaderEvaluatorThe complete workflow is more complex and looks as follows:
LoaderEvaluatoris or can be made importable , continue to 3. Else, go to 4.LoaderEvaluator's replay mode. Establish if there's a measured bottleneck. If we this steps provdes that there's no bottleneck, go to 5. Otherwise, continue to 4. to localize.This was tested on multiple models, with different environment requirements, including simple ResNet50, OpenCLIP, LeWorldModel, and Hugging Face timm.
In terms of the model used by the agent, I found that GPT 5.6 Terra or equivalent is a sound minimum requirement to run this reliably, although it can sometimes fail to accurately follow all instructions, like the shape of the report.
I unfortunately couldn't commit evaluations as the skill CI doesn't support GPU environments.
Additional information:
Affected modules and functionalities:
Skill created.
Key points relevant for the review:
Note that if you run locally, depending on the workload, it may take time to complete.
Tests:
Skill CI doesn't support GPU workers yet
Checklist
Documentation
DALI team only
Requirements
REQ IDs: N/A
JIRA TASK: DALI-4796