Skip to content

Proposal: Add RISC-V Vector Extension (RVV) Acceleration for Spatial Queries #13

Description

@trocedge

I am writing to propose a new feature enhancement for GeoFlink: the integration of hardware acceleration for spatial queries on the RISC-V architecture using its Vector Extension (RVV).

Background:

GeoFlink is an extension of Apache Flink — a scalable opensource distributed streaming engine — for the real-time processing of unbounded spatial streams. GeoFlink leverages a grid-based index for preserving spatial data proximity and pruning of objects which cannot be part of a spatial query result. Thus, providing effective data distribution that guarantees reduced query processing time.

RISC-V Vector Extension (RVV) is a new instruction set extension that offers more flexible vectorization capabilities compared to traditional SIMD. On RISC-V hardware platforms, RVV enables efficient large-scale data parallel computation, significantly improving performance for algorithms dealing with large datasets. Based on this, we propose optimizing the core distance calculation algorithms within spatial queries (such as k-NN) with RVV to improve their execution efficiency on RISC-V processors

Motivation

As RISC-V hardware becomes more prevalent in data centers and edge computing, leveraging its unique capabilities like the Vector Extension can provide significant performance gains for computationally intensive workloads. Spatial distance calculation, which is at the heart of queries like k-NN, is a perfect candidate for such optimization. Accelerating this core component can substantially improve the throughput and reduce the latency of GeoFlink on modern hardware platforms.

Implementation Overview

We have implemented the following architectural components:

  • JNI-based Hardware Abstraction: A clean separation between GeoFlink's Java operators and low-level native computational library
  • RVV-Optimized Native Kernel: C library leveraging RISC-V Vector intrinsics for batch Euclidean distance calculations
  • Dynamic Loading with Fallback: Runtime detection with automatic fallback to pure Java implementation on non-RISC-V platforms
  • k-NN Operator Integration: Modified existing k-NN operator to utilize the acceleration layer transparently

Request for Feedback

We have completed the initial RVV optimization for k-NN distance calculations and achieved promising early results. While further refinement is needed, we expect significant computational performance improvements on RISC-V hardware with vector extension support.
We would like to contribute this optimization to GeoFlink and would appreciate your feedback on:

  • Whether this optimization aligns with GeoFlink's development goals
  • Any specific testing or documentation requirements for a potential PR

We invite your suggestions to help advance and refine this optimization for the GeoFlink project.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions