Goal: Production-grade Neural Network support in VTL with CUDA/GPU acceleration, DataLoader, CIFAR-10 example, and model serialization.
Reposity: vlang/vtl · VSL Backend: vlang/vsl
- Tensor core (
vtl.Tensor), creation, slicing, broadcasting, map/reduce - Autograd engine (
Variable,Context, reverse-mode backprop) - Linear Algebra via VSL (
matmul,solve,lstsq,qr,lu,cholesky,pinv) - NN layers: Linear, Conv2D, MaxPool, Flatten, LSTM, LayerNorm, Attention
- Losses: MSE, BCE, CrossEntropy, Huber
- Optimizers: Adam, AdamW, RMSProp, AdaGrad, SGD + schedulers
-
vtl/examples/vtl_vandermont/README.md— VTL/Compute integration -
vtl/examples/vtl_opencl_vcl_support/README.md— VCL/OpenCL support - Issue #58 — Phase 1: Vulkan Compute Foundation
- Issue #59 — Phase 2: Forward Pass on Vulkan GPU
- Issue #60 — Phase 3: VSL + CUDA Backend
- VTL imports from VSL:
import vtl.la(LA operations),import vtl.storage(persistence) - CIFAR-10 dataset loader (
datasets/cifar10.v) -
nn_cifar10example with CUDA-aware config
- Issue #61 — Phase 4: GPU Autograd
- Vulkan f32 Linear backward uses GPU GEMM
- Vulkan f32 Conv2D weight gradients use GPU GEMM; input and bias gradients retain the CPU path
- Vulkan f32 Adam updates use the fused VSL optimizer shader
- GPU backward coverage for LSTM, attention, norms, embeddings, and pooling
- Full device-resident backward and optimizer updates across the supported model stack
- Issue #162 — runnable OpenCL/VCL transfer and
add_scalarsmoke example - Issue #62 — full VTL OpenCL compute integration (closed on GitHub; implementation remains incomplete)
- VTL tensor transfer to and from VCL storage
- VCL broadcast view metadata
- OpenCL/VCL smoke for tensor round-trip and
add_scalar - VTL
matmul/GEMM and GEMV dispatch on VCL tensors - VTL elementwise, reduction, softmax, LayerNorm, and Conv2D kernels
- Device-resident VCL tensor operations and NN-layer dispatch
- VCL parity and correctness tests across VTL tensor, LA, and NN APIs
- Issue #63 — Phase 6: ARM GPU Support (Android, iOS, Embedded)
- Issue #64 — Phase 7+: Kernel Fusion, Mixed Precision, Computation Graph Optimization (closed on GitHub; scope remains incomplete)
- Fused Vulkan Adam update kernel
- General operator fusion and computation graph optimization
- FP16/BF16 storage and automatic mixed-precision training
- Reusable GPU memory pools and asynchronous Vulkan execution
- Backend profiling and gradient checkpointing
- Quantization and multi-GPU training
- CIFAR-10 path bug fixed (
datasets/cifar10.v) - Configurable subset loading (
Cifar10Config.train_count,test_count) -
nn_cifar10_safevariant — safe defaults for dev/CI -
nn_cifar10_tinyvariant — real data subset (64 train, 16 test) -
nn_cifar10_tiny_synthvariant — synthetic data, no I/O (pipeline validation) - CI: scoped
bin/teston PRs; full tree +nn_cifar10/main.vvia labelfull-ml(#109) - Full
nn_cifar10training remains local/high-RAM (~9 GB compile peak on small hosts)
-
datasets/dataloader.v—DataLoader[T]with batching, shuffle, labels (issue #86 closed) - Used in
nn_cifar10_*examples
Phase C — Model Serialization Polish — closed #87
-
serialization_test.vround-trip at 1e-9 -
nn_cifar10/main.vcheckpoints +--resume(PR #95)
- CUDA Linear, Conv2D, DeviceSession (opt-in
VTL_USE_CUDA=1,-d cuda)
Phase D — Numpy Benchmark Suite — closed #88 (PR #94)
-
benchmarks/vs_numpy/matmul + conv2d +bench_util -
autograd_bench.v+pytorch_baseline.py - PR comment workflow (
benchmark-pr-comment.yml, PR #96)
-
nn_cifar10_cuda— opt-in CUDA smoke (VTL_USE_CUDA=1,-d cuda) -
nn_cifar10_vulkan— f32 smoke with Vulkan Linear, Conv2D, ReLU/Sigmoid, Adam - Root
README.mdpassesv check-md -hide-warnings - All example READMEs pass
v check-md -hide-warnings
- Phase 1:
DeviceSessionbuffer reuse; CUDA forward for Linear/Conv2D - Phase 2: GPU-resident
Variable(forward tensors, #101/#104) - Phase 3: CUDA backward for Linear + Conv2D (opt-in
VTL_CUDA_BACKWARD, #107) - Phase 4: Adam on GPU with persistent optimizer slots (
VTL_CUDA_OPTIMIZER, #106)
| Priority | Work item |
|---|---|
| P1 | Implement CUDA backward coverage for the remaining neural-network layers (#161) |
| P1 | Close the remaining correctness, API, and performance gaps in NumPy and Arraymancer parity |
| P2 | Improve CPU kernel performance and revisit alias/compiler optimizations when V provides a safe contract (#3) |
| P2 | Add ARM GPU support (#63) |
| P2 | Expand measured YOLO gate/layer fusion beyond binary multiply/divide backward kernels (#40) |
| # | Title | Priority | Notes |
|---|---|---|---|
| #3 | V aliasing (restrict) |
🟡 Perf | Open; await safe compiler support; see note below |
| #40 | YOLO for autograd gates | 🟡 Performance | Open; requires end-to-end benchmark evidence |
| #63 | ARM GPU support | 🟡 P2 | Open; requires ARM GPU hardware for device validation |
| #161 | CUDA backward gaps | 🔴 ML | Open; LSTM, attention, norms, embeddings, and pooling remain |
Issue #3 compiler status: V 0.5.2 does not emit a restrict alias
contract. The upstream V issue #1839
is closed, but the current C generator source still does not emit a non-aliasing
qualifier for tensor kernel pointers. @[direct_array_access] removes bounds
checks but does not establish non-aliasing. Keep #3 open; benchmark safe kernel
changes and revisit when upstream compiler support is available.
The complete NumPy and Arraymancer comparison is tracked in docs/NUMPY_PARITY.md. The GitHub project board is not used as a source for this roadmap.
Closed ML epics: #58–#64, #86–#91 — see ML_ROADMAP.md.
| Dependency | Repo | Status |
|---|---|---|
| VSL LA ops (matmul, conv2d, solve, etc.) | vlang/vsl | ✅ Done |
VSL CUDA (vsl/cuda, cuBLAS/cuDNN) |
vlang/vsl | ✅ #280 |
| VSL Vulkan compute | vlang/vsl | ✅ #283–#284 |
| VSL OpenCL (VCL) | vlang/vsl | ✅ VSL transport/kernels exist; ❌ VTL compute and NN dispatch are incomplete (see #62) |
| vs NumPy / PR benchmarks | vlang/vtl | ✅ #88, workflow |
All benchmarks compare VTL against NumPy using equivalent operations:
# NumPy reference
import numpy as np
a = np.random.rand(1024, 1024)
b = np.random.rand(1024, 1024)
%timeit np.dot(a, b)import vtl
import vtl.la
a := vtl.random[f64](0.0, 1.0, [1024, 1024], vtl.TensorData{})
b := vtl.random[f64](0.0, 1.0, [1024, 1024], vtl.TensorData{})
_ = la.matmul(a, b)!- The path-filtered
.github/workflows/benchmark-pr-comment.ymlworkflow compiles its V benchmarks with-prod, runs them separately from compilation, and posts a report with VTL and NumPy timings. - The report currently includes CPU matmul, Conv2D, reduced SVD, statistics, and linear bias-gradient reduction. These results are diagnostic except for the optimized CPU GEMM budget below.
- CI fails when either f32 or f64 optimized CBLAS GEMM at 512×512 is more than
3× slower than NumPy. The report is posted before this gate runs. A
performance-exemptlabel bypasses the threshold while leaving the measured ratios visible. - The gate does not establish pure-V, CUDA, Conv2D, autograd, or end-to-end training performance parity. Add explicit, equivalent baselines and budgets before treating those workloads as CI performance requirements.
- Matmul — add larger shapes and CUDA comparisons with matching backends.
- Conv2D — add an optimized backend comparison for
f64[64, 3, 32, 32]and kernelf64[3, 3, 3, 64]. - Autograd backprop — three-layer MLP with 256 hidden units.
- Training step — full forward, loss, backpropagation, and optimizer update.
vtl/examples/
├── nn_cifar10/ # Full CIFAR-10 CNN (local machine recommended)
├── nn_cifar10_safe/ # Safe defaults, CI-friendly
├── nn_cifar10_tiny/ # Real data subset (64 train, 16 test)
├── nn_cifar10_tiny_synth/# Synthetic data, no I/O
├── nn_cifar10_cuda/ # CUDA smoke (opt-in)
├── nn_cifar10_vulkan/ # Vulkan GEMM smoke (opt-in)
├── nn_mnist/ # MNIST example
├── nn_xor/ # XOR training example
├── nn_regression_sine/ # Sine regression
├── nn_multiclass_iris/ # Iris multi-class
├── nn_simple_two_layer/ # Two-layer MLP
├── nn_autoencoder_simple/# Autoencoder
├── autograd_backprop/ # Backprop demonstration
├── vtl_basic_usage/ # Basic tensor operations
├── vtl_vandermont/ # Vandermonde matrix example
└── vtl_opencl_vcl_support/ # OpenCL/VCL support demo
vtl/
├── nn/
│ ├── layers/ # Linear, Conv2D, MaxPool, LSTM, LayerNorm, Attention
│ ├── models/ # Sequential, Serialization
│ ├── optimizers/ # Adam, AdamW, RMSProp, AdaGrad, SGD
│ └── losses/ # MSE, BCE, CrossEntropy, Huber
├── datasets/
│ └── cifar10.v # CIFAR-10 loader with subset support
├── autograd/
│ └── gates/ # Autograd gate implementations
├── benchmarks/vs_numpy/ # matmul, conv2d, autograd_bench
└── docs/ # Tutorials + ML_ROADMAP
Last updated: 2026-10-05