xnn.common.models.compiled#

Blocks compiled into fused kernels (the fast paths of Equiformer, EquiformerV2 and SpookyNet).

A block is a module whose _reference(*args) is its reference forward. On the compiled path, in evaluation mode, torch.compile() runs _reference (with a compiled first derivative for the forces). In training mode the block runs as a function of its weights and floating-point inputs whose first and second derivatives are compiled as well (compile_twice_differentiable()), with the integer inputs (indices) as constants, so a force loss trains through it. A block with dropout that acts (training mode) runs the reference.

Functions

run_compiled(block, *args)

block._reference(*args) on the compiled path (the reference where dropout acts).

supported(device, dtype)

A CUDA device and a Python that torch.compile() supports.