Skip to content

Add fake kernels for C++ operators to advance to torch.export and torch.compile(fullgraph=True) - #742

Open
Peppino58 wants to merge 2 commits into
pyg-team:mainfrom
Peppino58:fix/radius-fake-kernel
Open

Peppino58 wants to merge 2 commits into
pyg-team:mainfrom
Peppino58:fix/radius-fake-kernel

Conversation

@Peppino58

Copy link
Copy Markdown

part of #740 : custom C++ operators such as pyg::radius need a fake kernel to describe their output sizes/dtypes/devices to be compatible with torch.export and torch.compile.

Adds pyg_lib/_fake.py who registers fake kernels for tensor operators using torch.library.register_fake. Output dimension that depends on the data (like the number of edges returned by pyg.radius) use ctx.new_dynamic_size

Remaining issues :

  1. SchNet from torch.ops.pyg.radius has no fake kernel: radius_graph cannot be captured by torch.export / torch.compile(fullgraph=True) #740 still fails because of a failure on PyG side, mentionned here PyG issue #10915
  2. neighbor sampling operators are not covered
  3. backward pass failure on operators without dim_size like segment_matmul, these cases are marked xfail

I am unexperienced with torch.library and fake kernels, every feedback is welcome :)

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.

1 participant