interplane.Get Omega
Read in your language

MojoLlama

Archived Mojo/MAX quantizer and serving research repository (read-only history)

Brought by drakestapleton

branch main Branches Tags History

MojoLlama / .coding-memory

38 lines · 1850 bytes Raw Blame History
1# MojoLlama — Coding Memory
2
3## Current State
4- MAX 26.3 + Mojo 1.0.0b1 installed via `pip install modular`
5- Mojo SIMD Q4_0 matmul kernel verified (kernels/q4_matmul.mojo, all tests pass)
6- Mojo SIMD attention kernel written (kernels/attention.mojo)
7- Mojo SIMD norms kernel written (kernels/norms.mojo)
8- bridge.py loads GGUF weights and runs forward pass (Python numpy + C kernel, ~1.6 tok/s)
9- llama.cpp server achieves 85 tok/s on this machine
10- MAX pipeline runs at 14.8 tok/s (GGUF fixed via monkey-patch)
11
12## Mojo 1.0.0b1 API Notes
13- Heap: `alloc[Type](count)`, `ptr.free()`, `ptr.load(offset)`, `ptr.store(offset, value)`
14- `pointer_to_int(ptr)` works
15- `UnsafePointer(unsafe_from_address=Int)` NOT in compiled build
16- Function params: `UnsafePointer[True, UInt8, _]` (mut, type, any-origin)
17- Python interop: `from python import Python`, `Python.import_module("numpy")`
18- `defer` keyword NOT available
19- `fn` keyword deprecated, use `def`
20- `alias` deprecated, use `comptime`
21
22## Key Blockers
231. No way to construct UnsafePointer from raw Int address in compiled Mojo 1.0.0b1
242. Python interop works but element-by-element Float32/PythonObject conversion is slow
253. File-based IPC (read/write binary files) is the most reliable bridge method
26
27## Integration Approaches Tested
28A. Python interop from Mojo ✓ works but element-wise type conversion is verbose
29B. @export shared library ✗ pointer types not passable
30C. File-based binary IPC ✓ works, suitable for weight passthrough at load time
31D. MAX pipeline ✓ works but 5.7x slower than llama.cpp on CPU
32
33## What Needs Building
34Complete the Mojo SIMD forward pass:
351. Accept weight data from Python via file or stdin
362. Run embed, layer loop (attention + FFN), output projection
373. Return logits to Python
384. Benchmark against existing C kernel (1.6 tok/s) and llama.cpp (85 tok/s)