Introducing The Sweep: OX’s New Live Security Research Series
Register Now
Breaking: The 2026 Vulnpocalypse Hits PHP: Four Critical RCEs, but How Dangerous Are They?
Read the Report
Are you exposed? Connect your apps in minutes.
Scan your apps free

trnsparse

Latest version: v0.17.0

Overview

Last scanned
25 Nov 2026
Published
25 Nov 2026
PyPI package Publisher: scttfrdmn
0 Stars
0 Forks
13 Versions
1.5K Downloads
Python Repo language

Scan summary

trnsparse was last scanned on 25 Nov 2026 at version 0.17.0. Risk score 0 of 100. No malicious behavior was detected.

  • Releases: 13 versions; the latest was published on 25 Nov 2026.
  • Findings: No rules fired in version 0.17.0.
  • Downloads: 1,472 downloads.

Versions

13 versions published
Versions and the rules that fired in each
VersionPublishedStatus
0.17.0 LATEST 25 Nov 2026 No rules fired
0.16.1 10 Nov 2026 No rules fired
0.16.0 10 Nov 2026 No rules fired
0.15.0 4 Nov 2026 Not shown
0.14.0 3 Nov 2026 Not shown

No rules fired in 0.17.0

Findings

Findings for v0.17.0. The score is a capped sum of the weights of the rules that fired — not CVSS, not exploitability, and not a probability. It is not comparable across packages with different scan coverage.

The score describes 0.17.0; other versions have their own rules, not their own score.

README

The publisher’s own README, as collected from the registry.

trnsparse

CI Ruff PyPI Python License Docs

Sparse matrix operations for AWS Trainium via NKI.

CSR/COO formats, SpMV, SpMM, and integral screening for sparse scientific computing on Trainium. Part of the trnsci scientific computing suite (github.com/trnsci).

Current phase

trnsparse follows the trnsci 5-phase roadmap. Active work is tracked in phase-labeled GitHub issues:

  • Phase 1 — correctness ✅ v0.2.0: NKI SpMM validated on trn1 via densify-then-GEMM (see trnsci/trnsci#3).
  • v0.3.0 ✅ BSRMatrix — Trainium-native 128×128 block-sparse format; bsr_spmm NKI kernel. CSR becomes interop; BSR is the compute path.
  • v0.3.2 ✅ cg_bsr, power_iteration_bsr — iterative solvers over BSR (Python loop; the fused kernel shipped in 0.11.0, below).
  • v0.4.0 ✅ screened_spmm — fused Schwarz-screened SpMM in one NKI dispatch.
  • v0.4.2 ✅ Block-sparse attention — BSRMatrix + bsr_spmm as the primitive; examples/block_sparse_attention.py + docs/sparse_attention.md.
  • v0.4.3 ✅ Architecture-friendly alternatives: chebyshev_bsr / richardson_bsr (fixed-K solvers, no inner products); block_sparse_attention_tiled (two-pass, no O(seq²) intermediate).
  • v0.4.4–v0.6.0 ✅ NKI attention kernel pair, NKI backward, head_dim multiples of 128 (K-tiling).
  • v0.8.0–v0.9.0 ✅ Native TorchNeuron path (Trn2/Trn3): static-structure BSR SpMM and attention kernels, split across both LNC=2 cores, bf16 operands on fp32 PSUM.
  • v0.10.0 ✅ ShardedBSR / ShardedAttention across the logical NeuronCores of one chip; pre-transposed BSR SpMM beats dense aten up to ~82–98% block density on one core.
  • v0.11.0 ✅ cg_bsr_fused / prepare_cg_bsr — one-launch CG and block-Jacobi PCG with A in SBUF (5–56× faster than CPU on Trn2), power_iteration_bsr_fused.
  • Phase 3 — perf: nnz-bucketing CSR, streaming large-sparse — parked on NKI indirect DMA gather.
  • Phase 4 — multi-chip: sharded BSR across chips (within one chip: ShardedBSR, v0.10.0).
  • Phase 5 — generation: trn2 DMA bandwidth exploitation.

(No Phase 2 for trnsparse — precision inherited from trnblas.)

Suite-wide tracker: trnsci/trnsci#1.

Install

pip install trnsparse

# Trn2/Trn3 with TorchNeuron (native PyTorch, Neuron SDK 2.33+)
pip install "trnsparse[torchneuron]" --extra-index-url https://pip.repos.neuron.amazonaws.com

# Trn1 / PyTorch-XLA lineage
pip install "trnsparse[neuron]" --extra-index-url https://pip.repos.neuron.amazonaws.com

Kernels dispatch on whichever Neuron PyTorch lineage is installed:

  • TorchNeuron (native) — Trn2/Trn3, Neuron SDK 2.33+, Python ≥ 3.12, torch 2.14, torch-neuronx 2.14.*. Each kernel is a PyTorch custom op (torch.ops.trnsparse.*) on the neuron device, with its backward attached via register_autograd; no torch_xla.
  • PyTorch/XLA — Trn1 (and any host on the torch-neuronx 2.9 lineage). Kernels dispatch through torch_xla, unchanged.

Placement on the native path: the neuron device has no sparse CSR tensors, so keep sparse structure (CSR row_ptrs / col_indices, BSR block_row_ptrs / block_col_indices) on the host and put dense operands (and BSR blocks) on device="neuron". Results come back on the dense operand's device. See installation.

Set TRNSCI_NKI_DISPATCH=native|xla|cpu (shared by all trnsci libraries) to force a path. With an editable install (pip install -e), set NKI_ENABLE_TRACE_CACHE=0: the NKI kernel cache only versions installed wheels and can serve stale kernels.

Known platform issue: NKI trace cache and kernel factories

import torch_neuronx turns on the NKI trace cache, and the cache key ignores constants captured in a kernel's closure: two @nki.jit kernels built by one factory, differing only in a captured value, share one trace, and the second silently returns the first's results (aws-neuron/aws-neuron-sdk#1454). trnsparse's kernels do not rely on closure constants (or on module globals that can differ between processes): every value that specialises a kernel is a kernel argument, and tests/test_trace_cache_safety.py enforces this. If you write your own NKI kernels with a factory, set NKI_ENABLE_TRACE_CACHE=0 before importing torch_neuronx.

Known issues in earlier releases

Silent wrong results fixed in the 2026-10-31 to 2026-11-04 releases. If you use an affected version, upgrade. Details are in the CHANGELOG.

Bug Affected Fixed in
block_sparse_attention_tiled returned zero rows for a partial last block (PyTorch path) (#44) 0.6.0–0.10.0 0.11.0
block_sparse_attention_tiled ignored a custom scale on the NKI paths (#47) 0.6.0–0.11.0 0.12.0
spmv_symmetric ignored uplo and used both triangles (#52) through 0.12.0 0.12.1
COOMatrix.to_dense dropped duplicate entries instead of summing them (#56) 0.1.1–0.12.1 0.13.0
from_scipy dropped the imaginary part of complex matrices (#58) 0.1.1–0.12.1 0.13.0
Second derivatives of block_sparse_attention_tiled were wrong (#65) 0.6.0–0.12.1 0.13.0
spmv / spmm accepted a y / C that broadcast the output to a larger shape (#67) 0.1.1–0.12.1 0.13.0
chebyshev_coeffs / chebyshev_bsr were not the Chebyshev polynomial for K >= 2 (#73) 0.4.3–0.12.1 0.13.0
bsr_diagonal returned length m (zero-padded) for a tall matrix (#74) 0.3.2–0.12.1 0.13.0
bsr_spmm dropped the imaginary part of complex operands on the NKI backend (#78) 0.8.0–0.12.1 0.13.0
spmv / spmm returned float32 for integer operands on the device (#79) through 0.12.1 (device CSR path) 0.13.0
block_sparse_attention_tiled accepted a mask smaller than seq_len on the NKI path (#82) 0.10.0–0.12.1 0.13.0
Integer, bool and complex operands reached the fp32/bf16 NKI kernels: the static attention kernels dropped the imaginary part of complex Q/K/V, and the static bsr_spmm and attention kernels cast integers to fp32 and back (trnsci/trnsci#35) every release with NKI kernels through 0.13.0, NKI / auto backends 0.14.0
from_scipy downcast float64 to float32 (~3e-8 rel. err), int64 to float32 (exact only up to 2^24) and complex128 to complex64 (#69) 0.1.1–0.13.0 0.14.0
cg_bsr gave wrong gradients: autograd differentiated a frozen-coefficient polynomial, not the solve (b.grad ~20% off) (#70) 0.3.2–0.13.0 0.14.0
power_iteration_bsr gave wrong gradients (frozen normalisation; v0 got a spurious gradient) (#96) 0.3.2–0.13.0 0.14.0
cg_bsr reported iters = max_iter after a breakdown, e.g. 500 for a one-step solve (#71) 0.3.2–0.13.0 0.14.0
cg_bsr_fused / power_iteration_bsr_fused dropped the imaginary part of complex input and truncated integer / bool b, on every backend (#85) 0.11.0–0.13.0 0.14.0

Usage

import torch
import trnsparse

# Dense → sparse
A = torch.randn(100, 100)
A[torch.abs(A) < 1.0] = 0.0
csr = trnsparse.from_dense(A)

# SpMV: y = A @ x
y = trnsparse.spmv(csr, x, alpha=2.0)

# SpMM: C = A @ B
C = trnsparse.spmm(csr, B)

# Integral screening
Q = trnsparse.schwarz_bounds(diagonal_integrals)
mask = trnsparse.screen_quartets(Q, threshold=1e-10)
stats = trnsparse.sparsity_stats(Q)

Operations

OX Radar and Response Center

Find threats in your stack.

OX Radar can check high-priority threats, like critical package CVEs, against your context.

Each incident is marked Detected or Not Detected with a remediation plan and proof all tracked in the Response Center.

Where it’s listed

The probe returned only these fields for this server — auth requirement, protocol and tool list weren’t observed, so they’re not shown (never guessed).

  • pypi-releases trnsparse

References

The publisher’s own links, as the registry reports them. These are not sources for the assessment on this page.

Scan your whole stack

Group 1261154050 1
Group 1261154050
 

From OX Research Newsroom

CVE

Java4Shell (CVE-2026-114938): Easy to Crash, Hard to Exploit — Less Than 0.12% of JVMs Estimated at Risk of RCE

Ethersphere Hijacked With Crypto Stealing Malware (1)
npm

Ethersphere Hijacked With Crypto Stealing Malware Via Github & npm

The 2026 Vulnpocalypse Hits PHP: Four Critical RCEs, but How Dangerous Are They?
Vulnerability Insights

The 2026 Vulnpocalypse Hits PHP: Four Critical RCEs, but How Dangerous Are They?

Frame 2085668439 (1)
Group 1261154229