xnn.gnn.fast.allegro#

Fast path of the Allegro tensor product (Triton kernels).

The reference contracts the two per-channel operands of every edge through the block Wigner-3j tensor as one matrix product: it forms their full outer product, d1 * d2 entries per edge and channel, and multiplies it with the dense coupling. The coupling has few nonzero entries (83 of 2835 for l_max = 2). Here one kernel per coupling pattern sums exactly those products per row, with the pattern unrolled and the coefficients read from the module’s own coupling tensor: the outer product is never formed. The contraction is bilinear in the two operands; its gradients are the same contraction with the axes of the coupling permuted, so forces and the weight gradients of a force loss take the kernels at any derivative order.

Module Attributes

AUTO_POLICY

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

AUTO_POLICY_TRAINING

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

Functions

supported(device, dtype)

Triton kernels on a CUDA device in float32 or float64.