std1.0.0-beta-7 SafeC docs

Module ml

Modules

activationsSafeC Standard Library — Activation functions on Tensor.
attentionSafeC Standard Library — Attention (scaled dot-product + multi-head).
attention_advancedSafeC Standard Library — Advanced attention: Multi-head Latent Attention (MLA/EG-MLA), Shifted-Window (Swin) attention, and Gated DeltaNet.
autoencoderSafeC Standard Library — autoencoders: plain, denoising, sparse, variational (VAE, beta-VAE, conditional VAE) and vector-quantized (VQ-VAE). MLP encoders and decoders over flattened rows, trained with Autograd::get -- or convolutional ones (ConvAutoencoder, ConvVae) built from convnet.h's ConvNet.
cnnSafeC Standard Library — CNN: 2D convolution + pooling over flat CHW feature maps.
convnetSafeC Standard Library — trainable convolutional networks on std::ml's Autograd::get core.
cuda_ffiInternal: included by the CUDA backend sources (gpu_cuda.sc, gpu_cuda_attention.sc, gpu_cudnn.sc, device_cuda.sc, dsp/fft_cuda.sc), not a public header. The CUDA driver API, NVRTC and cuBLAS / cuBLASLt declarations they share, and the opaque handle types of those libraries and cuDNN for their 'extern' declarations: each C handle (CUcontext, CUevent, cublasHandle_t, ...) is a pointer to its own marker struct here, so one kind of handle can't be passed where another is expected. None is ever constructed or read; only the libraries they come from look behind them.
datasetsSafeC Standard Library — datasets and mini-batch loading for std::ml.
deviceSafeC Standard Library — devices: where a tensor's values live.
device_kernelsGenerated by gen_device_kernels.sh from device_kernels.cu -- do not edit.
device_kernels_spirvGenerated by gen_device_kernels.sh from device_kernels.cu (slangc 2026.20) -- do not edit. Every kernel as a SPIR-V module, validated by spirv-val, per build: 0 plain, 1 DK_TAGGED, 2 DK_ATTN64, 3 DK_TAGGED and DK_ATTN64.
device_kernels_wgslGenerated by gen_device_kernels_wgsl.sh from device_kernels.wgsl -- do not edit.
device_webgpuSafeC Standard Library — the WebGPU device backend's interface (device_webgpu.sc): the static backend interface device.h describes, plus the few calls gpu_webgpu.h's host-array API makes on the same device, queue and kernels. Programs reach the backend through device.h (the webgpu feature, DEVICE_WEBGPU); this header is for gpu_webgpu.sc.
diffusionSafeC Standard Library — Diffusion: noise schedules (EDM/Karras, DDPM linear) and samplers (DDPM ancestral, DDIM, DPM-Solver, DPM-Solver++).
elementSafeC Standard Library — tensor element types.
float16
ganSafeC Standard Library — generative adversarial networks.
gpu_cuda
gpu_cuda_attentionSafeC Standard Library — attention on NVIDIA GPUs (CUDA): flash attention and linear attention as this library's own CUDA kernels.
gpu_cudnnSafeC Standard Library — cuDNN convolution, pooling and U-Net on CUDA.
gpu_miopenSafeC Standard Library — MIOpen convolution, pooling and U-Net on ROCm.
gpu_mps
gpu_mps_metallibGenerated by gen_mps_metallib.sh from gpu_mps_kernels.metal — do not edit directly. Regenerate after changing the kernel source.
gpu_rocm
gpu_spirv
gpu_webgpu
llmSafeC Standard Library — LLM orchestration (LangChain/LangGraph/ LangSmith-inspired).
loraSafeC Standard Library — parameter-efficient fine-tuning: LoRA and QLoRA.
moduleSafeC Standard Library — models as composable traits.
mps_ffiInternal: included by the Metal backend sources (gpu_mps.sc, device_mps.sc), not a public header. The opaque types of the Objective-C runtime and libdispatch they call Metal through besides gpu_mps.h's MtlObject (Objective-C's 'id': every MTLDevice, MTLBuffer, encoder, NSString, ...): a selector, an autorelease pool token. None is ever constructed or read; only the runtime looks behind them. Each objc_msgSend call site casts objc_msgSend to the typed signature of the message it sends.
nnSafeC Standard Library — trainable networks on std::ml's Autograd::get core.
normSafeC Standard Library — trainable normalization: LayerNorm and AdaLN.
rlSafeC Standard Library — reinforcement learning.
rnnSafeC Standard Library — Recurrent cells: RNN, GRU, LSTM, xLSTM.
rocm_ffiInternal: included by the ROCm backend sources (gpu_rocm.sc, device_rocm.sc, gpu_miopen.sc, dsp/fft_rocm.sc), not a public header. The HIP runtime, hiprtc and rocBLAS declarations they share, and the opaque handle types of those libraries and MIOpen / hipFFT for their 'extern' declarations: each C handle (hipModule_t, rocblas_handle, ...) is a pointer to its own marker struct here, so one kind of handle can't be passed where another is expected. None is ever constructed or read; only the libraries they come from look behind them.
sparseSafeC Standard Library — sparse tensors (CSR) with autograd and devices.
ssmSafeC Standard Library — state space models (Mamba's selective SSM).
tensorSafeC Standard Library — Tensor: CPU tensors with reverse-mode Autograd::get.
tensor_autoSafeC Standard Library — size-based automatic backend selection for Tensor ops on the CPU (mixing SIMD/vDSP/BLAS, chosen FOR the caller instead of BY the caller; GPU placement is device.h's job).
tensor_blasSafeC Standard Library — BLAS-accelerated Tensor matmul.
tensor_halfSafeC Standard Library — fp16 / bf16 tensors and mixed-precision ops.
tensor_nnSafeC Standard Library — neural-net building blocks on top of std::ml's Tensor/Autograd::get core (tensor.h/tensor.sc): activation functions, the Adam optimizer, and 1D pooling. Separate file from tensor.sc for the same reason the GPU backends are separate — an independently useful slice of functionality, not a change to the core type or its existing ops.
tensor_spirvSafeC Standard Library — GPU-backed Tensor ops (Vulkan/SPIR-V (cross-vendor)).
tensor_vdspSafeC Standard Library — vDSP-accelerated elementwise Tensor ops (see tensor_vdsp.sc). Same Autograd::get math/backward wiring as tensor.h's plain tensor_add/sub/mul/sum (reuses __add_backward/__sub_backward/ __mul_backward/__sum_backward directly — only the forward computation changes), just vectorized via Accelerate's vDSP instead of a scalar loop. Link with '-framework Accelerate', same as tensor_blas.sc.
trainerSafeC Standard Library — the training loop.
transformerSafeC Standard Library — Transformer image-generation backbones: DiT (Diffusion Transformer, Peebles & Xie 2023) and JiT ("Just-image- Transformer" — a plain, unconditioned-per-layer transformer backbone, as opposed to DiT's per-layer adaptive conditioning).
unetSafeC Standard Library — U-Net: a small encoder/decoder CNN with skip connections (Ronneberger et al. 2015), the convolutional backbone classic DDPM-style diffusion models denoise with.
webgpu_apiSafeC Standard Library — the part of the WebGPU C API (webgpu.h, as wgpu-native and Dawn ship it) that device_webgpu.sc and gpu_webgpu.sc call, declared for SafeC. Layouts follow webgpu.h's current revision (the one with WGPUStringView labels, callback-info structs and WGPUFuture returns: wgpu-native v24 on, Dawn from 2024 on); tests/stdlib/webgpu checks them against the real header with a C compiler (layout_check.c).