Adds and documents a Highway-based optimized C++ implementation. Adds a new pure Rust crate, libfacedetection_rs, with a safe Rust API, static model data, scalar fallback, and runtime AVX2 acceleration. - #382
Merged
Conversation
Contributor
|
Great job! I noticed a several-fold speedup for my operations after enabling hybrid mode (HWY+AVX-2) compared to the original AVX-2. When is the CMake install target scheduled to be added? Edit: I've made a naive attempt in PR #384 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR adds two major performance and language-extension tracks for libfacedetection:
libfacedetection_rs, with a safe Rust API, static model data, scalar fallback, and runtime AVX2 acceleration.Changes
Highway optimized implementation
Added an independent Highway implementation under
highway/while keeping the original C++ implementation untouched.Added Highway build integration through CMake, including support for:
find_package(hwy 1.3.0 CONFIG)hwy_DIRFDT_HW_HIGHWAY_ROOTAdded the public Highway API entry point:
int* results = facedetect_hw_cnn(result_buffer, bgr_image_data, width, height, step);Added optimized Highway kernels for pointwise, depthwise, maxpool, image/network flow, and postprocess flow.
Added x86 hybrid AVX2 path using Highway packed pointwise plus guarded AVX2/FMA intrinsics for selected depthwise/maxpool kernels.
Added benchmark and detection examples:
example/detect-image-highway.cppexample/benchmark-highway.cpphighway/benchmark/hw_resolution_benchmark.cppDocumented recommended external multi-threading model: one caller-owned result buffer per thread.
Performance documentation
highway/docs/hw-performance-report.mdhighway/docs/hw-status.mdhighway/docs/hw-cross-platform-execution-plan.mdREADME.mdandCOMPILE.mdwith Highway build instructions, usage examples, backend descriptions, and benchmark tables.Rust crate
Added a new pure Rust package under
rust/namedlibfacedetection_rs.Added safe public Rust API:
DetectorDetectionFaceDetectErrorResultBufferAdded high-level image API through the
imagecrate:Added low-level RGB/BGR entry points for callers that already own decoded image buffers.
Added compatibility result-buffer support matching the legacy libfacedetection layout.
Added generated static Rust model data in
rust/src/generated/model_data.rs, making the crate self-contained for publishing.Added full Rust detection pipeline:
Added runtime AVX2 dispatch on x86/x86_64 with scalar fallback for other supported Rust targets.
Added Rust benchmark helpers and development benchmark harnesses.
Added Rust crate docs, changelog, license, diagrams, migration plan, publish-preparation plan, and optimization report.
Performance Notes
README.md,COMPILE.md, and the Highway/Rust performance reports.Test / Validation Notes
Files Added / Updated
rust/crate including source, examples, docs, generated model data, and benchmark tooling.