SYRK
A multi-backend implementation of the Symmetric Rank-K Update (SYRK) operation.
Overview
SYRK computes the symmetric rank-k update operation:
D = α × A × Aᵀ + β × C
Where:
Ais an (N, K) input matrixCis an optional (N, N) symmetric matrixαandβare scalar coefficientsDis the (N, N) symmetric output matrix
Installation
# Basic installation
pip install .
# With Triton backend support
pip install ".[triton]"
# With all optional dependencies
pip install ".[all]"
Quick Start
import torch
from syrk import syrk
# Create input tensor (bfloat16 on CUDA)
a = torch.randn(1024, 512, dtype=torch.bfloat16, device='cuda')
# Compute A @ A^T
result = syrk(a)
print(result.shape) # torch.Size([1024, 1024])
# With scaling factors
result = syrk(a, alpha=0.5)
# With additive term
c = torch.randn(1024, 1024, dtype=torch.bfloat16, device='cuda')
c = (c + c.T) / 2 # Make symmetric
result = syrk(a, c=c, alpha=1.0, beta=0.5)
API Reference
syrk(a, c=None, alpha=1.0, beta=0.0, skip_upper_triangle=False, backend=None)
Compute the Symmetric Rank-K Update operation.
Parameters:
a(torch.Tensor): Input tensor of shape (N, K). Must be bfloat16.c(torch.Tensor, optional): Symmetric input tensor of shape (N, N). Required if beta != 0.alpha(float): Scaling factor for the matrix multiplication. Default: 1.0.beta(float): Scaling factor for the matrix addition. Default: 0.0.skip_upper_triangle(bool): If True, only compute the lower triangle. Default: False.backend(Backend, optional): The backend to use. Auto-selects if None.
Returns:
- torch.Tensor: Output tensor of shape (N, N).
Backends
Triton Backend
The Triton backend provides a high-performance GPU implementation using NVIDIA's Triton compiler. It requires:
- Triton >= 3.4.0 with TMA (Tensor Memory Accelerator) support
- NVIDIA GPU with appropriate compute capability
from syrk import syrk
from syrk.backends import Backend, get_available_backends
# Check available backends
print(get_available_backends()) # [<Backend.TRITON: 'triton'>]
# Explicitly use Triton backend
result = syrk(a, backend=Backend.TRITON)
Requirements
- Python >= 3.9
- PyTorch >= 2.0.0
- (Optional) Triton >= 3.4.0 for Triton backend
License
This project is licensed under the MIT License. See LICENSE for details.
The Triton backend implementation is based on code from NVIDIA Corporation, originally licensed under the Apache License 2.0.
Acknowledgments
- NVIDIA Corporation for the original Triton SYRK implementation
Metadata
Release files for syrk 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| syrk-0.1.1.tar.gz | 8.8 kB | With provenance | Details for syrk-0.1.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| syrk-0.1.1-py3-none-any.whl | Python 3 | none | any | Details for syrk-0.1.1-py3-none-any.whl |
Total release size: 18.0 kB
Release files / syrk-0.1.1.tar.gz
| Download URL | syrk-0.1.1.tar.gz |
|---|---|
| Size | 8.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
52a8fa0580691a0208df99e047a06982ddd06b3bd9a8bf1c70d9d4a1bf79ddab
|
|
BLAKE2b-256 checksum How to use checksums |
f077f5b3386948fd47ff87775f87c3cb7428b19b2f4cbf2a5fc4a07fccf8897b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jan 3, 2026.
Transparency logRelease files / syrk-0.1.1-py3-none-any.whl
| Download URL | syrk-0.1.1-py3-none-any.whl |
|---|---|
| Size | 9.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
c5227d71d981222d5658b64a840bcfba20cfb179cf7cc5074dfd9c9b2bcda99a
|
|
BLAKE2b-256 checksum How to use checksums |
fc9b5c5902336781725837fa07b1367b73fbbebc9c808516c110c330bbdb858b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jan 3, 2026.
Transparency logSecurity for syrk 0.1.1
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.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for syrk-0.1.1.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jan 3, 2026.
Transparency logA 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.