Skip to content

[WIP] Strongly Connected Components (Find trivial SCCs in components)#5448

Open
ngokulakrish wants to merge 24 commits intorapidsai:mainfrom
ngokulakrish:fea_scc2
Open

[WIP] Strongly Connected Components (Find trivial SCCs in components)#5448
ngokulakrish wants to merge 24 commits intorapidsai:mainfrom
ngokulakrish:fea_scc2

Conversation

@ngokulakrish
Copy link

@ngokulakrish ngokulakrish commented Feb 27, 2026

This is an optimization PR for SCC #5442 to recursively trim trivial SCCs in components before running FW-BW pass.

Should be reviewed/merged after #5442

@ngokulakrish ngokulakrish requested review from a team as code owners February 27, 2026 04:40
@copy-pr-bot
Copy link

copy-pr-bot bot commented Feb 27, 2026

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.

@ngokulakrish ngokulakrish changed the title Strongly Connected Components (Find trivial SCCs in components) [WIP] Strongly Connected Components (Find trivial SCCs in components) Feb 27, 2026
@ngokulakrish ngokulakrish requested a review from a team as a code owner February 28, 2026 01:44
@seunghwak
Copy link
Contributor

And #5442 updates only 11 files. I see updates in 22 files in this PR. Did you make any updates outside strongly_connected_components_impl.cuh?

bwd_only_vertices.resize(count, handle.get_stream());
}

// 4. FWD_OR_BWD = FWD ∪ BWD (needed to compute REMAINDER)
Copy link
Contributor

Choose a reason for hiding this comment

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

You may merge 4 and 5. What we need to compute is UC - (FWD U BWD)

component_local_min_vertex_ids.size(),
raft::comms::op_t::MIN,
handle.get_stream());
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Two things to consider here.

  1. FWD only, BWD only, Remaining - (FWD U BWD) become next unresolved component if there size is larger than 1.
    If the size = 1, they are trivial SCCs as well. And some components might have size 0 as well. They should be discarded.

In multi-GPU, we need call device_allreduce to find the total number of vertices in the next unresolved component candidates.

  1. For the next iteration, we need to update new

unresolved_component_offsets
unresolved_component_vertices

pairs. In multi-GPU, unresolved_compoent_offsets.size() = # global number of unresolved components + 1.
And vertices in each GPU should be placed based on this offset array.

I think this function is the best place to achieve this.

We have an array of size # (old) unresolved components * 4 (or 3 if we disregard SCCs). If we create an array of the same size and set the value to 1 if the global size is > 1 (i.e. new unresolved component) and set the value to 0 if the global size <= 1 (i.e. SCC or empty).

Then, we run thrust::exclusive_scan. Then, we can map the position in the above array to the new unresolved component index (which is used to access the new unresolved_component_offsets).

Then, at the end, we can just resize the return value of this function (to exclude the SCCs) and start the next iteration.

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.

2 participants