- Make ACCUM_STEPS configurable via ANE_ACCUM_STEPS env var (default 10)
Higher values = fewer exec() restarts, better effective throughput
- Make MAX_COMPILES configurable via ANE_MAX_COMPILES env var (default 100)
Allows tuning for different hardware/OS versions
- IOSurface pooling: reuse freed surfaces by size instead of creating new
Avoids repeated IOSurfaceCreate/CFRelease on every recompile cycle
Pool capacity: 128 surfaces with swap-remove for O(n) lookup
- Validate all fread() return values in model_load_weights (model.h)
- Check ane_eval() return values in ane_conv_eval (forward.h) and ane_eval_k (tiny_train.m)
- Log error details on ANE eval failure (ane_runtime.h)
- Thread-safe RMSNorm: replace global g_rms_tmp with local allocation (stories_cpu_ops.h)
- Bounds-check token indices in cross_entropy_loss, embed_lookup, embed_backward
- Atomic checkpoint writes via tmp+rename pattern (tiny_train.m)
- Non-destructive recompile: compile new kernels first, swap only on success (model.h)
- Validate fread() in load_checkpoint (tiny_train.m)