Skip to content

Symmetrize the connecting-edge CSR in host-data connect_knn_graph - #2478

Open
alexfallin wants to merge 1 commit into
NVIDIA:mainfrom
alexfallin:fix-host-connect-knn-symmetric-csr
Open

Symmetrize the connecting-edge CSR in host-data connect_knn_graph#2478
alexfallin wants to merge 1 commit into
NVIDIA:mainfrom
alexfallin:fix-host-connect-knn-symmetric-csr

Conversation

@alexfallin

Copy link
Copy Markdown

Closes #2477

See linked issue for bug details.

This PR stores both directions of each connecting edge in the host path (rows/cols/vals duplicated with rows and cols swapped) before the sort + sorted_coo_to_csr + mst sequence, matching the device path's behavior.

Why now

Today the contract violation is masked (see bug), but the pending RAFT PR replaces the MST solver internals with an implementation may cause errors (both silent and loud). Without this fix, the host-data connect_knn_graph path (exercised by the connect_knn test with host data) can fail to connect components or throw an error once the RAFT PR is approved.

This change is safe to merge independently because the symmetric input satisfies both the current and the replacement solver
(the fixed symmetric edges match the device-data path anyway)

Notes

  • Cost: the connecting-edge list has n_components - 1 entries per iteration (typically tiny); doubling it is negligible.
  • No behavior change for the device-data path or for connected inputs (this code only runs while n_components > 1).
  • Compile/CI validation should come from cuVS CI (the change is header-only in detail/; the connect_knn gtest covers the host path).

The host-data variant of connect_knn_graph stores each cross-component
connecting edge once, in an arbitrary direction, and passes the resulting
CSR to raft::sparse::solver::mst, which requires a symmetric input
(each undirected edge stored in both directions). The
device-data variant already satisfies this via
raft::sparse::linalg::symmetrize; this stores both directions in the
host path as well.
@alexfallin
alexfallin requested a review from a team as a code owner August 18, 2026 01:46
@copy-pr-bot

copy-pr-bot Bot commented Aug 18, 2026

Copy link
Copy Markdown

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

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.

[BUG] Host-data connect_knn_graph passes a non-symmetric CSR to RAFT's MST

1 participant