Skip to content

Commit

Permalink
some overview docs
Browse files Browse the repository at this point in the history
  • Loading branch information
geohot committed Apr 14, 2024
1 parent 50e780a commit ea18d28
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions docs/OVERVIEW.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
tinygrad has four pieces

* frontend (Tensor -> LazyBuffer)
* See tensor.py, function.py, multi.py, and lazy.py
* The user interacts with the Tensor class
* This outputs LazyBuffers, which form the simple compute graph
* scheduler (LazyBuffer -> ScheduleItem)
* See engine/schedule.py
* When a Tensor is realized, the scheduler is run to get its LazyBuffers to be computed
* This takes in LazyBuffers and groups them as appropriate into kernels.
* It returns a list of ScheduleItems + all the Variables used in the graph
* lowering (TODO: lots of work to clean this up still)
* See codegen/ (ScheduleItem.ast -> UOps)
* ScheduleItems have an ast that's compiled into actual GPU code
* Many optimization choices can be made here, this contains a beam search.
* renderer/compiler (UOps -> machine code)
* UOps are tinygrad's IR, similar to LLVM IR
* Here we either convert them to a high level language or machine code directly
* engine/realize.py (ScheduleItem -> ExecItem)
* runtime
* See runtime/
* Runtime actually interacts with the GPUs
* It manages Buffers, Programs, and Queues
* Sadly, METAL and GPU (OpenCL) don't have a compiler that can be pulled out from the device itself

0 comments on commit ea18d28

Please sign in to comment.