feat(rust): establish Rust graph computing modernization framework (#355) - #359
Conversation
…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
imbajin
left a comment
There was a problem hiding this comment.
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-.*$/ |
There was a problem hiding this comment.
/^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 |
There was a problem hiding this comment.
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 { |
There was a problem hiding this comment.
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]; |
There was a problem hiding this comment.
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, |
There was a problem hiding this comment.
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.
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
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 incomputer_rust_c_api.handsrc/ffi/c_api.rsfor JNI (Java) and CGO/gRPC (Go) interoperability.benches/kernel_bench.rs) for measuring iteration speed and memory scaling.computer-core):RustKernelBridge.javawith graceful fallback to pure JavaComputationexecution if native library is absent.vermeer):rust_bridge.goinapps/computewith fallback execution..github/workflows/rust-ci.yml: Automatedcargo 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