How leelachesszero/lc0 works
Main Components
a) Core Components:
• Chess Engine Core (src/chess/)
• Neural Network System (src/neural/)
• Search System (src/search/)
• Self-play Component (src/selfplay/)
• UCI Interface Layer (src/chess/uciloop)
b) Neural Network Backends:
• CUDA Backend
• OpenCL Backend
• BLAS Backend
• DirectX Backend
• Metal Backend
• ONNX Backend
• XLA Backend
┌─────────────────────────────────────────────┐
• UCI Interface │
• ┤
• Engine Controller │
• ┬───────────────┬────────────┤
• Chess Logic │ Search System │ Self-play │
• ┴───────────────┴────────────┤
• Neural Network Factory │
• ┤
• Backend Multiplexer │
• ┬───┬───┬───┬───┬───┬───┬───────────────┤
• CUD│OCL│BLA│DX │MET│ONN│XLA│ More Backs │
• ┴───┴───┴───┴───┴───┴───┴───────────────┘
Component Relationships
• UCI Interface ↔ Engine Controller
• Engine Controller → Chess Logic
• Engine Controller → Search System
• Search System ↔ Neural Network Factory
• Neural Network Factory → Backend Multiplexer
• Backend Multiplexer → Individual Backends
Additional Elements
• Configuration System
• Weight Loading System
• Cache System
• Syzygy Endgame Tables Integration
Implementation Details
Classes/modules:
• Board representation
• Evaluation
• Move generation
• Neural network architecture
The training data generation pipeline
This architecture should highlight Lc0's unique characteristics as a neural network-based chess engine while showing its modular and extensible nature.