Lucid Layer Map

Lucid Layer Map An architecture diagram generated by Archify. User code · import lucid · Architecture component User code import lucid Public API · lucid · nn · optim · Python · lucid/ · Tier 1 · 2 Public API lucid · nn · optim Tier 1 · 2 Tensor · _ops · dunder · _dispatch · Python · lucid/ Tensor · _ops dunder · _dispatch pybind11 · _C.engine module · C++ engine · lucid/_C pybind11 _C.engine module ops · op defs · schema_v1 · C++ engine · lucid/_C ops op defs · schema_v1 kernel · Binary/UnaryKernel · C++ engine · lucid/_C kernel Binary/UnaryKernel Dispatcher · Cpu/GpuBackend · C++ engine · lucid/_C Dispatcher Cpu/GpuBackend compile · coreml · TraceGraph IR · C++ engine · lucid/_C compile · coreml TraceGraph IR autograd · Node · Engine · C++ engine · lucid/_C autograd Node · Engine TensorImpl · Storage · Allocator · C++ engine · lucid/_C · core/ TensorImpl Storage · Allocator core/ Accelerate · vDSP · BLAS · BNNS · Apple frameworks · CPU stream Accelerate vDSP · BLAS · BNNS CPU stream MLX → Metal · lazy evaluation · Apple frameworks · GPU stream MLX → Metal lazy evaluation GPU stream call OpEntry _impl CRTP Device CPU GPU records grad_fn saved allocates trace Python · lucid/ C++ engine · lucid/_C Apple frameworks Legend Frontend Backend Database Message bus External

Dependency direction

  • • C++ depends one way: bindings → ops → kernel → autograd → backend → tensor → core (convention, DEVELOPMENT.md §2.2)
  • • tools/check_layers.py guards Python only: autograd, linalg and diffeq may not import nn or optim

H3 · Stream split

  • • CPU uses Accelerate only, GPU uses MLX only
  • • Carve-outs: linalg and FFT run on MLX's CPU stream; nonzero and unique round-trip through the CPU

H4 · No external deps

  • • No numpy or other third-party import on any compute path
  • • Only six bridge boundaries may touch the outside world