Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
build/
docs/html/
.vscode/
.json
.json
__pycache__/
1 change: 1 addition & 0 deletions BUILD.md
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ These are set with `-D<OPTION>=<ON|OFF>` at the `cmake ..` configure step, e.g.
| `ENABLE_E2E_TESTS` | `ON` | Adds the e2e lit suite (`tests/lit/e2e/`, the `e2e` build target). Set to `OFF` to skip building/copying it, e.g. if `lit` isn't available. |
| `ENABLE_CLANG_TIDY` | `OFF` | Runs `clang-tidy` as part of the normal build (`-warnings-as-errors=*`), using the project's `.clang-tidy` config. Requires `clang-tidy` to be on your `PATH`. |
| `ENABLE_DOCS` | `OFF` | Adds a `doc_doxygen` build target that generates the Doxygen API docs into `docs/html/` (requires Doxygen to be installed). Build it explicitly with `cmake --build . --target doc_doxygen`. |
| `ENABLE_BENCH` | `ON` | Adds the `bench/` subdirectory, building the standalone `reference_bench` binary (naive C++ vs OpenCV timings; no MLIR/picceler runtime dependency). |

### Build type

Expand Down
5 changes: 5 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ option(ENABLE_TESTS "Enable testing" ON)
option(ENABLE_E2E_TESTS "Enable end-to-end (compile-and-run) tests" ON)
option(ENABLE_CLANG_TIDY "Enable clang-tidy" OFF)
option(ENABLE_DOCS "Enable documentation generation" OFF)
option(ENABLE_BENCH "Enable the reference_bench benchmark target" ON)

set(CMAKE_EXPORT_COMPILE_COMMANDS ON CACHE BOOL "Generate compile_commands.json" FORCE)

Expand Down Expand Up @@ -92,6 +93,10 @@ if (ENABLE_TESTS)
add_subdirectory(tests)
endif()

if (ENABLE_BENCH)
add_subdirectory(bench)
endif()




14 changes: 14 additions & 0 deletions bench/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
find_package(OpenCV REQUIRED)

add_executable(reference_bench
reference_bench.cpp
)

target_link_libraries(reference_bench PRIVATE
${OpenCV_LIBS}
CLI11::CLI11
)

set_target_properties(reference_bench PROPERTIES
RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}"
)
15 changes: 15 additions & 0 deletions bench/RESULTS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Benchmark Results

- Date: 2026-09-06
- CPU: Intel(R) Core(TM) i5-14600KF
- Image: `bench.jpg` (1092344 bytes)
- Iterations: 50

Generated locally by `bench/run_bench.py`, not in CI -- see bench/reference_bench.cpp for the naive/OpenCV implementations and bench/pic/ for the picceler programs.

| operation | picceler | naive C++ | OpenCV |
| --- | --- | --- | --- |
| invert | 18.4 ms | 6.8 ms | 4.9 ms |
| brightness(+30) | 18.1 ms | 8.0 ms | 5.3 ms |
| gaussian_blur(r=6) | 1415.7 ms | 1051.5 ms | 12.3 ms |
| sharpen(3x3) | 93.4 ms | 79.4 ms | 15.4 ms |
10 changes: 10 additions & 0 deletions bench/pic/bench_brightness.pic
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
def main() -> int64 {
image img = load_image("img/bench.jpg")

for (i = 0 .. 50) {
image out = brightness(img, 30)
save_image(out, "bench_brightness_out.png")
}

return 0
}
10 changes: 10 additions & 0 deletions bench/pic/bench_gaussian_blur.pic
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
def main() -> int64 {
image img = load_image("img/bench.jpg")

for (i = 0 .. 50) {
image out = gaussian_blur(img, 6)
save_image(out, "bench_gaussian_blur_out.png")
}

return 0
}
10 changes: 10 additions & 0 deletions bench/pic/bench_invert.pic
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
def main() -> int64 {
image img = load_image("img/bench.jpg")

for (i = 0 .. 50) {
image out = invert(img)
save_image(out, "bench_invert_out.png")
}

return 0
}
10 changes: 10 additions & 0 deletions bench/pic/bench_sharpen.pic
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
def main() -> int64 {
image img = load_image("img/bench.jpg")

for (i = 0 .. 50) {
image out = sharpen(img, 40)
save_image(out, "bench_sharpen_out.png")
}

return 0
}
Loading
Loading