Correctness has a reference.
CPU execution is a required part of the runtime. Accelerator operations are checked against it with explicit numerical tolerances.
INDEPENDENT · APACHE 2.0 · PRE-ALPHA
A compact tensor runtime for people who want to understand what runs underneath. Python up front. C++20 at the core. CPU, Metal, and CUDA behind one interface.
Experimental by design. Explicit about its limits.
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.][2. 2. 2. 2. 2.]One million elements. One familiar API.01 / THE APPROACH
Explore tensor execution without losing sight of the runtime, the memory, or the hardware.
CPU execution is a required part of the runtime. Accelerator operations are checked against it with explicit numerical tolerances.
Device discovery, buffers, and operation dispatch share a contract. Platform-specific details stay inside each backend.
Custom kernels live under cx.experimental. Metal code generation and optional MLIR compilation have defined, narrow scopes.
02 / AVAILABLE TODAY
Slicing, concat/stack/split, boolean masks, broadcasting, batched matmul, reductions and selection with topk.
Linear layers, affine normalization, embedding and scaled dot-product attention. Explicit execution, without model training.
DLPack exchange on CPU and CUDA, plus an optional inference-only PyTorch linear custom op.
Experimental Metal MSL and guarded float32 CPU/CUDA MLIR kernels, including division, sqrt/abs, minimum/maximum, comparisons and select. Persistent code caching.
Installation and capability diagnostics, CPU/CUDA memory snapshots, native host profiling and separate compilation measurements.
Opt-in bounded buffer reuse and direct CUDA 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
The required baseline. Tensor operations, matmul, reductions, and normalization.
MetalAPPLE SILICONStatic Metal kernels, an optional optimized matmul path, and experimental generated kernels.
CUDAOPT-INFloat32/int32/bool data paths, inference primitives and opt-in memory reuse. Real-device validation is limited to sm_52.
Current scope: contiguous tensors, broadcasting, explicit devices and dtype conversion. Autograd and distributed training are outside the current runtime.
04 / OPEN THE WORKBENCH