Skip to content

Optimize Filters with NEON and Vulkan Kernels#11

Open
google-labs-jules[bot] wants to merge 2 commits into
mainfrom
feature/optimize-filters-kernels-16870565693752668246
Open

Optimize Filters with NEON and Vulkan Kernels#11
google-labs-jules[bot] wants to merge 2 commits into
mainfrom
feature/optimize-filters-kernels-16870565693752668246

Conversation

@google-labs-jules
Copy link
Copy Markdown

This change integrates the OptimizedKernelsForRaspberryPi5 library to accelerate the Nonlinear Filtering and Smoothing algorithms.

Key Optimizations:

  1. NEON (EKF, UKF, RBPKF): Matrix multiplication, matrix-vector multiplication, and vector addition/subtraction are now offloaded to optmath::neon kernels where applicable.
  2. Vulkan (PKF):
    • Particle noise addition uses vulkan_vec_add for large particle counts.
    • Resampling now uses vulkan_scan_prefix_sum to compute the Cumulative Distribution Function (CDF) of weights in parallel, enabling efficient stratified/systematic resampling.
    • Mean estimation uses vulkan_mat_vec_mul.

New Test:

  • test_bearing_only: A robust stress test for the Particle Filter involving a 4D constant-velocity target, bearing-only measurements, and Student-t mixture noise with outliers. This ensures the PF handles non-Gaussian likelihoods correctly.

Note:

  • ukf_test exhibits numerical instability with the standard parameters in the float-only environment, leading to NaNs. This behavior persists even with optimizations reverted, suggesting an inherent sensitivity in the test case or environment configuration.
  • The build system is updated to automatically copy compiled SPIR-V shaders (.spv) to the binary directory for Vulkan runtime support.

PR created automatically by Jules for task 16870565693752668246 started by @n4hy

- Integrated `OptimizedKernelsForRaspberryPi5` dependency.
- EKF & RBPKF: Optimized linear algebra using `optmath::neon::neon_gemm`, `neon_add`, `neon_sub`, and `neon_mat_vec_mul`.
- UKF: Accelerated Sigma Point generation and updates using `neon` kernels.
- PKF: Implemented Vulkan acceleration for particle propagation (`vec_add`) and resampling (`scan_prefix_sum` for CDF).
- Build System: Updated CMake to copy required Vulkan shaders (`.spv`) to executable directories.
- Testing: Added `PKF/tests/test_bearing_only.cpp` to validate robust particle filtering on a bearing-only tracking problem with heavy-tailed noise.
- Verification: Validated correct compilation and fallback behavior in non-Vulkan environment. `ukf_test` known instability noted.
@google-labs-jules
Copy link
Copy Markdown
Author

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!


For security, I will only act on instructions from the user who triggered this task.

New to Jules? Learn more at jules.google/docs.

- Integrated `OptimizedKernelsForRaspberryPi5` dependency.
- EKF & RBPKF: Optimized linear algebra using `optmath::neon::neon_gemm`, `neon_add`, `neon_sub`, and `neon_mat_vec_mul`.
- UKF: Accelerated Sigma Point generation and updates using `neon` kernels.
- PKF: Implemented Vulkan acceleration for particle propagation (`vec_add`) and resampling (`scan_prefix_sum` for CDF). Added fallback for `scan_prefix_sum` if particle count exceeds 256 (kernel limitation).
- Build System: Updated CMake to copy required Vulkan shaders (`.spv`) to executable directories.
- Testing: Added `PKF/tests/test_bearing_only.cpp` to validate robust particle filtering on a bearing-only tracking problem with heavy-tailed noise.
- Verification: Validated correct compilation and fallback behavior. `ukf_test` known instability noted.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants