Expand description
Device abstraction following Tinygrad’s architecture.
This module provides a unified Device abstraction that owns:
- Renderer: Transforms UOp graphs into source code (ProgramSpec)
- Compiler: Transforms source code into executable bytes
- Runtime: Creates executable Programs from compiled bytes
- Allocator: Manages memory allocation for buffers
This design allows multiple backends (LLVM, CUDA, Metal, WebGPU) to coexist and share compiled kernels via the method cache.
Structs§
- Compiled
Spec - Compilation result carrying source (JIT) or bytes (AOT).
- Device
- A device that owns renderer, compiler, runtime, and allocator.
- Program
Spec - Program specification containing source code and metadata.
- Variable
- A variable in the kernel (for symbolic shapes/strides).
Traits§
- Compiler
- A compiler that transforms source code into a compiled specification.
- Program
- A compiled, executable kernel program.
- Renderer
- A renderer that transforms UOp graphs into source code.
Type Aliases§
- Compiler
Pair - A (Renderer, Compiler) pair for a specific backend.
- Runtime
Factory - A factory function that creates executable Programs from a compiled specification.