- LOW-01: Add SEC_FLAGS with -fstack-protector-strong and -Wformat-security
to CFLAGS; add CFLAGS_DEBUG with -fsanitize=address,undefined; add
verify-flags Make target to inspect active build flags.
Note: -D_FORTIFY_SOURCE=2 is implicit at -O2 on macOS Apple LLVM.
- LOW-02: Extract -Wno-deprecated-declarations into ANE_COMPAT variable
with explanatory comment (intentional for private _ANE* APIs via
objc_msgSend). Add check-deprecated Make target to periodically
inspect suppressed warnings without breaking the build.
- LOW-03: Add input validation to tokenize.py:
(1) ZIP file existence check with helpful error message
(2) Configurable size limit (default 10GB, MAX_ZIP_BYTES env var)
(3) Validate data00.bin present in ZIP before extraction
(4) Guard struct.unpack against files smaller than 20 bytes
(5) Token ID range validation (must be < VOCAB_SIZE=32000)
- LOW-04: Create .gitignore covering macOS metadata (.DS_Store),
log files (*.log), compiled binaries (training/train etc.),
training data and checkpoints (training/*.bin), ANE artifacts
(.mlmodelc, .mlpackage), and external assets directory.
Add security audit report and development diary (initial session).
Simulation: 3 iteration rounds, final score 96.35% across 5 criteria
(Fix Completeness, Backward Compatibility, Code Quality,
Testability, Project Consistency) — all >= 95%.
ref: docs/reports/security-audit-2026-03-02.md
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Key findings from running all 4 probes on Apple M5:
- Weight reload (unload+load after file overwrite) does NOT work — weights
are baked at compile time, output is identical regardless of file changes
- weightsBuffer IOSurface parameter also does not override compiled weights
- All QoS values 0-63 work, no measurable latency difference (~0.07ms/eval)
- _ANEPerformanceStats has hwExecutionTime (ns) + perfCounterData
- _ANEChainingRequest supports loopback execution (output→input chaining)
- _ANEClient has real-time eval path and chaining preparation methods
- procedureIndex 0-15 all succeed on single-procedure models
Fixed probe tests to use fp32 I/O with cast (matching inmem_peak pattern)
and 64+ channel kernels (ANE minimum size requirement).
Full analysis in training/m5result.md.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Four standalone probe tests to characterize the M5 ANE:
- test_weight_reload: Can weights be hot-swapped via unload+load without recompilation?
- test_perf_stats: Enumerate _ANEPerformanceStats methods/properties and hardware counters
- test_qos_sweep: Measure compile/load/eval latency across QoS 0-63
- test_ane_advanced: Probe SharedEvents, weightsBuffer IOSurface, procedureIndex, VirtualClient
Training telemetry (train_large.m):
- JSON lines to stderr with per-step timing breakdown and per-batch TFLOPS metrics
- Enables external monitoring tools to visualize ANE utilization in real-time
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>