[package] name = "jouleclaw-loader-gguf" version.workspace = true edition.workspace = true authors.workspace = true license.workspace = true repository.workspace = true description = "GGUF model loader for JouleClaw. F32, F16, Q4_0, Q5_K, Q8_0 quants. mmap-zero-copy load path. Includes per-model decode (gemma, gemma4, llama). Ported from pattern-lang/joule-loader-gguf." [dependencies] jouleclaw-fabric = { path = "../jouleclaw-fabric", optional = true } jouleclaw-backend-apple = { path = "../jouleclaw-backend-apple", optional = true } jouleclaw-energy = { path = "../jouleclaw-energy", optional = true, features = ["ioreport"] } jouleclaw-core = { path = "../jouleclaw-core" } regex = "1" fancy-regex = "0.20" # HF tokenizer split patterns use lookahead (\s+(?!\S)) serde = { workspace = true } serde_json = { workspace = true } quick-xml = { workspace = true } memmap2 = "0.9" thiserror = { workspace = true } metal = { version = "0.33", optional = true } rayon = { version = "1", optional = true } # Seal the energy-autotuner's tuning profile as an autotune/1 JCR-1 receipt # (the `attest` feature) — reuses jouleclaw's own COSE_Sign1 envelope. jouleclaw-jcr1 = { path = "../jouleclaw-jcr1", optional = true } ed25519-dalek = { workspace = true, optional = true } [features] # Heterogeneous-compute placement: route batch-shaped matmuls # through jouleclaw-fabric (AMX/Accelerate on Apple Silicon). fabric = ["dep:jouleclaw-fabric", "dep:jouleclaw-backend-apple"] # Fabric + the IOReport energy meter: enables the # fabric_calibrate example that turns seeded placement # tables into THIS machine's measured figures. fabric-meter = ["fabric", "dep:jouleclaw-energy"] # Seal a tuning profile as an autotune/1 JCR-1 receipt (COSE_Sign1 / Ed25519). attest = ["dep:jouleclaw-jcr1", "dep:ed25519-dalek"] default = [] # Direct Metal-buffer overlay over mmap'd GGUF regions. Only # meaningful on Apple Silicon (UMA — the page cache IS the # GPU's working set; zero CPU→GPU copy). Pulls in metal = 0.33 # transitively. Build flag, not a runtime switch. metal = ["dep:metal"] # io_uring async prefetch on Linux 5.1+. Replaces best-effort # madvise WILLNEED with explicit async READ submissions + # completion queue polling. Deterministic completion; # measurable latency. Linux-only; no-ops on other targets. io_uring = ["dep:io-uring"] # CUDA UVA overlay — registers mmap'd pages with the CUDA # driver via cudaHostRegister so the device can read host # pages over PCIe without an explicit cudaMemcpy. Discrete- # GPU equivalent of the Metal feature. Runtime-loaded via # libloading; no CUDA toolkit needed at build time. Linux + # Windows where the CUDA driver is installed; no-ops # otherwise. cuda = ["dep:libloading"] # NUMA-aware allocation on Linux. Runtime-loaded libnuma.so.1 # via libloading; multi-socket inference servers can place # weights on the right node + bind compute threads. numa = ["dep:libloading"] # Apple Accelerate / cblas_sgemm — uses AMX (Apple's matrix # accelerator) on M-series chips. Routes f32 matmul through # Accelerate.framework instead of the scalar / NEON path. # macOS aarch64 only; no-op cfg-gated stub elsewhere. accelerate = [] # Multi-thread fan-out via rayon. Adds parallel matmul # variants that split work across CPU cores. Useful for # batched inference (m ≥ 2) + n-wide single-token decode. rayon = ["dep:rayon"] [target.'cfg(any(target_os = "linux", target_os = "windows"))'.dependencies] libloading = { version = "0.9", optional = true } [target.'cfg(target_os = "linux")'.dependencies] io-uring = { version = "0.7", optional = true } [dev-dependencies] criterion = { version = "0.8", default-features = false, features = ["plotters", "cargo_bench_support"] } [[bench]] name = "matmul_q8_0" harness = false [[bench]] name = "matmul_q4_k" harness = false [[bench]] name = "matmul_q56_k" harness = false [[bench]] name = "attention" harness = false [[bench]] name = "mmap_strategy" harness = false [[bench]] name = "tier_store" harness = false # Energy-metered examples link the optional jouleclaw-energy # crate, which only exists under `fabric-meter`. Gate them so a # plain `--features "rayon fabric"` (or default) build does not # try to compile them and fail on the unlinked crate. [[example]] name = "fabric_calibrate" required-features = ["fabric-meter"] [[example]] name = "mpp_energy" required-features = ["fabric-meter"] [[example]] name = "energy_autotune" required-features = ["fabric-meter"] [target.'cfg(unix)'.dependencies] libc = "0.2" [target.'cfg(windows)'.dependencies] windows-sys = { version = "0.61", features = [ "Win32_System_Memory", "Win32_Foundation", "Win32_System_Threading", ] }