INDEPENDENT · APACHE 2.0 · PRE-ALPHA

Tensor compute.
From Python
to silicon.

A compact tensor runtime for people who want to understand what runs underneath. Python up front. C++20 at the core. CPU, Metal, CUDA and an optional Vulkan backend behind one interface.

Experimental by design. Explicit about its limits.

first_tensor.pyPYTHON
import tensorcx as cx

device = cx.best_device()
x = cx.ones((1_000_000,), dtype=cx.float32, device=device)
y = cx.ones((1_000_000,), dtype=cx.float32, device=device)

z = x + y
print(z.cpu().numpy()[:5])
# [2. 2. 2. 2. 2.]
OUTPUT[2. 2. 2. 2. 2.]One million elements. One familiar API.
Python APIC++20 core backend-neutral
CPUMetalCUDAVulkan
INTERFACEPython 3.11+FOUNDATIONC++20 / nanobindEXECUTIONSynchronous & explicitLICENSEApache 2.0

01 / THE APPROACH

Small enough to follow.
Built to be understood.

Explore tensor execution without losing sight of the runtime, the memory, or the hardware.

[01]

Correctness has a reference.

CPU execution is a required part of the runtime. Accelerator operations are checked against it with explicit numerical tolerances.

[02]

The core stays neutral.

Device discovery, buffers, and operation dispatch share a contract. Platform-specific details stay inside each backend.

[03]

Experiments stay explicit.

Custom kernels live under cx.experimental. Metal code generation and optional MLIR compilation have defined, narrow scopes.

02 / AVAILABLE TODAY

From tensor operations
to runtime tools.

Features & roadmap

Tensor data and math

Slicing, concat/stack/split, boolean masks, broadcasting, batched matmul, reductions and selection with topk.

Inference building blocks

Linear layers, affine normalization, embedding and scaled dot-product attention. Explicit execution, without model training.

Share supported storage

CUDA/Vulkan shared allocations on matching GPUs, host-staged placement, CPU/CUDA DLPack and an optional PyTorch linear custom op.

Compile explicit kernels

Experimental Metal MSL and guarded float32 CPU/CUDA/Vulkan MLIR kernels: arithmetic, sqrt/abs/exp/log/rsqrt/tanh/sigmoid/SiLU, minimum/maximum, comparisons and select. Persistent code caching.

Inspect and measure

Installation diagnostics, memory snapshots and Vulkan owned allocations. Host profiling, CUDA kernel events, Vulkan copy/compute timestamps and separate compilation measurements.

Control allocation

Opt-in CUDA/Vulkan buffer reuse, Vulkan staging and command reuse, and direct device empty allocation. Synchronous operations; empty contents remain unspecified.

Availability depends on backend, dtype and the validated environment. The feature overview keeps implemented capabilities and remaining work together.

03 / HARDWARE, HONESTLY

Know what runs. And where.

Full support matrix

Current scope: contiguous tensors, broadcasting, explicit devices and dtype conversion. Autograd and distributed training are outside the current runtime.

Execution experiments
NVIDIA OpenCL, PoCL CPU and Mesa lavapipe probes are validated separately from runtime backend support.

04 / OPEN THE WORKBENCH

Start with a tensor.
Follow it all the way down.