A toolkit for matrix multiplication data collection, model training, and evaluation (library version without PyTorch Inductor auto-registration)
Project description
Warning: code is in pre-Alpha
torch-diode
torch-diode is a library for programattically altering the performance-relevant decisions made by torch.compile. It makes it easy to gather data on the outcomes of decisions, and then train Machine Learning models on that data. It initially focuses on Matmul Kernel selection, but it will be expanded to other decisions in the future. Documentation
Target Audience:
- Developers looking to adapt the compilation of their model to their specific situation.
- Hardware Vendors looking to optimize
torch.compileheuristics for their hardware. - OSS Contributors looking to add support for less popular hardware.
Features:
- Pre-Trained Models: Profit from community efforts to gather data and train models.
- Data collection: Gather data from torch external interfaces.
- Stable Type Definitions: storing data from the external interfaces.
- Model Training Code: Train ML models on the gathered data and contribute back to the
torchcommunity.
Featured Models
- Matrix Multiplication Kernel Prediction: Predict the runtime of matrix multiplication kernels. The results of this model are enabled in
fast-autotune.
Option 1: Installation with Pre-Trained Models
If you want to get access to the pre-trained performance models, as well as the libraries, install torch-diode:
$ pip install torch-diode
And then import torch_diode in python:
import torch_diode
This import has several side-effects, each of which are dependent on the success of the previous step:
- Attempt to import
torch. - Register dummy models to the relevant
torch.compileinterfaces. - For each registration that is successful, it will load the actual model and register it.
- Enable the configs in
torch.compilethat engage the models.
Option 2: Installation without Pre-Trained Models
diode requires nightly pytorch, or pytorch 2.9 or later.
For developers who don't want these side effects, simply installing torch-diode-lib will get access to the library.
$ pip install torch-diode-lib
The import remains the same:
import torch_diode
Option 3: Install from Source
git clone https://github.com/exclamaforte/diode.git
cd diode
pip install .
Model Organization
Directory Structure
Models are organized in a structured directory format:
trained_models/
├── <model_purpose>/
│ ├── <model_name>.pt
│ └── ...
└── <other_model_file>.pt
Example:
trained_models/
├── matmul_kernel_runtime_prediction/
│ ├── v1_model.pt
│ └── v2_model.pt
└── matmul_model_exhaustive.pt
Get Started
The main entry point is in workflows.
Package Variants
- torch-diode: Full package with auto-registration to PyTorch Inductor
- torch-diode-lib: Library-only version without auto-registration
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file torch_diode_lib-0.1.1.tar.gz.
File metadata
- Download URL: torch_diode_lib-0.1.1.tar.gz
- Upload date:
- Size: 89.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.10.18
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c43e715f0e1c2ba8fddbd4feb9d9cde73f88898bb80a0bba686d9e44b2bda977
|
|
| MD5 |
ed3578d11779504be959f006cd05c989
|
|
| BLAKE2b-256 |
29c8ff3e96ca9ced4da947f2068f8a832cb751a3eb5887bc579b0fc2063a5b09
|
File details
Details for the file torch_diode_lib-0.1.1-py3-none-any.whl.
File metadata
- Download URL: torch_diode_lib-0.1.1-py3-none-any.whl
- Upload date:
- Size: 104.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.10.18
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
67c51f9c866d67ebf1b406ffb6429cfa7aa402c823d42f15be7e41348d180ca7
|
|
| MD5 |
f26ddaa3ff88941c6d293f35f8fc0939
|
|
| BLAKE2b-256 |
2ad7a6f101b76d7e524d2e31f7b3855520194cfd95549c16c5df6f5bb650d673
|