xnn.hybnn.fast.spookynet#
Fast paths of SpookyNet: a compiled block for evaluation, fused MLPs for training.
Evaluation: the interaction modules, the nonlocal attention included, run as one block compiled with
torch.compile() (see xnn.common.models.compiled). The sizes of the attention’s padding (the
structures and the largest structure) enter as the shape of an input, so a new batch does not compile
the block again. The compiled code fuses the elementwise work of all modules, which is what a SpookyNet
evaluation spends its launches on.
Training: every residual MLP (the grouped ones of the local and nonlocal interactions, the single ones
and the residual blocks) runs as one fused function per pass, its second derivatives included
(xnn.hybnn.fast.mlp_kernels). They run a quarter fewer kernels than the reference, which counts
in captured steps; in ordinary steps on small systems their orchestration on the host costs as much.
Module Attributes
the reference. |
|
below an edge count, since it saves kernel launches. |
|
Edge counts above which |
|
The same for a captured training step (a padded batch with an index plan, replayed as a CUDA graph), where only the GPU's work counts: the fused MLPs run fewer kernels at every size (not in float64 on an L40S or a T4). |
Functions
|
The fused MLP layers ( |
|
|
|
|
|
torch.compile on a CUDA device in float32 or float64. |