Contributing
Thank you for your interest in contributing to PMetal!
Getting Started
Section titled “Getting Started”Prerequisites
Section titled “Prerequisites”- Rust 1.85+: Install via rustup
- macOS: PMetal targets Apple Silicon exclusively
- Xcode Command Line Tools:
xcode-select --install - Metal Toolchain:
xcodebuild -downloadComponent MetalToolchain - bun (optional, for GUI):
brew install oven-sh/bun/bun
Development Setup
Section titled “Development Setup”git clone https://github.com/epistates/pmetal.gitcd pmetal
cargo build # Build CLI + TUIcargo test --all # Run testscargo clippy --all -- -D warnings # Lint
# GUI developmentcd crates/pmetal-gui && bun install && bun tauri devHow to Contribute
Section titled “How to Contribute”Reporting Bugs
Section titled “Reporting Bugs”Before reporting, collect:
- macOS version and Apple Silicon chip (M1–M5)
- Rust version (
rustc --version) - Steps to reproduce
- Expected vs actual behavior
- Error messages and stack traces
Pull Requests
Section titled “Pull Requests”- Fork and create a feature branch from
main - Follow the coding guidelines below
- Ensure
cargo test --allpasses - Run
cargo clippy --all -- -D warnings - Run
cargo fmt --all - Update docs for public API changes
- Open a PR with a clear description
Coding Guidelines
Section titled “Coding Guidelines”Rust Style
Section titled “Rust Style”- Follow the Rust API Guidelines
- Use
rustfmt(default config) - Address all
clippywarnings - No
.unwrap()or.expect()in library crates — returnResultwiththiserror - Use descriptive variable names
Testing & Fuzzing
Section titled “Testing & Fuzzing”- Add tests for all new functionality
- Use descriptive names:
test_<function>_<scenario>_<expected> - PMetal enforces continuous fuzzing for data ingest points:
cargo +nightly install cargo-fuzzcargo +nightly fuzz run gguf_reader -- -max_total_time=60Adding a New Model Architecture
Section titled “Adding a New Model Architecture”- Implement
CausalLMModeltrait inpmetal-models - Add config parsing in the appropriate module
- Add architecture detection in
dispatcher.rs - Create LoRA wrapper in
pmetal-loraif applicable - Add tests covering forward pass and generation
- Update the model support tables
Adding a New Metal Kernel
Section titled “Adding a New Metal Kernel”- Create the
.metalshader inpmetal-metal/src/kernels/metal/ - Add Rust bindings in
pmetal-metal/src/kernels/ - Register the kernel in
mod.rs - Add benchmarks if performance-critical
- Document thread group configuration
Project Structure
Section titled “Project Structure”crates/├── pmetal-core/ # Core types, traits, configurations├── pmetal-metal/ # Metal GPU kernels + ANE runtime├── pmetal-mlx/ # MLX backend integration├── pmetal-models/ # LLM architectures├── pmetal-lora/ # LoRA/QLoRA implementations├── pmetal-trainer/ # Training loops (SFT, DPO, GRPO, etc.)├── pmetal-data/ # Dataset processing, chat templates├── pmetal-hub/ # HuggingFace Hub integration├── pmetal-distill/ # Knowledge distillation (incl. TAID)├── pmetal-merge/ # Model merging algorithms├── pmetal-gguf/ # GGUF format with imatrix quantization├── pmetal-mhc/ # Manifold-Constrained Hyper-Connections├── pmetal-distributed/ # Distributed training├── pmetal-vocoder/ # BigVGAN vocoder├── pmetal-serve/ # OpenAI-compatible inference server├── pmetal-py/ # Python bindings (maturin/PyO3)├── pmetal-cli/ # Command-line interface + TUI└── pmetal-gui/ # Desktop GUI (Tauri + Svelte)License
Section titled “License”Contributions are licensed under the same dual MIT/Apache-2.0 license as the project.