|
| 1 | +# rustVX Samples |
| 2 | + |
| 3 | +This directory contains example applications demonstrating OpenVX features implemented in rustVX. |
| 4 | + |
| 5 | +## Available Samples |
| 6 | + |
| 7 | +### `pipelining_multicore/` — OpenVX Pipelining Extension Demos |
| 8 | + |
| 9 | +Demonstrates wave-based parallel execution using the OpenVX Pipelining extension on multicore CPUs. |
| 10 | + |
| 11 | +| Sample | Description | |
| 12 | +|--------|-------------| |
| 13 | +| **`pipelining_multicore.c`** | Basic 4-branch parallel filter (Gaussian, Box, Dilate, Erode). Shows wave scheduling. | |
| 14 | +| **`benchmark_pipelining.c`** | **Head-to-head throughput benchmark** — runs the same graph with `vxProcessGraph` (sequential) vs `QUEUE_AUTO` (pipelined). Prints FPS and speedup ratio. | |
| 15 | +| **`multiscale_feature_extraction.c`** | **Real-world CV pipeline** — multi-scale edge detection (Sobel + Magnitude at 3 scales), fusion via OR. Inspired by YOLO/SSD preprocessing. | |
| 16 | + |
| 17 | +### Performance (measured on 4-core Ubuntu 22.04) |
| 18 | + |
| 19 | +| Sample | Non-Pipelining | Pipelining (auto) | Pipelining (4 threads) | Speedup | |
| 20 | +|--------|---------------|-------------------|------------------------|---------| |
| 21 | +| Basic 3-filter | 195 FPS | 357 FPS | 408 FPS | **~2.1x** | |
| 22 | +| Multi-scale feature extraction | 19.7 FPS | 41.8 FPS | **46.7 FPS** | **~2.2x** | |
| 23 | + |
| 24 | +### Environment Variables |
| 25 | + |
| 26 | +| Variable | Values | Description | |
| 27 | +|----------|--------|-------------| |
| 28 | +| `OPENVX_PIPELINING_THREADS` | `1` | Single-threaded sequential fallback | |
| 29 | +| | `0` or unset | Auto-detect hardware cores (capped at 64) | |
| 30 | +| | `N` | Exactly N threads in pool | |
| 31 | + |
| 32 | +### Build |
| 33 | + |
| 34 | +```bash |
| 35 | +cd samples/pipelining_multicore |
| 36 | +make OPENVX_INCLUDE=../../include OPENVX_LIB=../../target/release |
| 37 | +``` |
| 38 | + |
| 39 | +### Run |
| 40 | + |
| 41 | +```bash |
| 42 | +# Basic demo |
| 43 | +./pipelining_multicore |
| 44 | + |
| 45 | +# Throughput comparison (non-pipelining vs pipelining) |
| 46 | +./benchmark_pipelining |
| 47 | +OPENVX_PIPELINING_THREADS=4 ./benchmark_pipelining |
| 48 | + |
| 49 | +# Real-world multi-scale pipeline |
| 50 | +./multiscale_feature_extraction |
| 51 | +OPENVX_PIPELINING_THREADS=1 ./multiscale_feature_extraction # single-threaded |
| 52 | +OPENVX_PIPELINING_THREADS=4 ./multiscale_feature_extraction # 4 cores |
| 53 | +``` |
| 54 | + |
| 55 | +## Adding New Samples |
| 56 | + |
| 57 | +To add a sample: |
| 58 | +1. Create a new subdirectory under `samples/` |
| 59 | +2. Include a `README.md` explaining what the sample does |
| 60 | +3. Provide a `Makefile` (or `Cargo.toml` for Rust samples) |
| 61 | +4. Update this top-level README |
| 62 | + |
| 63 | +## See Also |
| 64 | + |
| 65 | +- `docs/pipelining_architecture.md` — rustVX pipelining internals |
| 66 | +- `docs/multicore_pipeline_design.md` — wave-based execution design |
| 67 | +- [OpenVX 1.3 Specification](https://www.khronos.org/registry/OpenVX/) — Pipelining Extension |
0 commit comments