How gautam1858/tiny-gpu-compiler works
tiny-gpu-compiler is an MLIR-based GPU-kernel compiler with a browser visualizer and cycle-accurate simulator. Users edit or select a .tgc kernel; the compiler parses it, generates TinyGPU IR, optimizes and allocates registers, then emits instructions and analysis for visualization and simulation. The graph includes the documented optimization and shared-memory capabilities. The native pipeline and browser wiring are evidenced by excerpts; browser-internal details not sampled are represented only where the README or shown imports support them.
Main entry points: Pipeline.cpp Compilation pipeline · App.tsx Workbench coordinator · types.ts Trace and state types · GPUSimulator.tsx Simulator controls
Components 17
Kernel Frontend
- Lexer
lib/Frontend/Lexer.cpp - Parser and AST
lib/Frontend/Parser.cpp - MLIR generation
lib/Frontend/MLIRGen.cpp
Compiler Backend
- TinyGPU dialect
lib/Dialect/TinyGPU/TinyGPUOps.cpp - Compilation pipeline
lib/Pipeline/Pipeline.cpp - Optimization passes
lib/Passes/Passes.cpp - Register allocator
lib/CodeGen/RegisterAllocator.cpp - Instruction emitter
lib/CodeGen/TinyGPUEmitter.cpp
Browser Workbench
- Kernel editor
web/src/components/Editor.tsx - Workbench coordinator
web/src/App.tsx - IR stage viewer
web/src/components/PipelineView.tsx - Binary viewer
web/src/components/BinaryView.tsx - Trace and state types
web/src/compiler/types.ts
Simulation and Analysis
- Analysis panel
web/src/components/AnalysisPanel.tsx - Simulator controls
web/src/components/GPUSimulator.tsx - GPU simulator
web/src/simulator/TinyGPUSim.ts
Other components
- Kernel author
Connections 23
- Kernel author → Kernel editor: enters kernel
README.md - Kernel editor → Workbench coordinator: reports edits
web/src/App.tsx - Workbench coordinator → Compilation pipeline: compiles source
README.md - Compilation pipeline → Lexer: tokenizes source
lib/Pipeline/Pipeline.cpp - Compilation pipeline → Parser and AST: parses tokens
lib/Pipeline/Pipeline.cpp - Parser and AST → Lexer: requests tokens
- Compilation pipeline → MLIR generation: generates IR
lib/Pipeline/Pipeline.cpp - MLIR generation → TinyGPU dialect: emits operations
lib/Frontend/MLIRGen.cpp - Compilation pipeline → Optimization passes: runs passes
lib/Pipeline/Pipeline.cpp - Compilation pipeline → Register allocator: allocates registers
lib/Pipeline/Pipeline.cpp - Compilation pipeline → Instruction emitter: emits instructions
lib/Pipeline/Pipeline.cpp - Workbench coordinator → IR stage viewer: renders stages
web/src/App.tsx - Workbench coordinator → Binary viewer: renders instructions
web/src/App.tsx - Workbench coordinator → Analysis panel: renders analysis
web/src/App.tsx - Workbench coordinator → Simulator controls: configures simulation
web/src/App.tsx - Simulator controls → GPU simulator: executes instructions
web/src/components/GPUSimulator.tsx - Simulator controls → Workbench coordinator: reports cycle state
web/src/App.tsx - Workbench coordinator → Trace and state types: uses trace state
web/src/App.tsx - IR stage viewer → Trace and state types: displays stages
web/src/components/PipelineView.tsx - Binary viewer → Trace and state types: displays instructions
web/src/components/BinaryView.tsx - Analysis panel → Trace and state types: displays metrics
web/src/components/AnalysisPanel.tsx - GPU simulator → Trace and state types: uses execution state
web/src/simulator/TinyGPUSim.ts - Instruction emitter → Compilation pipeline: returns trace