Skip to content

Fix PPR sampler memory and labeled homogeneous ABLP#645

Draft
mkolodner-sc wants to merge 29 commits into
mainfrom
mkolodner-sc/ppr_gs_memory
Draft

Fix PPR sampler memory and labeled homogeneous ABLP#645
mkolodner-sc wants to merge 29 commits into
mainfrom
mkolodner-sc/ppr_gs_memory

Conversation

@mkolodner-sc
Copy link
Copy Markdown
Collaborator

@mkolodner-sc mkolodner-sc commented May 19, 2026

Summary

Makes the PPR sampler cheaper and fixes the labeled-homogeneous ABLP edge case that surfaced while exercising PPR through Graph Store.

Changes include:

  • Precompute PPR total-degree tensors by node type through DistDataset.degree_tensor.
  • Store degree tensors as int32 and share them across sampling workers instead of rebuilding/copying per worker.
  • Update DistPPRNeighborSampler to consume precomputed degree tensors directly.
  • Fix labeled homogeneous ABLP PPR sampling by only passing etype=None for true homogeneous graphs.
  • Fix PPR for GraphStore mode so that memory is shared for the degree tensor
  • Attach single-edge-type PPR outputs directly to homogeneous Data batches.
  • Expand PPR and degree unit coverage.

@mkolodner-sc
Copy link
Copy Markdown
Collaborator Author

/all_tests

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 28, 2026

GiGL Automation

@ 19:17:28UTC : 🔄 C++ Unit Test started.

@ 19:19:34UTC : ✅ Workflow completed successfully.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 28, 2026

GiGL Automation

@ 19:17:29UTC : 🔄 Python Unit Test started.

@ 20:14:17UTC : ✅ Workflow completed successfully.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 28, 2026

GiGL Automation

@ 19:17:30UTC : 🔄 E2E Test started.

@ 20:47:24UTC : ❌ Workflow failed.
Please check the logs for more details.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 28, 2026

GiGL Automation

@ 19:17:30UTC : 🔄 Lint Test started.

@ 19:26:20UTC : ✅ Workflow completed successfully.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 28, 2026

GiGL Automation

@ 19:17:31UTC : 🔄 Integration Test started.

@ 20:30:59UTC : ✅ Workflow completed successfully.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 28, 2026

GiGL Automation

@ 19:17:31UTC : 🔄 Scala Unit Test started.

@ 19:28:22UTC : ✅ Workflow completed successfully.

@mkolodner-sc
Copy link
Copy Markdown
Collaborator Author

/e2e_test

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 28, 2026

GiGL Automation

@ 20:48:41UTC : 🔄 E2E Test started.

@ 22:34:48UTC : ❌ Workflow failed.
Please check the logs for more details.

@mkolodner-sc
Copy link
Copy Markdown
Collaborator Author

/e2e_test

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 28, 2026

GiGL Automation

@ 21:47:12UTC : 🔄 E2E Test started.

@ 23:07:38UTC : ❌ Workflow failed.
Please check the logs for more details.

@mkolodner-sc
Copy link
Copy Markdown
Collaborator Author

/e2e_test

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 28, 2026

GiGL Automation

@ 22:42:25UTC : 🔄 E2E Test started.

@ 24:51:17UTC : ❌ Workflow failed.
Please check the logs for more details.

@mkolodner-sc
Copy link
Copy Markdown
Collaborator Author

/e2e_test

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 29, 2026

GiGL Automation

@ 24:24:11UTC : 🔄 E2E Test started.

@ 01:47:47UTC : ❌ Workflow failed.
Please check the logs for more details.

@mkolodner-sc
Copy link
Copy Markdown
Collaborator Author

/e2e_test

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 29, 2026

GiGL Automation

@ 24:38:06UTC : 🔄 E2E Test started.

@ 02:04:12UTC : ✅ Workflow completed successfully.

@mkolodner-sc mkolodner-sc changed the title Potential Fix PPR Graph Store memory Fix PPR sampler memory and labeled homogeneous ABLP May 29, 2026
Copy link
Copy Markdown
Collaborator

@kmontemayor2-sc kmontemayor2-sc left a comment

Choose a reason for hiding this comment

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

Thanks Matt! Did a first pass here, fwiw I feel like this could have been multiple PRs for the different fixes / etc but this pr is fine as-is.

Comment thread gigl/distributed/graph_store/shared_dist_sampling_producer.py Outdated
Comment thread gigl/distributed/utils/degree.py
Comment thread gigl/distributed/utils/degree.py Outdated
Comment thread gigl/distributed/utils/degree.py Outdated
Comment thread gigl/distributed/utils/neighborloader.py
Comment thread gigl/distributed/dist_ppr_sampler.py Outdated
Comment thread tests/unit/distributed/utils/degree_test.py Outdated
Comment thread gigl/distributed/dist_sampling_producer.py
Comment thread gigl/distributed/utils/neighborloader.py Outdated
Comment thread gigl/distributed/dist_dataset.py Outdated
self._degree_tensor = compute_and_broadcast_degree_tensor(
self.graph, self._edge_dir
)
share_memory(entity=self._degree_tensor)
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

ugh sorry to go back and forth on this, it may be weird to do this here instead of in share_ipc? Or do we not call degree_tensor until the subprocess launch?

In fact we do already share memory in share_ipc 1, is the problem here that we don't call degree_tensor until after we're in the subprocesses already?

Can you remind me where we first call degree_tensor and where that's located in the process tree?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Can you remind me where we first call degree_tensor and where that's located in the process tree?

Currently, the degree tensor is not built when we call build_dataset. Instead, it is first built after we are inside one of the data loaders and know we are doing PPR sampling (specified by the SamplingOptions).

In fact we do already share memory in share_ipc 1, is the problem here that we don't call degree_tensor until after we're in the subprocesses already?

Yes exactly, this was calling failures specifically on large-scale graph store cases since it was creating copies of the tensor before we had an opportunity to call share_ipc (and thereby share the memory of the degree tensor). The original fix I had here handled this by explicitly calling share memory before handing the degree tensor to the sampling workers for the GS setting, where otherwise it was creating many copies of this degree tensor.

I think the current solution to call share_memory immediately after building the degree tensor makes the most sense, since it doesn't need to rely on share_ipc and provides the most confidence for putting the degree tensor onto shared memory.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

We'd still have local world size copies of this object in shared memory then right? Unless we want to create the degree tensor in the top-process?

IIRC our goal here was to abstract this away from the user s.t. they don't need to pass in this implementation detail into the loaders right?

And in that vein it's probably weird if we ask them to call dataset.degree_tensor naked in the top-level process? I think ideally we can poke at /dev/shm directly to setup the shared memory properly across the local nodes here.

My concern with calling share_memory inside the property is that it may be surprising to users share memory tensors do have additional restrictions on them iirc - I guess the distdataset already does that under the hood so maybe it's not too bad.

I guess I have a slight preference here for calling share_memory in our loaders after we get this tensor, but that's up to you. WDYT?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

We'd still have local world size copies of this object in shared memory then right? Unless we want to create the degree tensor in the top-process?
IIRC our goal here was to abstract this away from the user s.t. they don't need to pass in this implementation detail into the loaders right?
And in that vein it's probably weird if we ask them to call dataset.degree_tensor naked in the top-level process? I think ideally we can poke at /dev/shm directly to setup the shared memory properly across the local nodes here.

Correct, this was a consideration made in the initial design. The tradeoff with the current approach is that there may still be local_world_size copies of the degree tensor, but since the degree tensor isn't impacting the memory bottleneck, we proceeded with this approach. Since this is the intention of the design and isn't blocking training or inference with PPR, I'd prefer if we save any further optimization as a follow-up if that becomes a blocker. One note is that the graph_store case doesn't have this constraint I believe, since it makes the share_memory call from the DistServer, so there are not local world size copies in that setting.

My concern with calling share_memory inside the property is that it may be surprising to users share memory tensors do have additional restrictions on them iirc - I guess the distdataset already does that under the hood so maybe it's not too bad.
I guess I have a slight preference here for calling share_memory in our loaders after we get this tensor, but that's up to you. WDYT?

That makes sense too, I can move the share_memory call back to the loaders in that case.

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.

3 participants