|
RVV Canny Edge Detection 1.0
|
Target Architecture: rv64gcv (QEMU User-mode)
This project implements a high-performance Canny edge detection pipeline, focusing on the migration from a scalar C++ baseline to a hand-optimized implementation using RISC-V Vector (RVV) intrinsics.
The development process follows a standard embedded systems optimization lifecycle:
-O0 to -Ofast) to identify bottlenecks.riscv64-linux-gnu-g++ (configured with --with-arch=rv64gcv).While the project runs in emulation, the RVV optimizations interact with simulated digital hardware structures:
vadd utilize multiple ALUs in parallel, processing data batches rather than single pixels.VLEN values simulates various hardware tiers.vsetvli interacts with the vl Control and Status Register (CSR), allowing the logic to adapt to the physical hardware width dynamically.The setup script automates the installation of the RISC-V GNU toolchain, QEMU, GoogleTest and Python packages. Windows OS users should use WSL2 with Ubuntu 24.04.
Run in terminal:
The Makefile supports cross-compilation and automated testing.
| Command | Action | Purpose |
|---|---|---|
make all | Full Build | Compiles the main pipeline (RISC-V) and runs Host tests. |
make canny_rv | Target Build | Compiles the main Canny pipeline into a RISC-V .elf. |
make test | Host Test | Compiles and runs GoogleTest natively for logic verification. |
make run | Emulate | Executes the main pipeline on QEMU with vlen=512. |
make run-test NAME=x | Unit Emulate | Compiles and runs tests/x.cpp on QEMU (e.g., make run-test NAME=sobel). |
make list-tests | Discovery | Scans the tests/ folder and lists all testable .cpp files. |
make docs | Documentation | Generates browsable HTML API documentation via Doxygen. |
make clean | Cleanup | Wipes the build/ directory and resets the environment. |
Configuration Overrides: You can override hardware parameters directly from the command line: