Improved
- The open-source build no longer compiles anything: xFormers is now pure Python. Everything that needs a kernel lives in separate packages, chiefly
mslk. Building from source no longer needs a CUDA toolchain, and no longer needs the CUTLASS submodule. - xFormers now ships as a single
py3-none-anywheel, instead of one wheel per platform and CUDA/ROCm version, so there is no longer any need to match the wheel to your PyTorch build. It is published to all the same places as before — PyPI and each of the PyTorch indices — so none of the installation commands documented in the README need to change. The same wheel also installs on macOS, but the attention ops aren't available there, asmslkhas no macOS build. - The single pure-Python wheel expands platform support: xFormers is now also available for Linux on ARM (aarch64), and on the cu129, cu132, cu134, rocm7.0, rocm7.2 and rocm7.14 PyTorch indices, i.e., on every CUDA and ROCm index of a PyTorch version that xFormers supports.
- Selective activation checkpointing (
xformers.checkpoint) now delegates to PyTorch's publictorch.utils.checkpoint.create_selective_checkpoint_contextsinstead of reaching into PyTorch private internals. This fixes anIndexErrorwith recent PyTorch versions. The public API (checkpoint,get_optimal_checkpoint_policy,list_operators,selective_checkpoint_wrapper) is unchanged, except that in-place ops inside a checkpointed region are no longer supported (see below).
Changed
- The implementation of
xformers.ops.fmhanow lives in themslkpackage, which is now a dependency of xFormers.xformers.ops.fmhare-exports it, so its API is unchanged. In principle, the version ofmslkmust be ABI-compatible with your version of PyTorch (see its compatibility table). On CUDA, xFormers tolerates an incompatiblemslk, as its default attention backends only need mslk's Python code: it switches mslk to its python-only mode, with a warning. On ROCm, some attention backends (e.g. CK) are unavailable ifmslkis incompatible. - In-place ops inside a region checkpointed with an
xformers.checkpointpolicy are no longer supported, as PyTorch 2.13+ rejects them.get_optimal_checkpoint_policynow warns when the policy it builds stores an in-place op; use non-in-place activations instead. - On Windows, FlashAttention-3 is no longer available out of the box:
flash-attn-3only has Windows builds for CUDA 12.x, andmslkonly for CUDA 13.x. With CUDA 12.x, installing a python-onlymslkfrom source works around this (see the README's troubleshooting section).
Fixed
import xformers.opsno longer crashes on PyTorch builds without distributed support, such as the NVIDIA PyTorch containers for Jetson iGPU devices, wheretorch.distributed.is_available()isFalse. The model-parallel and sequence-parallel ops, which cannot work at all there, are simply not imported, and everything else stays usable.- Reusing the policy returned by
get_optimal_checkpoint_policyacross several checkpointed regions no longer raises anIndexError. - The profiler no longer over-counts the FLOPs of the softmax@V product for non-square causal attention.
- The fused reduce-scatter sequence-parallel ops now validate their
outargument correctly.
Deprecated
- The
xformers.checkpointAPI (checkpoint,selective_checkpoint_context_fn,get_optimal_checkpoint_policy,selective_checkpoint_wrapper,list_operators) is deprecated and will be removed in a future release; calling it now raises aFutureWarning. PyTorch provides equivalents:torch.utils.checkpoint.create_selective_checkpoint_contextsfor policy-based selective checkpointing, and thetorch.compileactivation memory budget (torch._functorch.config.activation_memory_budget) for memory-budget-driven recomputation.
Removed
- Removed 2:4 sparsity support:
xformers.ops.sparsify24,xformers.ops.sparsify24_like,xformers.ops.Sparse24Tensor, everything else inxformers.ops.sp24, and the underlyingxformers::sparse24_*operators. PyTorch supports semi-structured (2:4) sparsity natively throughtorch.sparse.to_sparse_semi_structuredandtorch.sparse.SparseSemiStructuredTensor.