Skip to content
umbraccatPublic

About

Measurement, profiling, and cross-engine optimization harness for 17 deep learning inference engines on embedded edge devices (Jetson Orin NX, RK3588).

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

1 Commit

Folders and files

Repository files navigation

edgebench

Measurement, profiling, and cross-engine optimization harness for deep learning inference engines on embedded edge boards (NVIDIA Jetson Orin NX, Orange Pi 5 Plus / Rockchip RK3588).

Each job evaluates one workload family × engine × backend × precision configuration in an isolated subprocess under a fixed clock/fan policy, verifying output fidelity against a shared PyTorch FP32 CPU reference and combining phase timestamps (CLOCK_MONOTONIC) with sysfs, cgroup/driver memory, and power telemetry into record.json.

Methodology overview: docs/PROTOCOL.md.

Repository Layout

src/edgebench/
  __main__.py          python -m edgebench SPEC.json OUT_DIR (dispatches on spec["family"])
  core.py              Events (CLOCK_MONOTONIC phase marks), timed_loop, summarize, job.json writer
  comparison.py        Comparability tier classification (strict_runtime / matched_scheme / best_deployment)
  fidelity.py          Accuracy & agreement verification against shared PyTorch FP32 references
  references.py        Generate reference outputs (python -m edgebench.references)
  models.py            Canonical model construction and preprocessing conventions
  config.py            Board directory, SSH target helpers, PYTHONPATH management
  families/            Vision (classification & segmentation) and LLM runners
  jobs/                Whisper (ASR), Granite TTM-R2 (time-series), Qwen3.5 VLM, peak-memory probes
  adapters/            Adapters for 17 inference engines (ORT, TRT, PyTorch, HF, llama.cpp, MNN,
                       MNN-LLM, ncnn, LiteRT, LiteRT-LM, ExecuTorch, ExecuTorch LLM, MLC-LLM,
                       OpenVINO, RKNN, RKLLM, whisper.cpp)
  runners/             C++ in-process runners driven over stdin/stdout
  prepare/             Model conversion, quantization, and artifact registries
  matrix/
    blocks.py          Study-block matrix generator (python -m edgebench.matrix.blocks OUT [rk3588])
    run.py             Board-side orchestrator: cooldown → telemetry → job → record.json
    policy.py          Fixed-clock / fan / swap / service policy with automatic restore on exit
    platform_cfg.py    Board sensor paths and frequency ceilings
    run_blocks.sh      Board entrypoint running blocks within one policy session
    stage.py           Host-side staging driver: stage large models per group, run, clean up
  telemetry/           monitor (50 ms sysfs), membw_sampler, memx (cgroup + driver memory),
                       km003c_logger / km003c_energy (external USB-C power meter)
  analysis/            Summary tables, variance, roofline, and paper figure generation (`analysis/paper/`)
optimization/          Cross-engine Arm FP16 Winograd & persistent pack8 residual-block prototype for ExecuTorch
schemas/               JSON schema for benchmark records (results.schema.json)
probes/                Auxiliary mobile/RKNN memory probes
tests/                 Unit tests (pytest)

Quick Start

# Install package and analysis dependencies (engine runtimes are imported lazily per board venv)
python -m venv .venv && .venv/bin/pip install -e '.[dev,vision,analysis]'
.venv/bin/pytest

Typical End-to-End Workflow

export PYTHONPATH=$PWD/src
ST=/path/to/stage               # Host staging directory: models/, data/, matrix-<board>/

# 1. Prepare canonical artifacts and FP32 references
python -m edgebench.prepare.onnx_variants --root "$ST"
python -m edgebench.references --root "$ST" --llm qwen2.5-1.5b

# 2. Sync harness and base data to target board
export EDGE_BOARD_HOST=user@board-host
SSHPASS=… python -m edgebench.matrix.stage --board rk3588 --stage "$ST" --sync-base

# 3. Run study blocks under fixed-clock policy
SSHPASS=… python -m edgebench.matrix.stage --board rk3588 --stage "$ST" \
    --run-id rk3588-eng-s1 --blocks eng_vision,eng_llm --shuffle-seed 1

# 4. Aggregate results and regenerate paper figures
python -m edgebench.analysis.analyze RESULTS_DIR --out OUT_PREFIX
python -m edgebench.analysis.paper --stage "$ST" --paper /path/to/paper

Environment Variables

Variable Used by Description
EDGE_BOARD_HOST matrix.stage SSH target (user@host) overriding config.BOARDS
EDGEBENCH_BOARD_DIR config, shell scripts Board workspace directory under $HOME (default edgeinfer-matrix)
EDGEBENCH_STAGE analysis.paper Stage directory containing raw runs and extracted CSVs
EDGEBENCH_PAPER analysis.paper Output directory for paper figures (figures/) and tables (tables/)
EDGEINFER_PLATFORM platform_cfg Override board auto-detection (jetson or rk3588)
SSHPASS / SUDO_PASS matrix.stage, policy Optional password for sshpass / sudo clock-pinning (omit with passwordless SSH/sudo)
EDGEBENCH_CPP_RUNNERS adapters Path to compiled C++ runners when using external runner builds

Building C++ Runners

The in-process C++ runners in src/edgebench/runners/ compile directly against each board's native engine build. For example, building llama_runner:

g++ -O2 -std=c++17 src/edgebench/runners/llama_runner.cpp \
    -I"$LLAMA_SRC/include" -I"$LLAMA_SRC/ggml/include" -Isrc/edgebench/runners \
    -L"$LLAMA_BIN" -lllama -Wl,--enable-new-dtags,-rpath,"$LLAMA_BIN" \
    -o "$LLAMA_BIN/llama_runner"

See optimization/README.md for build instructions for the ExecuTorch cross-engine Winograd prototype.

License

Released under the MIT License.

About

Measurement, profiling, and cross-engine optimization harness for 17 deep learning inference engines on embedded edge devices (Jetson Orin NX, RK3588).

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages