xnn.gnn.fast.dimenet#

Fast path of the DimeNet and DimeNet++ triplet interactions (Triton kernels).

The reference gathers per-edge quantities onto every triplet k -> j -> i and sums the triplet messages onto the edges j -> i: DimeNet contracts the triplet basis with a projection of the edge features per triplet (a (T, N_bilinear, F) gather and one small matrix product per triplet), DimeNet++ multiplies the down-projected features with the mapped basis per triplet. Both are the neighbor sums of GemNet’s efficient bilinear layer, S[e, b, f] = sum_{t: ji_t = e} s[t, b] x[kj_t, f], followed by a contraction with the weights per edge: the bilinear tensor for DimeNet, the second (bias-free) basis layer for DimeNet++. The sums run in the kernels of xnn.gnn.fast.gemnet_kernels, so nothing triplet-sized beyond the basis is formed, and they are differentiable at any order, so forces and the weight gradients of a force loss take the fused path as well.

Module Attributes

NEVER

"auto" keeps the reference.

AUTO_POLICY

Edge counts above which use_fast="auto" takes the DimeNet kernels in evaluation mode (energy and forces).

AUTO_POLICY_TRAINING

The same for training mode (a step with a force loss, second derivatives included).

PP_AUTO_POLICY

on an A100 the kernels win only on large graphs in float32 and, in float64, where Triton has no tile product and the sums run as multiply-adds, at no size measured (they still need half the memory); on the A30, T4, V100 and L40S they win from about 4k edges in both precisions.

PP_AUTO_POLICY_TRAINING

The same for training mode.

Functions

supported(device, dtype)

Triton kernels on a CUDA device in float32 or float64.