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-cu13 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-cu13 0.14.0
File Actions
cuequivariance_ops_torch_cu13-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.27+ x86-64, Linux glibc 2.28+ x86-64 Details for cuequivariance_ops_torch_cu13-0.14.0-cp314-cp314-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
cuequivariance_ops_torch_cu13-0.14.0-cp314-cp314-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl CPython 3.14 CPython 3.14 Linux glibc 2.28+ ARM64, Linux glibc 2.26+ ARM64 Details for cuequivariance_ops_torch_cu13-0.14.0-cp314-cp314-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl
cuequivariance_ops_torch_cu13-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.27+ x86-64, Linux glibc 2.28+ x86-64 Details for cuequivariance_ops_torch_cu13-0.14.0-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
cuequivariance_ops_torch_cu13-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_cu13-0.14.0-cp313-cp313-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl
cuequivariance_ops_torch_cu13-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.27+ x86-64, Linux glibc 2.28+ x86-64 Details for cuequivariance_ops_torch_cu13-0.14.0-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
cuequivariance_ops_torch_cu13-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_cu13-0.14.0-cp312-cp312-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl
cuequivariance_ops_torch_cu13-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_cu13-0.14.0-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
cuequivariance_ops_torch_cu13-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_cu13-0.14.0-cp311-cp311-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl
cuequivariance_ops_torch_cu13-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.28+ x86-64, Linux glibc 2.27+ x86-64 Details for cuequivariance_ops_torch_cu13-0.14.0-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
cuequivariance_ops_torch_cu13-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_cu13-0.14.0-cp310-cp310-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl

Total release size: 438.4 MB

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

Download URL cuequivariance_ops_torch_cu13-0.14.0-cp314-cp314-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Size 43.9 MB
Tags CPython 3.14 Linux glibc 2.27+ x86-64 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
aab6f49ca8f16418565cd6d5a07c449c1fafeb112f2e0a05545838ecb925235e
BLAKE2b-256 checksum
How to use checksums
a11af9f086515090b342d25f7951cd7cf24b61562fbe1ce4b6619dd604de7f62
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_cu13-0.14.0-cp314-cp314-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl

Download URL cuequivariance_ops_torch_cu13-0.14.0-cp314-cp314-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl
Size 43.8 MB
Tags CPython 3.14 Linux glibc 2.26+ ARM64 Linux glibc 2.28+ ARM64
SHA-256 checksum
How to use checksums
ae98bf0c107bfa33b42215c6363ee9bbe2f3175aa459b99aa8ea6e9d8e2f1e7b
BLAKE2b-256 checksum
How to use checksums
45d5aa1dff8f74a1dd3ecda8f971425f8555886c194d1e1afede8207dc50e1de
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_cu13-0.14.0-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl

Download URL cuequivariance_ops_torch_cu13-0.14.0-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Size 43.9 MB
Tags CPython 3.13 Linux glibc 2.27+ x86-64 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
d39ee13a1205574df7882c5abdf815f9a12bc5f43e8191f1e0123145820506cf
BLAKE2b-256 checksum
How to use checksums
5ed5374c10f9bc2abad324ff09c6870084d6b40f2fcfc1aca5116fb56fca5c88
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_cu13-0.14.0-cp313-cp313-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl

Download URL cuequivariance_ops_torch_cu13-0.14.0-cp313-cp313-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl
Size 43.8 MB
Tags CPython 3.13 Linux glibc 2.26+ ARM64 Linux glibc 2.28+ ARM64
SHA-256 checksum
How to use checksums
42cd72be811f395327ef268dbaeba8367235dbbc84d0f4b7b16f587a2c9b568c
BLAKE2b-256 checksum
How to use checksums
d8ea4eca524098ed60ed63bb2536fd14deb6e3ddb8d8e35e61e074f1da7d3fb9
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_cu13-0.14.0-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl

Download URL cuequivariance_ops_torch_cu13-0.14.0-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Size 43.9 MB
Tags CPython 3.12 Linux glibc 2.27+ x86-64 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
ec89c7b8635ef225c549d71466dccfdaacc82d4ee88350e8754dc4346ff6f272
BLAKE2b-256 checksum
How to use checksums
6927202007ee5b9de56f12645349d83c85afc3b8a9847ccf0d8b02d219e827b6
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_cu13-0.14.0-cp312-cp312-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl

Download URL cuequivariance_ops_torch_cu13-0.14.0-cp312-cp312-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl
Size 43.8 MB
Tags CPython 3.12 Linux glibc 2.26+ ARM64 Linux glibc 2.28+ ARM64
SHA-256 checksum
How to use checksums
a4297eb9c7ad1cce7f56a170b6a5838fd89c543546a524b6e717b018b3fc2f5a
BLAKE2b-256 checksum
How to use checksums
3901cdb1d1765d564a261cba2ccaf09f5a82d3b1c057abe9e1012b40e98c90af
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_cu13-0.14.0-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl

Download URL cuequivariance_ops_torch_cu13-0.14.0-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Size 43.9 MB
Tags CPython 3.11 Linux glibc 2.27+ x86-64 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
346cc990727ed7da2f257f8cfd0eb56efb1528c899a2ec50490a5e339a8ce116
BLAKE2b-256 checksum
How to use checksums
8d6ecaf8cf6d53b0dd16b8651f6d216372fbc5d50865a329e8af39b2c03a9bbc
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_cu13-0.14.0-cp311-cp311-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl

Download URL cuequivariance_ops_torch_cu13-0.14.0-cp311-cp311-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl
Size 43.8 MB
Tags CPython 3.11 Linux glibc 2.26+ ARM64 Linux glibc 2.28+ ARM64
SHA-256 checksum
How to use checksums
ae04e888931dc988bcb5b685a083f2194c5474a7ebd668c38721b4a4fc8743ed
BLAKE2b-256 checksum
How to use checksums
6f55dc66250ebdb57d8b7b8c1f7c175d062c03c72b49f2aaac05e60cb7ed4197
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_cu13-0.14.0-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl

Download URL cuequivariance_ops_torch_cu13-0.14.0-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Size 43.9 MB
Tags CPython 3.10 Linux glibc 2.27+ x86-64 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
907144481628bca1053703f74ec3850c04aac07950ef0016a43728122b3310eb
BLAKE2b-256 checksum
How to use checksums
f56e2575385372ca728bcbd77319a4e556fc80b24ff1d208e5740ccaa31ad046
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_cu13-0.14.0-cp310-cp310-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl

Download URL cuequivariance_ops_torch_cu13-0.14.0-cp310-cp310-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl
Size 43.8 MB
Tags CPython 3.10 Linux glibc 2.26+ ARM64 Linux glibc 2.28+ ARM64
SHA-256 checksum
How to use checksums
e9c26c3723fc860945139ddebe6621bacc656fe79c1a30d46bc82178872e1373
BLAKE2b-256 checksum
How to use checksums
05495869556136631343f8492d7b116d559729707185a111ee6dc2256a39e011
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-cu13 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