How siriscent7/gridforge works
GridForge is a C++20 compute runtime for vector addition, with explicit CPU and optional Metal backends. Its main workflow is to create a runtime and buffers, upload inputs, execute an addition, and retrieve and verify the result; its asynchronous API adds streams, events, and cross-stream dependencies. The repository also provides benchmark runs and operation metrics. Runtime internals are shown at the scheduler and backend boundary. Some implementation details are unsampled, so uncertain internal dispatch links are omitted.
Main entry points: gridforge.hpp Public API · runtime.cpp Runtime and buffers · bench_main.cpp Benchmark runner · metal_bridge.hpp Metal interface
Components 14
Runtime API
- Public API
include/gridforge/gridforge.hpp - Runtime and buffers
src/runtime.cpp
Async execution
- Stream scheduler
src/runtime.cpp - Events and results
src/runtime.cpp
Compute backends
- CPU execution
src/runtime.cpp - Metal interface
src/metal_bridge.hpp - Metal implementation
src/metal_bridge.mm - Vector-add shader
shaders/vector_add.metal
Examples and benchmarks
- Synchronous demo
src/main.cpp - Async demo
src/async_main.cpp - Dependency demo
src/dependency_main.cpp - Benchmark runner
src/bench_main.cpp - Benchmark statistics
src/bench_support.hpp
Other components
- Application
Connections 16
- Application → Synchronous demo: runs
src/main.cpp - Application → Async demo: runs
src/async_main.cpp - Application → Dependency demo: runs
src/dependency_main.cpp - Application → Benchmark runner: runs
- Synchronous demo → Public API: uses
src/main.cpp - Async demo → Public API: uses
src/async_main.cpp - Dependency demo → Public API: uses
src/dependency_main.cpp - Benchmark runner → Public API: uses
src/bench_main.cpp - Benchmark runner → Benchmark statistics: computes statistics
src/bench_main.cpp - Public API → Runtime and buffers: implemented by
src/runtime.cpp - Runtime and buffers → Stream scheduler: accepts stream work
src/runtime.cpp - Stream scheduler → Events and results: retires operations
src/runtime.cpp - Stream scheduler → CPU execution: executes work
src/runtime.cpp - Runtime and buffers → Metal interface: uses interface
src/runtime.cpp - Metal interface → Metal implementation: implemented by
- Metal implementation → Vector-add shader: dispatches kernel