Skip to main content

cuequivariance-ops-torch

Introduction

cuequivariance_ops_torch provides CUDA kernels for the cuEquivariance project's PyTorch components. As such, it contains pytorch bindings to optimized kernels that cuEquivariance's operations map down to. In general, we advice that you access those kernels through cuEquivariance, but you may also find them useful on their own.

Installation

Please install using either pip install cuequivariance-ops-torch-cu12 or pip install cuequivariance-ops-torch-cu13 (depending on the CUDA toolkit you wish to use).

Kernel Factory TriMul kernels

On CUDA 13 wheels, triangle_multiplicative_update runs prebuilt Kernel Factory (KF) TriMul kernels for BF16 calls on the exact shapes each kernel was validated on, on H100 SXM (80GB HBM3), H200, GH200 480GB, B200 and RTX PRO 6000 Blackwell (Server and Workstation Edition). Every other call keeps the existing implementation. The kernels ship as prepackaged cubins and need nothing extra; their outputs match the existing implementation within its numerical tolerance, not bitwise. (Development builds may register a kernel in its CuTe DSL JIT form; that needs nvidia-cutlass-dsl[cu13]==4.7.0 and apache-tvm-ffi==0.1.14.post0, which are not dependencies of the published package. Without them, dispatch keeps the existing implementation.)

A call reaches KF only when the pair AND the module's parameters are BF16, or when FP32 inputs are passed with precision="bfloat16" (the op rounds them first). The automatic mixed precision default, a BF16 pair with FP32 parameters (with or without BF16 autocast), keeps the existing implementation in 0.13 (an FP32-input KF variant is BIO-1329).

In training, a second backward through one forward (retain_graph=True) recomputes the forward and is exact in eager mode, but transiently needs about 1.9x the first backward's memory. Replayed from a CUDA graph, such a second backward gives NaN gradients by design (loud, never silently wrong; the first backward of every replay is exact), where the existing implementation returns correct gradients. Double backward (create_graph=True) raises.

Some KF kernels synchronise their thread blocks with software grid barriers and assume exclusive use of the GPU: under MPS sharing without SM partitions they can hang.

The environment variable CUEQ_TRIMUL_KF_CAMPAIGN selects the mode. It is read once, when cuequivariance_ops_torch is imported:

Value Mode
unset, auto, 1, true, on, yes Default. KF runs where it is admitted (see above); every other call, and any call whose kernel is unavailable on this install or GPU, runs the existing implementation.
0, false, off, no KF disabled: the existing implementation everywhere.
force Testing only. Every BF16 no-grad call on a GPU with a registered KF kernel must run KF; such a call outside the admitted shapes raises instead of falling back. Calls KF never takes (non-BF16, grad-enabled) keep the existing implementation.

Any other value warns and uses the default. Values are case-insensitive.

KF under torch.compile

KF covers the allow-listed shapes, and under torch.compile each one gets its own compiled graph of the calling function. Dynamo keeps at most torch._dynamo.config.recompile_limit graphs per function (8 by default), so with the default torch.compile (automatic dynamic shapes) up to recompile_limit - 2 distinct listed shapes per process get KF once shapes start to vary; further new shapes use the cuEq 0.12 route on one shared dynamic graph (logged once). A shape that already has a KF graph keeps it, results are unaffected, and the calling function never exceeds the limit because of KF when its batch size is fixed. For KF on many shapes, compile with dynamic=False and raise torch._dynamo.config.recompile_limit above the number of shapes. Under DDP or multi-node training each rank applies the limit on its own, so ranks that see shapes in different orders may run KF on different shapes: correctness is unaffected, and a small speed imbalance between ranks is possible.

KF TriMul kernels are used for training only through the packed op (triangle_multiplicative_update); the split-parameter entry (triangle_multiplicative_update_split_parameters) does not use KF for training in 0.13 (it uses the SM90 training owner where that applies, else the PyTorch formula), even where the training shape query answers True or prepare_..._training reports "owner": "kf".

Exported models use the cuEq 0.12 route in 0.13: torch.export (strict or non-strict) and ONNX export (and so TensorRT) never record a KF kernel, and neither does a trace with symbolic sizes outside torch.compile (e.g. make_fx or FakeTensorMode).

Documentation

For detailed usage information of the kernels, please refer to the doc-strings in their respective modules. For higher-level documentations, refer to cuEquivariance.

Pairformer inference primitives

The Torch package also exposes lower-level primitives for integrating Pairformer inference graphs:

  • attention_pair_bias_mask_from_normalized projects an already-normalized pair representation and applies an arbitrary Boolean [B,U,V] mask. The implementation is shape-generic; BF16 D=256, H=16, and square sequence lengths 384 and 512 are the performance-validated configurations. FP16 and BF16 inputs use native low-precision tensor-core products with FP32 accumulation; FP32 inputs retain the higher-accuracy TF32x3 path.
  • pair_update_finalize_masked_attention_bias finalizes a pair residual and, on the shapes admitted for the device's exact compute capability, also returns the next layer's already-masked BF16 attention bias, which attention_pair_bias_masked_cache(..., is_cached_z_proj=True) consumes in place of attention_pair_bias. The canonical shape bounds and measurement scope are in _apb_route_policy.py: _pair_update_finalize_admits for exact capabilities (9, 0), (10, 0) and (12, 0), and _sm100_apb_block_kf_admits for the embedded block. The consumer computes any cache it is handed. On (10, 0) and (10, 3) both halves are taken over by the embedded Kernel Factory APB block (apb_kf_sm100_torch: six CUBINs per exact SM, sm_100a and sm_103a from one source, launched through the CUDA driver, no CuTeDSL at runtime) inside its admitted hull for D_z=384, H=12, DH=64, when the producer has no pair-projection bias and the consumer receives the packed QKV projection with bias, both q/k norm weights and the gate/output biases.
  • pairformer_combined_triangle_multiplication combines incoming and outgoing triangle multiplication after caller-provided non-affine LayerNorm with epsilon 1e-5. Its fused direction join applies the affine middle LayerNorm with epsilon 0.03. This operation intentionally fails closed outside BF16 inference with B=1, D=256, sequence length 384 or 512, and an SM100 GPU. The caller guarantees that the second normalized carrier is the separately materialized spatial transpose of the first; the hot path validates metadata and distinct storage but does not compare tensor contents. It returns the base update before any caller-owned peri-LayerNorm, output mask, dropout, or residual addition; model-level dropout must be disabled for inference. Use pack_pairformer_grouped_projection to convert grouped projection weights to the expected payload/gate layout.

Both operations are registered as torch.library custom operators with fake implementations for torch.compile tracing. See their Python docstrings for the complete input contracts.

Calling convention for declined cells

Call triangle_multiplicative_update unconditionally. Under torch.compile a BF16 cell no kernel owner admits (any architecture, hidden width 256 with a pair width in 256..512 -- the measured band; inference or training) runs the package's compiler-visible reference formula, which is written the way a model's own module is (one gated projection per operand under autograd, one fused projection GEMM without it, contiguous contraction operands) and compiles to the same kernels or better, so a declined call costs no more than the caller's native path (measured on L40S, A100 and H200: inference 1.10-1.50x, training 0.98-1.01x of RFD4's compiled module; the generic Triton route the op used to take there measured 0.58-0.88x). An eager no-grad call no owner admits runs the fused generic route from 2**15 pair rows (B * S * S) and the reference formula below, where the generic route's dispatch cost is not repaid. The shape predicate (triangle_multiplicative_update_inference_shape_is_supported) exists for callers that must decide before the tensors exist; it is not needed to avoid a penalty.

Usage

You can import the library from python:

import cuequivariance_ops_torch

Kernels are primarily exposed as torch.nn.Module, but also provide a lower-level interface as torch.library operators. Generally, the module is responsible for proper input transformation and initialization, and the operator execute the kernel. This allows you to export models using this operations using torch.export, and running inference on them using TensorRT.

Support and Feedback

Please contact the cuEquivariance developers for any issues you might encounter.

Metadata

Release files for cuequivariance-ops-torch-cu12 0.14.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distributions (wheels)

Table of built distributions (wheels) for cuequivariance-ops-torch-cu12 0.14.0
File Actions
cuequivariance_ops_torch_cu12-0.14.0-cp314-cp314-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl CPython 3.14 CPython 3.14 Linux glibc 2.28+ x86-64, Linux glibc 2.27+ x86-64 Details for cuequivariance_ops_torch_cu12-0.14.0-cp314-cp314-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
cuequivariance_ops_torch_cu12-0.14.0-cp314-cp314-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl CPython 3.14 CPython 3.14 Linux glibc 2.26+ ARM64, Linux glibc 2.28+ ARM64 Details for cuequivariance_ops_torch_cu12-0.14.0-cp314-cp314-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl
cuequivariance_ops_torch_cu12-0.14.0-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl CPython 3.13 CPython 3.13 Linux glibc 2.28+ x86-64, Linux glibc 2.27+ x86-64 Details for cuequivariance_ops_torch_cu12-0.14.0-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
cuequivariance_ops_torch_cu12-0.14.0-cp313-cp313-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl CPython 3.13 CPython 3.13 Linux glibc 2.26+ ARM64, Linux glibc 2.28+ ARM64 Details for cuequivariance_ops_torch_cu12-0.14.0-cp313-cp313-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl
cuequivariance_ops_torch_cu12-0.14.0-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl CPython 3.12 CPython 3.12 Linux glibc 2.28+ x86-64, Linux glibc 2.27+ x86-64 Details for cuequivariance_ops_torch_cu12-0.14.0-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
cuequivariance_ops_torch_cu12-0.14.0-cp312-cp312-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl CPython 3.12 CPython 3.12 Linux glibc 2.26+ ARM64, Linux glibc 2.28+ ARM64 Details for cuequivariance_ops_torch_cu12-0.14.0-cp312-cp312-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl
cuequivariance_ops_torch_cu12-0.14.0-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl CPython 3.11 CPython 3.11 Linux glibc 2.27+ x86-64, Linux glibc 2.28+ x86-64 Details for cuequivariance_ops_torch_cu12-0.14.0-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
cuequivariance_ops_torch_cu12-0.14.0-cp311-cp311-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl CPython 3.11 CPython 3.11 Linux glibc 2.26+ ARM64, Linux glibc 2.28+ ARM64 Details for cuequivariance_ops_torch_cu12-0.14.0-cp311-cp311-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl
cuequivariance_ops_torch_cu12-0.14.0-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl CPython 3.10 CPython 3.10 Linux glibc 2.27+ x86-64, Linux glibc 2.28+ x86-64 Details for cuequivariance_ops_torch_cu12-0.14.0-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
cuequivariance_ops_torch_cu12-0.14.0-cp310-cp310-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl CPython 3.10 CPython 3.10 Linux glibc 2.28+ ARM64, Linux glibc 2.26+ ARM64 Details for cuequivariance_ops_torch_cu12-0.14.0-cp310-cp310-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl

Total release size: 18.3 MB

Release files / cuequivariance_ops_torch_cu12-0.14.0-cp314-cp314-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl

Download URL cuequivariance_ops_torch_cu12-0.14.0-cp314-cp314-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Size 1.8 MB
Tags CPython 3.14 Linux glibc 2.27+ x86-64 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
6aca7ab1a170483d28552b00009a0a6ffd6907a53e8f988235755c6c126c5797
BLAKE2b-256 checksum
How to use checksums
c1bad8e8e3b4a0d66ce7fab17f6615c16f0ac4d8bf320c42a2b3064671f4e842
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.9.6

Release files / cuequivariance_ops_torch_cu12-0.14.0-cp314-cp314-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl

Download URL cuequivariance_ops_torch_cu12-0.14.0-cp314-cp314-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl
Size 1.8 MB
Tags CPython 3.14 Linux glibc 2.26+ ARM64 Linux glibc 2.28+ ARM64
SHA-256 checksum
How to use checksums
e54997b05f6c258c4d5319f21ff7499bb16e10af40a6beb9bfd52c50281dd05e
BLAKE2b-256 checksum
How to use checksums
5c8a1aea3d9d318f8e472164728b5a69c9007f699034f9fc7997dcbf616c8090
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.9.6

Release files / cuequivariance_ops_torch_cu12-0.14.0-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl

Download URL cuequivariance_ops_torch_cu12-0.14.0-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Size 1.8 MB
Tags CPython 3.13 Linux glibc 2.27+ x86-64 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
b66bbdf5082bd25fb85b83a1892e2d67b5b2c57e5a8cbee0f19a37c450eeca1c
BLAKE2b-256 checksum
How to use checksums
240319a0451d8993037e6238adb5ab4352d917645b02c02749cec8eefae05b7f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.9.6

Release files / cuequivariance_ops_torch_cu12-0.14.0-cp313-cp313-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl

Download URL cuequivariance_ops_torch_cu12-0.14.0-cp313-cp313-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl
Size 1.8 MB
Tags CPython 3.13 Linux glibc 2.26+ ARM64 Linux glibc 2.28+ ARM64
SHA-256 checksum
How to use checksums
49b70af05afb434ef2cc609275e219c595f1e2026b7d2bcabb40bd03eeb89d08
BLAKE2b-256 checksum
How to use checksums
a7abffd771fcfb120b13913e5a55e1bee862d47a947940ae7c60cf5c8fd7c8b0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.9.6

Release files / cuequivariance_ops_torch_cu12-0.14.0-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl

Download URL cuequivariance_ops_torch_cu12-0.14.0-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Size 1.8 MB
Tags CPython 3.12 Linux glibc 2.27+ x86-64 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
f184c3dfa445180d739522e2c2340a54c75ff79adae8710951d215bea257aea4
BLAKE2b-256 checksum
How to use checksums
4120911c9bb0b770a08ceae65c9360189aa9021991e226d374389a2f7e417dda
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.9.6

Release files / cuequivariance_ops_torch_cu12-0.14.0-cp312-cp312-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl

Download URL cuequivariance_ops_torch_cu12-0.14.0-cp312-cp312-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl
Size 1.8 MB
Tags CPython 3.12 Linux glibc 2.26+ ARM64 Linux glibc 2.28+ ARM64
SHA-256 checksum
How to use checksums
e810c70f9f8a7a6a6c662756176970375ff8e581be0359364bd3ff494358cec5
BLAKE2b-256 checksum
How to use checksums
131aa699a658cc2c17a9c68ed2b7841a6f5c3f7df46094c30e296d93e4e9359c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.9.6

Release files / cuequivariance_ops_torch_cu12-0.14.0-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl

Download URL cuequivariance_ops_torch_cu12-0.14.0-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Size 1.8 MB
Tags CPython 3.11 Linux glibc 2.27+ x86-64 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
a6b3908bafc627c37ba9c65f9f9a4c739fa8053abf20b3f6f5e7014e6ffa139e
BLAKE2b-256 checksum
How to use checksums
1ca4a82447ad9e459eb60e6a482bcffdc2e45e2bea62d5f710aafd95f245afa7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.9.6

Release files / cuequivariance_ops_torch_cu12-0.14.0-cp311-cp311-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl

Download URL cuequivariance_ops_torch_cu12-0.14.0-cp311-cp311-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl
Size 1.8 MB
Tags CPython 3.11 Linux glibc 2.26+ ARM64 Linux glibc 2.28+ ARM64
SHA-256 checksum
How to use checksums
7c8df9781dcc3e2120be8b1bc7adb9341523e1a8c7bc0b266cc72da8f8fc24fb
BLAKE2b-256 checksum
How to use checksums
a4c2b999c035fc00c876c583f4b061742f3548fc7fb0b80e934a6b51932b74ba
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.9.6

Release files / cuequivariance_ops_torch_cu12-0.14.0-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl

Download URL cuequivariance_ops_torch_cu12-0.14.0-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Size 1.8 MB
Tags CPython 3.10 Linux glibc 2.27+ x86-64 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
4e34e2932890c71bba23476de9a6bf224bd2598292c3d186a31691cdd073fb28
BLAKE2b-256 checksum
How to use checksums
1522fc266d8dc98654ec2b2dab4f36962af707498f8a15a8322e4efc9de7ec03
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.9.6

Release files / cuequivariance_ops_torch_cu12-0.14.0-cp310-cp310-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl

Download URL cuequivariance_ops_torch_cu12-0.14.0-cp310-cp310-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl
Size 1.8 MB
Tags CPython 3.10 Linux glibc 2.26+ ARM64 Linux glibc 2.28+ ARM64
SHA-256 checksum
How to use checksums
4b06c2f92c6226d93f4cd533deec8369f8ea0635484f5eb93cad8cafa12c80ec
BLAKE2b-256 checksum
How to use checksums
803a87eba423e2cb42f0a08642ef74276ff13d39b7feaa7b6fc795f7e3ef0c8b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.9.6

Security for cuequivariance-ops-torch-cu12 0.14.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page