How slexisvn/mlfw works
MLFW is a TypeScript machine-learning framework with tensor operations, neural-network and training APIs, and a multi-target compiler/runtime; the tree also contains a native Tera compiler and a compiler visualizer. The main execution path is tensor work through graph and tensor-level compilation, backend code generation, and runtime execution. Eager/autograd, training/data, and higher-level ML utilities are distinct capabilities. README content was absent, and source excerpts were selective, so uncertain call wiring is omitted; paths for unsampled subsystems identify only their existing directories.
Main entry points: ops.ts Tensor Operations · index.ts Public Entry · graph_pipeline.ts Graph Pipeline · tir_pipeline.ts TIR Pipeline
Components 21
ML APIs
- Public Entry
src/index.ts - Neural Networks
src/nn/index.ts - ML Utilities
src/ml/index.ts
Tensor Runtime
- Tensor Core
src/tensor/core/tensor.ts - Tensor Storage
src/tensor/core/storage.ts - Tensor Operations
src/tensor/ops/ops.ts - Operator Dispatch
src/dispatcher/dispatcher.ts - Backward Engine
src/autograd/engine.ts
Compiler
- Program Tracing
src/tracing/trace_core.ts - Graph Pipeline
src/compiler/pipeline/graph_pipeline.ts - TIR Pipeline
src/compiler/pipeline/tir_pipeline.ts - Compiler Analysis
src/compiler/analysis/analysis_manager.ts - Compiler Visualizer
tools/visualizer/src/App.tsx
Execution Backends
- Backend Codegen
src/backend/pipeline.ts - Runtime Selection
src/runtime/runtime.ts - Device Kernels
src/kernels/defs/host_ops.ts - Tera Native Backend
terac/lib/Tera/Pipelines/Pipelines.cpp
Training And ML
- Data Loading
src/data/index.ts - Trainer
src/lightning/core/trainer.ts - Optimizers
src/optim/index.ts
Other components
- Framework User
Connections 23
- Framework User → Public Entry: uses
- Public Entry → Neural Networks: exposes
- Public Entry → ML Utilities: exposes
- Framework User → Tensor Core: creates tensors
- Neural Networks → Tensor Operations: uses operations
- ML Utilities → Tensor Operations: uses operations
- Tensor Core → Tensor Storage: owns storage
- Tensor Operations → Operator Dispatch: dispatches operators
- Backward Engine → Tensor Operations: computes gradients
- Framework User → Program Tracing: traces programs
- Program Tracing → Graph Pipeline: builds graph IR
- Graph Pipeline → TIR Pipeline: lowers IR
- Graph Pipeline → Compiler Analysis: queries analyses
- TIR Pipeline → Compiler Analysis: uses analyses
- TIR Pipeline → Backend Codegen: produces functions
- Backend Codegen → Runtime Selection: provides kernels
- Runtime Selection → Device Kernels: selects implementations
- Backend Codegen → Tera Native Backend: optional native path
- Framework User → Data Loading: loads batches
- Data Loading → Trainer: supplies data
- Trainer → Neural Networks: runs modules
- Trainer → Optimizers: updates parameters
- Framework User → Compiler Visualizer: inspects compilation