Kris Bailey

Project

Kernelith

A PyTorch PrivateUse1 backend for Apple Silicon with the goal of supporting everything PyTorch provides that is applicable to Apple hardware.

Current Status: Unreleased - in development

The project

Broad PyTorch support on Apple Silicon

Kernelith is a PrivateUse1 backend built to make Apple Silicon a broad PyTorch compute target instead of supporting only the most common machine learning paths.

The goal is across the board support for everything applicable to Apple hardware that PyTorch supports. That includes normal machine learning workloads, scientific computing, awkward dtypes, complex numbers, sparse layouts, compilation, autograd, and the less common operations that are easy for a backend to ignore.

Release

Currently unreleased

Kernelith is still in development and is not available yet. I plan to release it soon under an open source compatible Business Source License (BSL).

At a glance

Kernelith by the numbers

These structural statistics come from Kernelith's local source tree and generated inventories, refreshed September 4, 2026.

2,866
Backend dispatch entries inventoried
2,180
Native GPU dispatch entries
99.8%
Autograd contract ownership: 2,140 of 2,144 rows

Dispatch entries include ATen, custom, fake, autograd, fallback, and compatibility registrations.

Coverage

PyTorch feature matrix

This is the major end to end capability surface for a general PyTorch backend. It is not a list of every individual operator. The scope is based on the current PyTorch 2.14 documentation and separates dtypes and layouts where partial support can easily be hidden by a broad claim.

Status snapshot: September 4, 2026. Kernelith currently pins PyTorch 2.12, while this matrix also includes newer PyTorch 2.14 surface area. Green means the capability is implemented and tested for the scope described here. Red means it is intentionally skipped, unavailable, or unsupported. Gray means partial, pending, or not yet verified. Green rows are complete for the scope stated in that row. Percentages on gray Partial rows are engineering estimates of usable surface coverage, not test pass rates.

Supported Partial or pending Unsupported or skipped
Capability PyTorch scope and notes Kernelith
Backend foundation
PrivateUse1 registrationBackend name, device module, generated Tensor and Module methods, and operator registration.Supported
Tensor factories and allocationCreation through empty, zeros, ones, full, ranges, and like factories directly on the device.Supported
Caching allocator and memory diagnosticsCaching allocation, split and merge behavior, deferred release, memory statistics, snapshots, and out of memory diagnostics.Supported
CPU and device transfersCopies in both directions, dtype conversion, nonblocking paths where possible, and scalar transfer behavior.Supported
Storage, strides, and viewsDense strided storage, reshape, view, transpose, permutation, slicing, and storage offsets.Supported
Noncontiguous tensorsCorrect execution on transposed, sliced, expanded, and otherwise noncontiguous inputs and outputs.Supported
Broadcasting and type promotionPyTorch broadcasting, scalar handling, mixed dtype promotion, casting, and output dtype rules. Broad coverage is present, with remaining low precision and complex edge combinations.
Remaining: Cover the remaining low precision and complex promotion and casting combinations.
Partial (95%)
Random generatorsSeeded device generation, generator state, reproducibility, and random sampling operators.Supported
Serialization and checkpointsSaving, loading, map_location handling, state dictionaries, and device remapping.Supported
Streams, events, and synchronizationAsynchronous execution primitives, dependency tracking, explicit synchronization, and timing where the hardware permits them.Supported
Meta and fake tensor behaviorShape and dtype propagation used by tracing, compilation, export, and operator validation. Upstream ATen coverage and nearly all custom operators are covered, with a small custom surface remaining.
Remaining: Add Meta and FakeTensor coverage for the remaining custom schemas.
Partial (98%)
Profiler integrationCPU-side operator records are visible, but Metal device timing, memory activity, and trace correlation are not implemented.
Remaining: Add Metal device activities, timing, memory events, and trace correlation.
Partial (25%)
Dtypes
torch.boolBoolean tensors and logical, comparison, indexing, masking, and reduction behavior.Supported
torch.uint8Standard unsigned 8 bit integer dtype.Supported
torch.uint16Unsigned 16 bit shell dtype with limited eager operator support in PyTorch.Supported
torch.uint32Unsigned 32 bit shell dtype with limited eager operator support in PyTorch.Supported
torch.uint64Unsigned 64 bit shell dtype with limited eager operator support in PyTorch.Supported
torch.int8Signed 8 bit integer tensors.Supported
torch.int16Signed 16 bit integer tensors.Supported
torch.int32Signed 32 bit integer tensors.Supported
torch.int64Signed 64 bit integer tensors and the default integer index dtype.Supported
torch.float4_e2m1fn_x2Packed container dtype with two 4 bit E2M1 values per byte. Codec and storage foundations exist, but public scaled matrix multiplication integration is not yet correct.
Remaining: Correct packed FP4 decode and scale behavior in torch._scaled_mm and verify the public path.
Partial (60%)
torch.float8_e4m3fnContainer dtype with tested storage, conversion, codec, and scaled matrix multiplication paths.Supported
torch.float8_e5m2Container dtype with tested storage, conversion, and codec paths.Supported
torch.float8_e4m3fnuzContainer dtype with nonstandard NaN and unsigned zero encoding; storage and conversion paths are supported.Supported
torch.float8_e5m2fnuzContainer dtype with nonstandard NaN and unsigned zero encoding; storage and conversion paths are supported.Supported
torch.float8_e8m0fnuUnsigned E8M0 container dtype used for microscaling metadata; storage and conversion paths are supported.Supported
torch.float16IEEE half precision floating point.Supported
torch.bfloat16Brain floating point with an 8 bit exponent and 7 bit mantissa.Supported
torch.float32IEEE single precision floating point and PyTorch's default floating dtype.Supported
torch.float64IEEE double precision through software and host execution policies because Apple GPUs do not provide native float64 arithmetic. Coverage is broad but not universal.
Remaining: Expand software and host implementations to the remaining math and linear algebra operations.
Partial (80%)
torch.complex32Complex shell dtype made from two float16 components. Also called torch.chalf. Operator coverage is narrower than for complex64.
Remaining: Add the remaining reductions, special math, and linear algebra paths.
Partial (80%)
torch.bcomplex32Complex shell dtype made from two bfloat16 components. It is not available in Kernelith's pinned PyTorch 2.12 baseline.Unavailable
torch.complex64Complex dtype made from two float32 components. Arithmetic, reductions, FFT, indexing, and most linear algebra work, with remaining linear algebra gaps.
Remaining: Close the outstanding complex64 linear algebra overloads and edge cases.
Partial (95%)
torch.complex128Complex dtype made from two float64 components. Storage, movement, and selected host or software math paths work, but operator coverage remains uneven.
Remaining: Expand arithmetic, reductions, and linear algebra beyond movement and selected host paths.
Partial (60%)
Layouts and memory formats
Dense strided layouttorch.strided tensors with arbitrary valid sizes, strides, and storage offsets.Supported
Contiguous memory formatStandard dense nonoverlapping storage with decreasing strides.Supported
Channels last 2Dtorch.channels_last NHWC memory format for 4D tensors.Supported
Channels last 3Dtorch.channels_last_3d NDHWC memory format for 5D tensors.Supported
Sparse COOCoordinate format, including coalesced and uncoalesced tensors.Supported
Sparse CSRCompressed sparse row format.Supported
Sparse CSCCompressed sparse column construction, conversion, and sparse operator dispatch.Supported
Sparse BSRBlock compressed sparse row construction, conversion, and sparse operator dispatch.Supported
Sparse BSCBlock compressed sparse column construction, conversion, and sparse operator dispatch.Supported
Sparse batching and hybrid dimensionsBatched sparse components plus tensors that combine sparse and dense dimensions.Supported
Sparse 2:4Semi-structured sparsity is a prototype in PyTorch and stock acceleration is currently CUDA only.Supported
Nested tensorsClassic and jagged nested tensors, including construction, metadata, packed values, padded conversion, operations, autograd, transforms, and jagged attention.Supported
Operator families
Pointwise arithmeticUnary and binary arithmetic, powers, remainders, clipping, fused forms, and in-place variants.
Remaining: Finish the long-tail dtype, out, and in-place combinations.
Partial (98%)
Comparison, logical, and bitwiseComparisons, finite and NaN checks, boolean logic, and integer bit operations.
Remaining: Finish unsigned, complex, and noncontiguous edge combinations.
Partial (98%)
Transcendental mathExponential, logarithmic, trigonometric, hyperbolic, and related functions.
Remaining: Complete complex and high precision dtype variants and edge semantics.
Partial (97%)
Special functionstorch.special functions including error, gamma, Bessel, softmax, and entropy related operations.
Remaining: Implement the remaining long-tail torch.special operations and dtype variants.
Partial (90%)
Reductions and statisticsSum, product, mean, variance, standard deviation, norms, min and max, median, modes, and NaN aware variants.
Remaining: Complete complex, float64, named-dimension, and out variants.
Partial (97%)
Scans and cumulative operationsCumulative sum, product, extrema, logsumexp, and related prefix operations.
Remaining: Finish the remaining dtype, out, and noncontiguous variants.
Partial (95%)
Indexing, slicing, and maskingBasic and advanced indexing, boolean masks, masked selection, take, put, and index assignment.
Remaining: Close overlapping, duplicate-index, and unusual-stride corner cases.
Partial (97%)
Gather, scatter, and index reductionGather, scatter, scatter reduce, index add, index copy, index fill, and index reduce families.
Remaining: Complete the remaining reduction modes, dtypes, and layout variants.
Partial (95%)
Sorting and searchingSort, argsort, topk, kthvalue, unique, searchsorted, bucketize, and nonzero.
Remaining: Finish long-tail dtype, layout, and out variants.
Partial (95%)
Shape and composition operationsConcatenation, stacking, splitting, chunking, reshape, flatten, squeeze, tile, repeat, roll, and permutation.
Remaining: Close edge aliasing, overlap, and unusual-stride cases.
Partial (98%)
Foreach and fused tensor-list operationsBatched elementwise updates and fused paths used by optimizers and model training.
Remaining: Finish the remaining dtype, scalar-list, and in-place variants.
Partial (95%)
Matrix and tensor productsMatrix multiply, batched matrix multiply, addmm, einsum, tensordot, inner, outer, and vector products.
Remaining: Complete long-tail dtype, broadcasting, and out variants.
Partial (95%)
Linear algebratorch.linalg decompositions, factorizations, solves, inverses, eigenvalues, singular values, ranks, and norms. Broad coverage is present, with remaining complex64 gaps.
Remaining: Close the outstanding complex64 decompositions, solves, and out overloads.
Partial (90%)
Fast Fourier transformstorch.fft FFT, inverse FFT, real and Hermitian transforms, multidimensional transforms, and frequency helpers.
Remaining: Finish uncommon size, dtype, stride, and transform variants.
Partial (98%)
Convolution1D, 2D, and 3D convolution, grouped and depthwise convolution, and transposed convolution.
Remaining: Complete unusual dtype, layout, and parameter combinations.
Partial (98%)
PoolingMax, average, fractional, Lp, adaptive, and unpooling operations across supported dimensions.
Remaining: Close the remaining Lp, fractional, and unpooling edge variants.
Partial (95%)
NormalizationBatch, layer, group, instance, local response, RMS, weight, and spectral normalization paths.
Remaining: Finish long-tail normalization modes and dtype edge cases.
Partial (95%)
ActivationsReLU families, GELU, SiLU, sigmoid, tanh, softmax, gated activations, and other neural nonlinearities.
Remaining: Complete the remaining activation, dtype, in-place, and out variants.
Partial (98%)
Loss functionsRegression, classification, ranking, embedding, divergence, CTC, and other training losses.
Remaining: Finish less common reduction, dtype, and edge-shape combinations.
Partial (95%)
EmbeddingsEmbedding lookup, embedding bags, padding indices, sparse gradients, and renormalization.
Remaining: Close sparse-gradient, max-norm, and per-sample-weight edge cases.
Partial (95%)
AttentionScaled dot product attention, masks, causal execution, dropout, grouped query attention, and attention backends.
Remaining: Finish uncommon mask, stride, and dtype combinations and specialized backend parity.
Partial (95%)
Interpolation and grid samplingResize modes, upsampling, affine grids, grid sample, padding modes, and antialiasing paths.
Remaining: Complete antialiasing, dtype, layout, and boundary corner cases.
Partial (95%)
Random distributionsUniform, normal, Bernoulli, multinomial, Poisson, exponential, permutation, and distribution sampling.
Remaining: Implement the remaining samplers and parameter edge cases.
Partial (90%)
Signal processingtorch.signal windows and related signal operations, plus short time Fourier transform paths in the core API.
Remaining: Complete the torch.signal window catalog and STFT edge modes.
Partial (85%)
Sparse operationsSparse construction, conversion, elementwise operations, reductions, sampled operations, matrix math, autograd, and COO, compressed, block, hybrid, and semi-structured execution.Supported
Complex operationsComplex arithmetic, conjugation, views, reductions, linear algebra, FFT, and autograd are supported unevenly by dtype and subsystem.
Remaining: Finish complex32 and complex128 coverage plus remaining complex64 linear algebra and autograd.
Partial (80%)
Container formats and low precision matrix mathFP8, FP6, FP4, integer, NF, subbyte, tensor, channel, and block scaled formats. Format coverage is broad, but public FP4 scaled matrix multiplication remains incomplete.
Remaining: Correct public FP4 scaled matrix multiplication and finish format-specific compile and autograd paths.
Partial (90%)
Training, transforms, and compilation
Reverse mode autogradBackward graphs, saved tensors, accumulation, higher order gradients, and anomaly detection.
Remaining: Complete the final direct-owner migrations and edge-case higher-order gradient coverage.
Partial (99%)
Forward mode automatic differentiationDual tensors and Jacobian vector products through PyTorch forward AD.
Remaining: Add JVP rules for the remaining differentiable schemas and dtype or layout edges.
Partial (95%)
Complex autogradConjugate Wirtinger derivative behavior for real valued losses and complex tensors.
Remaining: Broaden higher-order gradients and incomplete complex dtype and linear algebra paths.
Partial (75%)
Custom autograd functionstorch.autograd.Function forward, backward, context saving, and transform compatibility.Supported
torch.func transformsGrad, vmap, jacrev, jacfwd, hessian, functional calls, and transform composition.
Remaining: Finish batching rules for data-dependent, nested, and remaining custom operations.
Partial (95%)
Automatic mixed precisionAutocast policy, eligible operations, custom functions, and gradient scaling.
Remaining: Complete the autocast allowlist and low precision training edge cases.
Partial (95%)
OptimizersSingle tensor, foreach, and fused optimizer paths where PyTorch exposes them.
Remaining: Broaden fused coverage beyond Adam, AdamW, SGD, and Adagrad and close state edge cases.
Partial (85%)
Activation checkpointingReentrant and nonreentrant checkpoint execution, RNG state handling, and recomputation.Supported
torch.compileGraph capture, fake tensor propagation, graph breaks, compiled autograd, and an executable lowering path.
Remaining: Broaden dynamic shapes, close remaining graph breaks, and add missing custom operation lowerings.
Partial (90%)
torch.exportBasic device graph capture and execution work, but a broader export compatibility contract has not yet been verified.
Remaining: Verify symbolic shapes, functionalization, decompositions, and broader model execution.
Partial (40%)
Quantized tensor executionQuantized representations and low precision operators. Current PyTorch documentation directs new quantization work toward torchao.
Remaining: Complete FP4 integration and remaining format-specific compile and autograd paths.
Partial (90%)
Distributed training integrationDevice-native collectives, DistributedDataParallel integration, and multi-process device training are not implemented.Unsupported

References

PyTorch documentation used for this matrix

(c) 2026 Kris Bailey