$ show krrishnarraj/clpeak
clpeak is a cross-platform synthetic micro-benchmark that measures peak achievable compute performance (FLOPS/TOPS), bandwidth, latency, and AI inference throughput across CPUs, GPUs, and NPUs. It supports eight hardware backends: OpenCL, Vulkan, CUDA, ROCm/HIP, Metal, oneAPI/SYCL, native CPU (with per-ISA dispatch), and ONNX Runtime. The tool is architected as a set of backend-specific static libraries orchestrated by a common framework, with two front-ends: a CLI tool (`clpeak`) and a Flutter desktop/mobile GUI. The GUI communicates with the native library via a C-ABI FFI bridge, streaming structured events for live display. Results are serialized to a versioned JSON schema (v3) and can be compared against baselines. The codebase is notable for its meticulous anti-optimization engineering (MAD chains, compiler barriers, calibration probes) and its protobuf-free ONNX model generator. It is a mature, actively maintained project with extensive CI coverage and packaging for multiple platforms.
The LLM identified 4 files worth highlighting for reuse:
Cross-platform dynamic library loader (dlopen/LoadLibrary) with error handling and symbol resolution. Isolated header with no internal dependencies, reusable in any C++ project needing optional runtime linking.
Hand-written ONNX wire-format model builder that generates synthetic graphs (MatMul, Conv, QDQ, transformer blocks) without requiring protobuf. Demonstrates deep understanding of the ONNX serialization format and enables reproducible benchmark models across platforms.
Compile-time SIMD abstraction layer for f32/f64/i32 with always_inline wrappers, precise division/sqrt via float_control pragma, and support for multiple ISA extensions. Self-contained header that can be extracted for other performance-critical C++ projects.
Unit resolution and SI prefix scaling library with direction (higher/lower better) and auto-scaling. Pure header with no internal dependencies, reusable for any measurement tool that needs human-readable value formatting.