Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HeteroLinear/SEGMM: switch from heuristic to timing-cache #8615

Merged
merged 24 commits into from
Jan 29, 2024
Merged
Changes from 1 commit
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
47209ba
rebasing stadlmax's timing heuristic for segmm
puririshi98 Dec 13, 2023
fe4dc26
finishing rebase
puririshi98 Dec 13, 2023
e352aa9
Merge branch 'master' into rebase-time-heuristic
puririshi98 Dec 14, 2023
6814647
resolve conflicts
stadlmax Jan 5, 2024
edfb5ec
fix issues
stadlmax Jan 5, 2024
586e3e3
fix further issues
stadlmax Jan 5, 2024
a29943b
Merge branch 'master' into rebase-time-heuristic
puririshi98 Jan 8, 2024
32f64ea
accept review suggestions
puririshi98 Jan 9, 2024
6e60787
global measure iters
puririshi98 Jan 9, 2024
309dc53
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Jan 9, 2024
33d123d
applying suggestion
puririshi98 Jan 9, 2024
03abe6d
Merge branch 'master' into rebase-time-heuristic
puririshi98 Jan 10, 2024
f795f54
Merge branch 'master' into rebase-time-heuristic
puririshi98 Jan 11, 2024
e768f70
Merge branch 'master' into rebase-time-heuristic
puririshi98 Jan 12, 2024
03c526f
MEASURE_ITER=1 for pytesting
puririshi98 Jan 17, 2024
344947e
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Jan 17, 2024
3dccb19
Merge branch 'master' into rebase-time-heuristic
puririshi98 Jan 18, 2024
39ea9dd
Merge branch 'master' into rebase-time-heuristic
puririshi98 Jan 19, 2024
28bda99
Merge branch 'master' into rebase-time-heuristic
puririshi98 Jan 22, 2024
f1d3c7f
Merge branch 'master' into rebase-time-heuristic
puririshi98 Jan 23, 2024
191d239
Merge branch 'master' into rebase-time-heuristic
puririshi98 Jan 24, 2024
c91f0f5
Merge branch 'master' into rebase-time-heuristic
puririshi98 Jan 25, 2024
054e3f1
Merge branch 'master' into rebase-time-heuristic
rusty1s Jan 29, 2024
1c10dda
update
rusty1s Jan 29, 2024
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
Prev Previous commit
Next Next commit
finishing rebase
  • Loading branch information
puririshi98 authored Dec 13, 2023
commit fe4dc26fad98c3d244f5ca421fda0166a2968410
45 changes: 0 additions & 45 deletions torch_geometric/backend.py
Original file line number Diff line number Diff line change
@@ -1,54 +1,9 @@
from typing import Optional

import torch

# If set to `True`, PyG is configured to use the `segment_matmul` and
# `grouped_matmul` kernels from `pyg-lib` to parallelize matrix multiplication
# across segments/groups of potentially varying size.
# If set to `None`, will automatically decide whether to utilize
# `segment_matmul` and `grouped_matmul` based on input sizes.
# Requires `pyg-lib` to be installed.
use_segment_matmul: Optional[bool] = None

# Helper functions ############################################################


def use_segment_matmul_heuristic(
num_segments: int,
max_segment_size: int,
in_channels: int,
out_channels: int,
) -> bool:
r"""A heuristic based on input sizes to determine whether the usage of
:meth:`segment_matmul` can speed up computation.
"""
# NOTE This heuristic was learned on an A100 via sklearn using a simple
# StandardScaler() -> LinearSVC() model.
x = torch.tensor([
num_segments,
max_segment_size,
in_channels,
out_channels,
])
mean = torch.tensor([
125.11603189,
12133.21523472,
163.81222321,
32.43755536,
])
std = torch.tensor([
163.34480422,
27572.94543809,
177.6426489,
56.82103934,
])
weight = torch.tensor([
2.43877659e+00,
1.67583047e+00,
-5.20527282e-04,
3.43925501e-01,
])
bias = 1.20236999

x = (x - mean) / std
return bool(x @ weight >= bias)