Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
67 commits
Select commit Hold shift + click to select a range
97f938a
Compile new protos
jchmura-sc Aug 3, 2026
1862938
Add quantization ops
jchmura-sc Aug 3, 2026
3b9134e
Minor format updates
jchmura-sc Aug 3, 2026
17a9d84
Add tests
jchmura-sc Aug 3, 2026
4376ea7
Whitespace
jchmura-sc Aug 3, 2026
838f2ed
WIP
jchmura-sc Aug 3, 2026
d357421
Add preprocessor diff
jchmura-sc Aug 3, 2026
459b8cb
Add test
jchmura-sc Aug 3, 2026
be34beb
Update read side
jchmura-sc Aug 3, 2026
be4a9fe
Add integration code
jchmura-sc Aug 4, 2026
0400961
Add docs
jchmura-sc Aug 4, 2026
ec88d0f
Update docs
jchmura-sc Aug 4, 2026
3e76a52
Add inline comment explaining uint16 cast
jchmura-sc Aug 4, 2026
c0b4847
Add quantize dequantize roundtrip test
jchmura-sc Aug 4, 2026
7c70b02
Simplify test logic
jchmura-sc Aug 4, 2026
1510b43
Defensive check against nan or inf
jchmura-sc Aug 4, 2026
5116725
Pass clip args directly to quantize
jchmura-sc Aug 4, 2026
f670c83
Merge branch 'jchmura/feature_quant_ops' into jchmura/feature_quant_p…
jchmura-sc Aug 4, 2026
d74590c
Upd
jchmura-sc Aug 4, 2026
1ebbd19
Upd
jchmura-sc Aug 7, 2026
1fd3e28
upd
jchmura-sc Aug 7, 2026
48bab63
WIP
jchmura-sc Aug 7, 2026
1ecf397
WIP
jchmura-sc Aug 7, 2026
2fd2c64
WIP
jchmura-sc Aug 7, 2026
3fbe66a
Add SUPPORTED_QUANTIZATION_BITS const
jchmura-sc Aug 7, 2026
109e1e5
Add docstring to quantization transform
jchmura-sc Aug 7, 2026
02bb49a
Merge main
jchmura-sc Aug 10, 2026
7ed4b29
Format docs
jchmura-sc Aug 10, 2026
b490889
Revert diff
jchmura-sc Aug 10, 2026
42676f5
Revert diff in graph types
jchmura-sc Aug 10, 2026
46803e3
Merge branch 'jchmura/feature_quant_preprocessor' into jchmura/featur…
jchmura-sc Aug 10, 2026
6c8c3c4
Cleanup
jchmura-sc Aug 10, 2026
8e59f96
Update unit tests
jchmura-sc Aug 10, 2026
6ce5922
Better comments
jchmura-sc Aug 10, 2026
be16dae
Expand multi-line decleration with typedefs
jchmura-sc Aug 10, 2026
5bf105b
Use len() check instead of full set equality for partial quantization…
jchmura-sc Aug 10, 2026
fa02749
Merge main
jchmura-sc Aug 11, 2026
29aabbb
Run format
jchmura-sc Aug 11, 2026
8f01851
Merge upstream
jchmura-sc Aug 11, 2026
6270a0b
Lazy log format
jchmura-sc Aug 11, 2026
99ef03d
Update graph store dist server contract to match distdataset
jchmura-sc Aug 11, 2026
2b42042
Add unit tests
jchmura-sc Aug 11, 2026
779a947
Update tests
jchmura-sc Aug 11, 2026
bdc3e0f
Fix implicit default homogenous key mismatch in quant metadata when a…
jchmura-sc Aug 11, 2026
7bcafc4
Fix test
jchmura-sc Aug 11, 2026
37291ad
Inline quant metadata normalization
jchmura-sc Aug 11, 2026
6e25193
Remove collate timers
jchmura-sc Aug 11, 2026
5d8d148
Whitesapce
jchmura-sc Aug 11, 2026
438e07c
Add descriptive comment for why we need to remap quantization metadat
jchmura-sc Aug 11, 2026
c8d43a5
Don't need node quantized feature info
jchmura-sc Aug 11, 2026
0f2f9b9
Remove debug timing
jchmura-sc Aug 11, 2026
c9a9912
Value error instead of assertion
jchmura-sc Aug 11, 2026
feb138e
Remove stale share ipc entry
jchmura-sc Aug 11, 2026
6795731
Upd
jchmura-sc Aug 11, 2026
41f3a21
Upd
jchmura-sc Aug 11, 2026
1e375ac
Update tests
jchmura-sc Aug 11, 2026
bec1f10
Remove quantization metadata property to make RPC call explicit
jchmura-sc Aug 11, 2026
84e3e58
Update
jchmura-sc Aug 11, 2026
d2e34c5
Merge branch 'main' into jchmura/feature_quant_integration
jchmura-sc Aug 12, 2026
ca7fdea
Add type to storage
jchmura-sc Aug 12, 2026
54e53c5
No need for metadata promotion to dict on labeled homogeneous ablp
jchmura-sc Aug 12, 2026
1cdeb88
Simplify test
jchmura-sc Aug 12, 2026
50e6a8d
Add type to scatter index
jchmura-sc Aug 12, 2026
40e1460
Update
jchmura-sc Aug 12, 2026
dcb7722
Improve test readability
jchmura-sc Aug 12, 2026
5de7dd9
Fix heterogenous sampler collate with only partially quantized node t…
jchmura-sc Aug 12, 2026
20bd8b4
Improved docs for materialize_quantized_node_features
jchmura-sc Aug 13, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions gigl/distributed/base_dist_loader.py
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,7 @@ def __init__(
)
self._node_feature_info = dataset_schema.node_feature_info
self._edge_feature_info = dataset_schema.edge_feature_info
self._node_quantization_metadata = dataset_schema.node_quantization_metadata

self._sampler_options = sampler_options
self._non_blocking_transfers = non_blocking_transfers
Expand Down
75 changes: 72 additions & 3 deletions gigl/distributed/base_sampler.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import asyncio
import traceback
from collections import defaultdict
from dataclasses import dataclass
from dataclasses import dataclass, replace
from typing import Optional, Union

import torch
Expand All @@ -20,6 +20,7 @@
from gigl.common.logger import Logger
from gigl.distributed.sampler import (
NEGATIVE_LABEL_METADATA_KEY,
NODE_PACKED_FEATURES_METADATA_KEY,
POSITIVE_LABEL_METADATA_KEY,
ABLPNodeSamplerInput,
)
Expand Down Expand Up @@ -110,9 +111,28 @@ def __init__(self, *args, **kwargs) -> None:
which GLT's event loop would swallow the same way it swallows the
original sampling exception.
"""
data = kwargs.get("data")
super().__init__(*args, **kwargs)
self._sampling_error_sent: bool = False

self.dist_node_quantized_feature: Optional[DistFeature] = None
if (
self.collect_features
and data is not None
and getattr(data, "node_quantized_features", None) is not None
):
# Mirrors GLT's dist_node_feature initialization:
# https://github.com/alibaba/graphlearn-for-pytorch/blob/88ff111ac0d9e45c6c9d2d18cfc5883dca07e9f9/graphlearn_torch/python/distributed/dist_neighbor_sampler.py#L162-L167
self.dist_node_quantized_feature = DistFeature(
Comment thread
jchmura-sc marked this conversation as resolved.
data.num_partitions,
data.partition_idx,
data.node_quantized_features,
data.node_pb,
local_only=False,
rpc_router=self.rpc_router,
device=self.device,
)

def _prepare_sample_loop_inputs(
self,
inputs: NodeSamplerInput,
Expand Down Expand Up @@ -357,18 +377,63 @@ async def _collate_fn(
]
if self.dist_node_feature is not None:
if self.use_all2all:
sorted_ntype = sorted(self.dist_node_feature.feature_pb.keys())
sorted_ntype = sorted(self.dist_node_feature.local_feature.keys())
# GLT get_all2all() iterates every type in output.node, not
# just sorted_ntype. feature_pb contains partition books for
# every node type, while local_feature contains only types
# registered in this feature store, such as when only some
# heterogeneous node types have quantized features.
feature_output = replace(
output,
node={
ntype: nodes
for ntype, nodes in output.node.items()
if ntype in sorted_ntype
},
)
nfeat_dict = self.dist_node_feature.get_all2all(
output, sorted_ntype
feature_output, sorted_ntype
)
for ntype, nfeats in nfeat_dict.items():
result_map[f"{as_str(ntype)}.nfeats"] = nfeats
else:
for ntype, nodes in output.node.items():
if ntype not in self.dist_node_feature.local_feature:
continue
nodes = nodes.to(torch.long)
futs[f"{as_str(ntype)}.nfeats"] = wrap_torch_future(
self.dist_node_feature.async_get(nodes, ntype)
)
if self.dist_node_quantized_feature is not None:
if self.use_all2all:
sorted_ntype = sorted(
self.dist_node_quantized_feature.local_feature.keys()
)
feature_output = replace(
output,
node={
ntype: nodes
for ntype, nodes in output.node.items()
if ntype in sorted_ntype
},
)
quantized_nfeat_dict = self.dist_node_quantized_feature.get_all2all(
feature_output, sorted_ntype
)
for ntype, quantized_nfeats in quantized_nfeat_dict.items():
result_map[
f"#META.{NODE_PACKED_FEATURES_METADATA_KEY}.{as_str(ntype)}"
] = quantized_nfeats
else:
for ntype, nodes in output.node.items():
if ntype not in self.dist_node_quantized_feature.local_feature:
continue
nodes = nodes.to(torch.long)
futs[
f"#META.{NODE_PACKED_FEATURES_METADATA_KEY}.{as_str(ntype)}"
] = wrap_torch_future(
self.dist_node_quantized_feature.async_get(nodes, ntype)
)
if self.dist_edge_feature is not None and self.with_edge:
for etype in self.edge_types:
if self.edge_dir == "in":
Expand Down Expand Up @@ -416,6 +481,10 @@ async def _collate_fn(
futs["nfeats"] = wrap_torch_future(
self.dist_node_feature.async_get(output.node)
)
if self.dist_node_quantized_feature is not None:
futs[f"#META.{NODE_PACKED_FEATURES_METADATA_KEY}"] = wrap_torch_future(
self.dist_node_quantized_feature.async_get(output.node)
)
if self.dist_edge_feature is not None:
eids = result_map["eids"]
futs["efeats"] = wrap_torch_future(
Expand Down
12 changes: 11 additions & 1 deletion gigl/distributed/dataset_factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,10 @@ def _load_and_build_partitioned_dataset(
partitioner.register_node_features(
node_features=loaded_graph_tensors.node_features
)
if loaded_graph_tensors.node_quantized_features is not None:
partitioner.register_node_quantized_features(
node_quantized_features=loaded_graph_tensors.node_quantized_features
)
if loaded_graph_tensors.node_labels is not None:
partitioner.register_node_labels(node_labels=loaded_graph_tensors.node_labels)
if loaded_graph_tensors.edge_weights is not None:
Expand All @@ -205,6 +209,7 @@ def _load_and_build_partitioned_dataset(
del (
loaded_graph_tensors.node_ids,
loaded_graph_tensors.node_features,
loaded_graph_tensors.node_quantized_features,
loaded_graph_tensors.edge_index,
loaded_graph_tensors.edge_features,
loaded_graph_tensors.edge_weights,
Expand All @@ -217,7 +222,12 @@ def _load_and_build_partitioned_dataset(
partition_output = partitioner.partition()

logger.info(f"Initializing DistDataset instance with edge direction {edge_dir}")
dataset = DistDataset(rank=rank, world_size=world_size, edge_dir=edge_dir)
dataset = DistDataset(
rank=rank,
world_size=world_size,
edge_dir=edge_dir,
node_quantization_metadata=serialized_graph_metadata.node_quantization_metadata,
Comment thread
jchmura-sc marked this conversation as resolved.
)

dataset.build(
partition_output=partition_output,
Expand Down
9 changes: 9 additions & 0 deletions gigl/distributed/dist_ablp_neighborloader.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
extract_edge_type_metadata,
extract_metadata,
labeled_to_homogeneous,
materialize_quantized_node_features,
set_missing_features,
shard_nodes_by_process,
strip_label_edges,
Expand Down Expand Up @@ -607,6 +608,7 @@ def _setup_for_colocated(
edge_types=edge_types,
node_feature_info=dataset.node_feature_info,
edge_feature_info=dataset.edge_feature_info,
node_quantization_metadata=dataset.node_quantization_metadata,
edge_dir=dataset.edge_dir,
),
)
Expand Down Expand Up @@ -796,6 +798,7 @@ def _setup_for_graph_store(
edge_types=edge_types,
node_feature_info=node_feature_info,
edge_feature_info=edge_feature_info,
node_quantization_metadata=dataset.fetch_node_quantization_metadata(),
edge_dir=edge_dir,
),
backend_key,
Expand Down Expand Up @@ -964,6 +967,12 @@ def _collate_fn(self, msg: SampleMessage) -> Union[Data, HeteroData]:

data, metadata = self._apply_ppr_outputs(data, metadata)

data, metadata = materialize_quantized_node_features(
data=data,
metadata=metadata,
node_quantization_metadata=self._node_quantization_metadata,
)

# Attach any remaining metadata (e.g. custom user-defined keys) directly onto the
# data object so downstream code can access them via attribute lookup.
for key, value in metadata.items():
Expand Down
Loading