CLion Claude session 1 completed all orientation and priority tasks: - Full API surface map (180 ops, Go binds ~40) - mlx_contiguous found (fixes Floats() bug) - mlx_cumsum found (unblocks TopP sampling) - Memory management fully documented (refcounted, safe to free) - Error model documented (free-form strings only) - Device info API documented (mlx_metal_device_info) Co-Authored-By: Virgil <virgil@lethean.io>
3.1 KiB
3.1 KiB
TODO.md — go-mlx C++ Task Queue
Tasks for the CLion Claude session. Written by GoLand Claude or Virgil.
Orientation (First Session)
- Map the mlx-c API surface — Read all 27 headers. Full map in FINDINGS.md: ~180 ops functions, Go binds ~40. Identified 8 high-priority unbound functions. (Done 2026-02-19)
- Understand the error model — Free-form strings only (
"<msg> at <file>:<line>"). No error codes or categories. Handler stores string, Go checks return code. Details in FINDINGS.md. (Done 2026-02-19) - Check memory management patterns — Arrays are refcounted via
shared_ptr<ArrayDesc>. Double-free is UB. Free during async is safe. NULL-free is safe. Details in FINDINGS.md. (Done 2026-02-19)
Priority Tasks (from GoLand Claude)
- Find
mlx_contiguousor equivalent — FOUND:mlx_contiguous(res, a, allow_col_major, stream)atops.h:220. Plus_mlx_array_is_row_contiguous()for checking. GoLand Claude: see FINDINGS.md for recommended pattern. (Done 2026-02-19) - Verify
mlx_array_data_*eval semantics — Does NOT auto-evaluate. Returns raw buffer pointer (crash/garbage if unevaluated).Materialise()before data access is essential.item()auto-evaluates butdata()does not. (Done 2026-02-19) - Check if
mlx_cumsumexists — FOUND:mlx_cumsum(res, a, axis, reverse, inclusive, stream)atops.h:344. GoLand Claude can now implement proper TopP sampling. (Done 2026-02-19) - Survey
mlx_contiguous/mlx_flatten/mlx_copy— All three exist.mlx_contiguousis the correct tool (forces row-major).mlx_copymay preserve non-contiguous layout.mlx_flattenworks but changes shape semantics. (Done 2026-02-19)
Memory Management Research (from Backend Abstraction Design)
- What does
mlx_clear_cache()release? — Releases allocator pool cache back to system. Does NOT touch active memory. Safe mid-generation. (Done 2026-02-19) - Is
mlx_array_free()safe on graph-referenced arrays? — Yes, safe. Arrays useshared_ptr<ArrayDesc>. Freeing the C handle just decrements refcount. Graph computation continues normally. (Done 2026-02-19) - MLX allocator pool behaviour —
mlx_array_free()returns memory to internal pool (not system). Pool reuses allocations. Under sustained inference, memory should plateau. Callmlx_clear_cache()to release pool to system if needed. (Done 2026-02-19) - Research structured error info — No structured info available. Free-form string only. Format is stable:
"<message> at <file>:<line>". GoLand Claude should use return code (0/1) + stored error string pattern. (Done 2026-02-19)
Standing Tasks
- API gap analysis — When the GoLand Claude needs a C function that isn't exposed by mlx-c, document the gap here and research if upstream mlx-c supports it or if a patch is needed.
Workflow
- GoLand Claude or Virgil writes tasks here
- Pick up in order, mark
[x]when done - New findings →
cpp/FINDINGS.md - If Go changes needed → note in FINDINGS.md for GoLand Claude