Phase 1 hardening: cover all previously-untested core operations. - array_test.go (25): scalar/array creation, shape, clone, free, data access - ops_test.go (44): arithmetic, math, matmul, reductions, shape ops, indexing, slicing, random - nn_test.go (8): Linear (dense/bias/LoRA), Embedding, RMSNormModule, RepeatKV - fast_test.go (9): RMSNorm, LayerNorm, RoPE, ScaledDotProductAttention Found: Floats()/DataInt32() return wrong data on non-contiguous arrays (transpose, broadcast, slice views). Documented in FINDINGS.md. Also: cpp/ workspace docs for CLion Claude session, Go 1.26 impact assessment, verified go generate → test round-trip (29→115 tests). Co-Authored-By: Virgil <virgil@lethean.io> Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1.5 KiB
1.5 KiB
FINDINGS.md — go-mlx C++ Research & Discovery
Record findings about mlx-c internals, API quirks, and architectural decisions.
2026-02-19: Initial Setup (GoLand Claude)
mlx-c v0.4.1 Source Stats
- 24 .cpp files, 27 .h headers in
build/_deps/mlx-c-src/mlx/c/ - Pure C API wrapping C++ MLX framework
- Each header typically has: type definition,
_new(),_free(), operation functions
Installed Artifacts (dist/)
dist/lib/libmlxc.dylib— C API shared librarydist/lib/libmlx.dylib— MLX C++ framework shared librarydist/include/mlx/c/— 27 public headers
Build Verified
- CMake configure + build + install completes cleanly
- Go tests pass (29/29) after build
- AppleClang 17.0.0, macOS SDK 26.2
Go Binding Coverage (preliminary)
The Go side currently uses functions from these headers:
array.h— creation, data access, shape, dtypeops.h— add, multiply, divide, matmul, softmax, etc.fast.h— rms_norm, layer_norm, rope, scaled_dot_product_attentiontransforms.h— eval, compile, vjp, jvpio.h— safetensors load/saverandom.h— categoricalstream.h— default_gpu_streammetal.h— is_availableerror.h— set_error_handlervector.h— vector_array operationsclosure.h— compiled function closures
Likely unused: fft.h, linalg.h, distributed.h, distributed_group.h, export.h, map.h, memory.h
Add new findings below as work progresses.