PerfForge
Find slow PyTorch code before it burns GPU hours.
PerfForge is a small rule-based CLI for detecting common PyTorch performance anti-patterns before expensive training runs, CI jobs, or experiments start.
Package note: the PyPI name
hotpathis used by an unrelated project. This project publishes ashotpath-ai, while the command remainshotpath.
Why HotPath
GPU profilers are powerful, but they often show you traces after money has already been spent. HotPath catches common PyTorch performance mistakes before long training runs, CI jobs, or expensive experiments start.
Use it when you want to spot:
- CPU/GPU synchronization traps like
.item()in hot loops - slow input pipelines from underconfigured
DataLoaders - blocking device transfers
- missing mixed precision or
torch.compile - checkpointing and conversion work inside training loops
Quick Start
python -m hotpath analyze examples/slow_training.py
Install from PyPI:
pip install hotpath-ai
hotpath analyze examples/slow_training.py
Or after installing locally from this repo:
pip install -e .
hotpath analyze examples/slow_training.py
Scan a whole project:
hotpath analyze path/to/project
Emit JSON for CI, scripts, or a future dashboard:
hotpath analyze path/to/project --format json
Fail CI when warnings are present:
hotpath analyze path/to/project --fail-on warning
Current Checks
DataLoaderwithnum_workers=0or nonum_workersDataLoadermissingpin_memory=True.item()inside loops, which can force GPU synchronization.cpu(),.cuda(), or.to(...)calls inside loops- CPU tensor creation inside loops without a
device=... - manual attention patterns that may be replaced with
torch.nn.functional.scaled_dot_product_attention - training scripts that never call
torch.compile - training scripts that appear to use full precision without autocast
- Python loops over tensors or batches that may block vectorization
optimizer.zero_grad()missingset_to_none=Truetorch.cuda.empty_cache()inside hot loops- evaluation code that calls
eval()withoutno_grad()orinference_mode() torch.tensor(existing_value)copiesDataLoaderworkers missingpersistent_workers=True- loop transfers missing
non_blocking=True torch.save(...)inside hot loops.numpy()conversion inside hot loops
Example Output
[WARNING] KP003 line 31: .item() inside loop can synchronize the GPU
Accumulate tensors on-device and call .item() only for occasional logging.
[INFO] KP010 line 29: zero_grad missing set_to_none=True
Try optimizer.zero_grad(set_to_none=True).
GitHub Topics
Recommended repository topics:
pytorch, cuda, gpu, gpu-optimization, performance, profiling,
static-analysis, linting, machine-learning, deep-learning, mlops,
ai-tools, developer-tools, training, torch, triton
Philosophy
HotPath is intentionally not a magic kernel generator yet. The first product is the GPU performance linter experts wish existed: clear detections, plain-English explanations, and copy-pasteable fixes.
PyPI Name
The installable package name is hotpath-ai because hotpath is already used
by an unrelated PyPI project. The Python import package and command-line entry
point are still hotpath:
pip install hotpath-ai
hotpath analyze path/to/project
Roadmap
See PRODUCT_PLAN.md.
Metadata
Release files for hotpath-ai 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| hotpath_ai-0.1.0.tar.gz | 16.6 kB | Without provenance | Details for hotpath_ai-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| hotpath_ai-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for hotpath_ai-0.1.0-py3-none-any.whl |
Total release size: 31.6 kB
Release files / hotpath_ai-0.1.0.tar.gz
| Download URL | hotpath_ai-0.1.0.tar.gz |
|---|---|
| Size | 16.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
96af9315eeba5629ba0cb5fc2b747e6df07a09ba72c0f62345b228c4f760fb17
|
|
BLAKE2b-256 checksum How to use checksums |
1e3ab3494059501961c7f39a646c0e546abe0335183a36796a728aeba379fee2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.5
|
Release files / hotpath_ai-0.1.0-py3-none-any.whl
| Download URL | hotpath_ai-0.1.0-py3-none-any.whl |
|---|---|
| Size | 15.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
9c9e88097ffc7282f47dac307b3d4111bf6938aaeda39c6ebd28acfb122e3f32
|
|
BLAKE2b-256 checksum How to use checksums |
df89a0b9089f0fec15152ec8f3422f75643fc62bf9c9a693a79b15dbdb59e541
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.5
|
Security for hotpath-ai 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.