perf: vectorize CPU bottlenecks with vDSP and cblas#32
Open
alvgeppetto-debug wants to merge 1 commit intomaderix:mainfrom
Open
perf: vectorize CPU bottlenecks with vDSP and cblas#32alvgeppetto-debug wants to merge 1 commit intomaderix:mainfrom
alvgeppetto-debug wants to merge 1 commit intomaderix:mainfrom
Conversation
- Vectorize adam_update with vDSP batch ops (stories_cpu_ops.h) Replaces scalar per-element loop with vDSP_vsmul/vsma/vsq/vdiv Expected ~3-4x faster for 2.4M parameter updates - Vectorize model_adam_step ADAM_UPDATE macro with vDSP (backward.h) Same batch ops pattern for the train.m model pipeline - Replace cpu_accum_dW with cblas_sgemm (backward.h) dW += dy^T @ x is a standard BLAS GEMM operation Expected 5-10x faster for weight gradient accumulation - Replace cpu_matmul_backward_dx with cblas_sgemm (backward.h) dx = dy @ W^T is also a standard BLAS GEMM - Add -framework Accelerate to train target (Makefile)
Author
Benchmark ResultsHardware: Apple M3 Ultra (28-core CPU, 96 GB RAM, 31.6 TFLOPS peak ANE dual-die)
Findings
|
dev-erik
added a commit
to dev-erik/ANE
that referenced
this pull request
Mar 4, 2026
…ion (adapted from upstream PR maderix#32)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Vectorize CPU bottlenecks in the training loop using Accelerate framework.
Changes:
Both make train and make train_large compile cleanly on macOS.