Skip to content

perf: reduce compile and IO overhead - #12

Closed
alvgeppetto wants to merge 1 commit into
maderix:mainfrom
alvgeppetto:perf/compile-io
Closed

perf: reduce compile and IO overhead#12
alvgeppetto wants to merge 1 commit into
maderix:mainfrom
alvgeppetto:perf/compile-io

Conversation

@alvgeppetto

Copy link
Copy Markdown

Reduce compile and IO overhead in the training loop.

Changes:

  • ACCUM_STEPS configurable via ANE_ACCUM_STEPS env var (default 10). Higher values mean fewer exec() restarts and better effective throughput.
  • 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 ones. Avoids repeated IOSurfaceCreate/CFRelease on every recompile cycle. Pool capacity: 128 surfaces with swap-remove lookup.
  • Applied to both tiny_train.m and train_large.m codepaths.

Both make train and make train_large compile cleanly on macOS.

- 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
@alvgeppetto alvgeppetto closed this Mar 2, 2026
@alvgeppetto
alvgeppetto deleted the perf/compile-io branch March 2, 2026 22:44
ebowwa pushed a commit to ebowwa/ANE that referenced this pull request Aug 4, 2026
…uristics

ane_mil.parse() extracts funcs (signature inputs/outputs) and statements (op, args, attrs,
output dtype/shape) via balanced bracket matching; ane_mil.validate() checks the Orion
catalog precisely — banned ops (concat/gelu) by op-name, conv bias=, matmul transpose-const
(maderix#12), 32K-channel conv (maderix#16), output liveness (maderix#14), multi-output uniform (#2) +
alphabetical binding (maderix#3), multi-input alphabetical (maderix#19).

ane_lint.lint_mil uses the parser as primary and falls back to the regex checks when a
program won't parse; size checks (maderix#4 min / maderix#18 input-uniform) and perf advisories always
run. End-to-end via /raw/lint (func-wrapped gelu -> ANE010, relu -> ok). 71 tests (9 new
parser tests).

Co-Authored-By: Claude <noreply@anthropic.com>
ebowwa pushed a commit to ebowwa/ANE that referenced this pull request Aug 4, 2026
maderix#9 GraphDescriptor: operation entries now include op.args (graph dependencies). Constants use
their BLOBFILE/file attr as digest instead of placeholder "const".
maderix#10 IR pipeline: rejects unparseable MIL at the tensor-IR level (rejected_at_tensor_ir) before
reaching ANE-IR lint — previously reported "validated" for meaningless input.
maderix#11 ExecutionPlan + PlanSegment: frozen=True (immutable as documented). __post_init__ uses
object.__setattr__ for the auto-generated id.
maderix#12 Communication: recv() now verifies consumer_exec_id + checksum before returning data.
maderix#13 Transforms: docstring honestly states these are VariantIntents (metadata), not transformed
graphs — quantize() labels int8, doesn't produce int8 MIL.
maderix#14 Autotuner: select_and_benchmark now passes weights to bridge.bench (previously discarded).
Evidence keyed by real mil-hash fingerprint + shape, not "auto"/"default". All-failed case
returns best_variant=None instead of picking an infinite-latency variant.

bridge.bench now accepts a weights param (for constant-weight autotuning).
138 tests.

Co-Authored-By: Claude <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant