A comprehensive toolkit for generating PyTorch-Triton code pairs through GitHub repository analysis and synthetic program generation, designed for machine learning model training on code compilation tasks.
Popcorn Kernels combines two powerful approaches to create diverse datasets of PyTorch neural network modules paired with their corresponding Triton GPU kernel implementations:
The toolkit generates datasets where PyTorch eager execution code is paired with optimized Triton kernels produced by PyTorch's Inductor compiler, enabling research into code generation, compilation optimization, and neural architecture understanding.
Scrapes PyTorch repositories from GitHub, extracts neural network modules, and evaluates them with torch.compile to generate PyTorch-Triton code pairs.
Key Features:
Generates synthetic PyTorch programs using language models, creating diverse neural architectures that complement real-world scraped code.
Key Features:
Install dependencies:
uv pip install -r requirements.txt
[Optional] Generate synthetic data:
cd synthetic_torch_modules/
python3 generate_synth_torch.py .parallel num_total_samples=1000
Run the full pipeline (GitHub scraping + evaluation):
cd github_pytorch_index/
./scripts/run_full_pipline.sh --jobs=8 --run-dir=runs/experiment1
<!-- If you did step 2 then run -->
cd github_pytorch_index/
./scripts/run_full_pipline.sh --jobs=8 --run-dir=runs/combined \
--synthetic-data-dir=../synthetic_torch_modules/generated_programs/
The pipeline generates parquet datasets containing:
scrape_dataset.parquet: Real GitHub repository datasynthetic_dataset.parquet: Language model generated programsdataset.parquet: Combined datasetEach entry contains PyTorch source code paired with corresponding Triton kernel implementations generated by torch.compile's Inductor backend.
Note: To reproduce results from the KernelBook dataset, you must use PyTorch 2.5.0. The requirements.txt specifies PyTorch 2.7.1 for security and policy reasons, but you can downgrade if needed for result reproduction:
pip install torch==2.5.0 torchvision torchaudio --index-url https://download.pytorch.org/whl/cu118
See individual project READMEs for detailed development instructions and architecture documentation.
This project builds upon pytorch-jit-paritybench and follows its licensing terms.
Python
84.6%
Shell
10.5%
Jupyter Notebook
4.9%
A comprehensive toolkit for generating PyTorch-Triton code pairs through GitHub repository analysis and synthetic program generation, designed for machine learning model training on code compilation tasks.
Popcorn Kernels combines two powerful approaches to create diverse datasets of PyTorch neural network modules paired with their corresponding Triton GPU kernel implementations:
The toolkit generates datasets where PyTorch eager execution code is paired with optimized Triton kernels produced by PyTorch's Inductor compiler, enabling research into code generation, compilation optimization, and neural architecture understanding.
Scrapes PyTorch repositories from GitHub, extracts neural network modules, and evaluates them with torch.compile to generate PyTorch-Triton code pairs.
Key Features:
Generates synthetic PyTorch programs using language models, creating diverse neural architectures that complement real-world scraped code.
Key Features:
Install dependencies:
uv pip install -r requirements.txt
[Optional] Generate synthetic data:
cd synthetic_torch_modules/
python3 generate_synth_torch.py .parallel num_total_samples=1000
Run the full pipeline (GitHub scraping + evaluation):
cd github_pytorch_index/
./scripts/run_full_pipline.sh --jobs=8 --run-dir=runs/experiment1
<!-- If you did step 2 then run -->
cd github_pytorch_index/
./scripts/run_full_pipline.sh --jobs=8 --run-dir=runs/combined \
--synthetic-data-dir=../synthetic_torch_modules/generated_programs/
The pipeline generates parquet datasets containing:
scrape_dataset.parquet: Real GitHub repository datasynthetic_dataset.parquet: Language model generated programsdataset.parquet: Combined datasetEach entry contains PyTorch source code paired with corresponding Triton kernel implementations generated by torch.compile's Inductor backend.
Note: To reproduce results from the KernelBook dataset, you must use PyTorch 2.5.0. The requirements.txt specifies PyTorch 2.7.1 for security and policy reasons, but you can downgrade if needed for result reproduction:
pip install torch==2.5.0 torchvision torchaudio --index-url https://download.pytorch.org/whl/cu118
See individual project READMEs for detailed development instructions and architecture documentation.
This project builds upon pytorch-jit-paritybench and follows its licensing terms.
Python
84.6%
Shell
10.5%
Jupyter Notebook
4.9%