Files
zeekay 23d753eaf1 Devices count their launches and command buffers, Metal holds a call's dispatches on one command buffer, CUDA captures a stream of work as a graph that replays as one launch, and a CPU QTensor multiplies into a caller's buffer.
`Device::counts` gives kernel dispatches and command buffers committed (Metal) or kernel and
cuBLAS launches and graph launches (CUDA), so a benchmark reports what a call ran.
`MetalDevice::batch` keeps the current command buffer open across a call whatever
`METAL_COMPUTE_PER_BUFFER` says. `CudaDevice::capture` records the work a closure puts on the
stream as a `Graph`, instantiated to free and reallocate its memory on each launch, so the
tensors the closure returns are written on every replay. `QTensor::matmul_into` runs the tiled
Q8_0 kernels, or a dot per output, into a destination slice with no allocation.
hanzo-metal-kernels 0.11.46, hanzo-ml 0.11.105.

Claude-Session: https://claude.ai/code/session_018Gt5TvrE2rxXuZikWSauv3
2026-09-28 02:53:51 -07:00

96 lines
3.1 KiB
TOML

[package]
name = "hanzo-ml"
version = "0.11.105"
edition = "2021"
description = "Fast multi-backend tensor & ML framework for Rust (CPU/CUDA/Metal/Vulkan/ROCm) with quantization — the compute core of the Hanzo stack."
repository = "https://github.com/hanzoai/ml"
keywords = ["blas", "tensor", "machine-learning"]
categories = ["science"]
license = "BSD-3-Clause OR Apache-2.0"
readme = "README.md"
[dependencies]
accelerate-src = { workspace = true, optional = true }
byteorder = { workspace = true }
hanzo-kernels = { workspace = true, optional = true }
hanzo-metal-kernels = { workspace = true, optional = true }
objc2-metal = { workspace = true, optional = true }
objc2-foundation = { workspace = true, optional = true }
cudarc = { workspace = true, optional = true }
rocm-rs = { workspace = true, optional = true }
hanzo-rocm-kernels = { workspace = true, optional = true }
ash = { version = "0.38", optional = true }
wgpu = { version = "22", optional = true }
pollster = { version = "0.3", optional = true }
cutile = { workspace = true, optional = true }
gemm = { workspace = true }
half = { workspace = true, features = ["zerocopy"] }
float8 = { workspace = true }
intel-mkl-src = { workspace = true, optional = true }
libc = { workspace = true }
libm = { workspace = true }
memmap2 = { workspace = true }
num-traits = { workspace = true }
num_cpus = { workspace = true }
rand = { workspace = true }
rand_distr = { workspace = true }
rayon = { workspace = true }
safetensors = { workspace = true }
thiserror = { workspace = true }
yoke = { workspace = true }
zerocopy = { workspace = true }
zip = { workspace = true }
parking_lot = "0.12.5"
[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
tokenizers = { workspace = true, features = ["fancy-regex"] }
[dev-dependencies]
anyhow = { workspace = true }
clap = { workspace = true }
criterion = { workspace = true }
# Evolutionary autotuner (Space / Evolution / Evaluator). Test-only; `default-features = false` keeps
# cubecl's runtime backends out of the ml test build -- only the schedule-search algebra is used.
hanzo-kernel = { path = "../hanzo-kernel", default-features = false }
[features]
default = []
cuda = ["cudarc", "dep:hanzo-kernels"]
cutile = ["cuda", "dep:cutile"]
cudnn = ["cuda", "cudarc/cudnn"]
nccl = ["cuda", "cudarc/nccl"]
rocm = ["dep:rocm-rs", "dep:hanzo-rocm-kernels"]
# MIOpen-backed conv ops (conv1d/conv2d/conv_transpose1d). Off by default: MIOpen
# ships in the Linux ROCm SDK but NOT the Windows ROCm 7.x SDK. Enable on a ROCm
# install that includes MIOpen to get GPU conv; LLM inference does not need it.
rocm-miopen = ["rocm-rs/miopen"]
vulkan = ["dep:ash"]
wgpu = ["dep:wgpu", "dep:pollster"]
mkl = ["dep:intel-mkl-src"]
accelerate = ["dep:accelerate-src"]
metal = [
"dep:hanzo-metal-kernels",
"dep:objc2-metal",
"dep:objc2-foundation",
]
metal-debug-labels = ["metal", "hanzo-metal-kernels/debug-labels"]
[[bench]]
name = "bench_main"
harness = false
[[example]]
name = "metal_basics"
required-features = ["metal"]
[[example]]
name = "cuda_basics"
required-features = ["cuda"]
[[example]]
name = "cutile"
required-features = ["cutile"]
[lints]
workspace = true