Skip to content

feat(rust): establish Rust graph computing modernization framework (#355) - #359

Open
KHARSHAVARDHAN-eng wants to merge 1 commit into
apache:masterfrom
KHARSHAVARDHAN-eng:feature/rust-modernization-roadmap-355
Open

feat(rust): establish Rust graph computing modernization framework (#355)#359
KHARSHAVARDHAN-eng wants to merge 1 commit into
apache:masterfrom
KHARSHAVARDHAN-eng:feature/rust-modernization-roadmap-355

Conversation

@KHARSHAVARDHAN-eng

Copy link
Copy Markdown

Description

This PR implements the initial Rust modernization baseline and proof-of-concept framework for HugeGraph Computer and Vermeer as outlined in parent roadmap issue #355.

Key Changes

  1. Core Rust Kernel (computer-rust):
    • CSRGraph: High-performance Compressed Sparse Row / Column memory-efficient graph representation.
    • PageRankKernel & SsspKernel: Vectorized, parallelized PageRank and Single Source Shortest Path computing kernels.
    • AtomicAggregator: Lock-free thread-safe aggregators for superstep reductions.
    • C-ABI FFI Layer: Exported functions in computer_rust_c_api.h and src/ffi/c_api.rs for JNI (Java) and CGO/gRPC (Go) interoperability.
  2. Correctness Fixtures & Baseline Tolerances:
    • Datasets: Standard Karate Club dataset fixture and synthetic power-law graph generator.
    • Differential Tolerance: $L_1$-distance and epsilon floating-point parity assertion suite against ground-truth baselines.
    • Benchmarks: Criterion harness (benches/kernel_bench.rs) for measuring iteration speed and memory scaling.
  3. Integration Adapters:
    • Java (computer-core): RustKernelBridge.java with graceful fallback to pure Java Computation execution if native library is absent.
    • Go (vermeer): rust_bridge.go in apps/compute with fallback execution.
  4. CI & Documentation:
    • .github/workflows/rust-ci.yml: Automated cargo fmt, clippy, cargo test, and release build validation.
    • docs/rust-modernization-roadmap.md: Comprehensive architecture overview, baseline principles, safety guardrails, and newcomer-friendly child issue breakdowns.

Reference

Fixes #355

…pache#355)

- Create computer-rust crate with high-performance CSR graph representation, PageRank, SSSP, and atomic aggregator kernels
- Implement C-ABI export layer (computer_rust_c_api.h) for FFI interoperability
- Add dataset fixtures (Karate Club, synthetic power-law) and differential tolerance check suite
- Add Java RustKernelBridge in computer-core with graceful fallback logic and unit tests
- Add Go RustKernelBridge in vermeer with fallback execution and unit tests
- Create .github/workflows/rust-ci.yml for Rust linting, testing, and formatting
- Add docs/rust-modernization-roadmap.md detailing architecture, guardrails, baselines, and newcomer-friendly child tasks
@dosubot dosubot Bot added size:XXL This PR changes 1000+ lines, ignoring generated files. feature New feature labels Aug 10, 2026

@imbajin imbajin left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Blocking: yes. The Rust framework currently has correctness and delivery blockers: invalid endpoints can corrupt the CSR, negative-weight SSSP can fail to terminate, and the new Rust CI/license/integration path is not passing or connected; the exact head has failed checks. Evidence: actionlint on .github/workflows/rust-ci.yml; gh run view 31351599313 --log-failed; computer-rust/src/kernel/{csr,sssp}.rs; Java/Go bridge sources.

push:
branches:
- master
- /^release-.*$/

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

‼️ GitHub Actions branch filters use glob syntax, but /^release-.*$/ is rejected as an invalid branch name/pattern (actionlint reports the leading /, ^, and trailing / as invalid); the exact-head Rust CI run 31351599715 ended in startup_failure, so formatting, clippy, tests, and release build never ran. Please use a valid glob such as release-* and rerun the workflow.

* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You me obtain a copy of the License at

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ The Apache header contains You me obtain a copy, which makes the exact-head check-license-header job fail on this file. Please correct the standard license text to You may obtain a copy and rerun the license check.

pub fn from_edges(num_vertices: u32, edges: &[(u32, u32, f64)]) -> Self {
let mut degree = vec![0; num_vertices as usize];
for &(src, _dst, _weight) in edges {
if src < num_vertices {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

‼️ degree counts every edge whose source is in range, but the fill loop skips an out-of-range destination. For example, from_edges(2, &[(0, 99, 1.0)]) allocates one slot and leaves it as the default 0 -> 0 edge, so PageRank/SSSP consume a topology that was never supplied. Please validate both endpoints when counting and filling, and return an error from the C API for invalid vertices.

let (neighbors, weights) = graph.out_edges(position);
for i in 0..neighbors.len() {
let next_target = neighbors[i];
let next_cost = cost + weights[i];

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

‼️ This Dijkstra loop accepts negative weights and has no negative-cycle detection. A graph containing 0 -> 1 = -1 and 1 -> 0 = -1 keeps lowering both distances and pushing new heap entries, so the exported SSSP call can run without termination and exhaust CPU/memory. Please reject negative/non-finite weights at the API boundary or use an algorithm that detects negative cycles.


func NewRustKernelBridge() *RustKernelBridge {
return &RustKernelBridge{
available: false,

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ The new Rust library is not reachable from the advertised Vermeer path: NewRustKernelBridge hard-codes available: false, and ComputePageRank always executes the Go fallback. The Java bridge likewise computes in Java and only declares nativeGetVersion, which does not match Rust's computer_kernel_version export. Please implement and test the JNI/CGO bindings and native-path selection, or document this PR as fallback-only instead of presenting an active Rust integration.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature New feature size:XXL This PR changes 1000+ lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Roadmap] Incremental Rust modernization for graph computing

2 participants