Skip to content

Feat/core layer architecture refactor#19

Merged
Concode0 merged 4 commits into
mainfrom
feat/core-layer-architecture-refactor
May 19, 2026
Merged

Feat/core layer architecture refactor#19
Concode0 merged 4 commits into
mainfrom
feat/core-layer-architecture-refactor

Conversation

@Concode0
Copy link
Copy Markdown
Owner

Architectural Refactoring: Thin Layers & Polymorphic Runtime

  • Thin Primitive Layers: All primitive layers (ProductLayer, RotorLayer, ReflectionLayer, MultiRotorLayer, CliffordLinear) are now ultra-thin wrappers over runtime behavior. They no longer branch explicitly on layouts.
  • Centralized Dispatch: Dense/Compact dispatch is strictly handled by the core runtime (core/runtime/actions.py). CliffordAlgebra and AlgebraContext dynamically plan execution paths.

Benchmarks ( about planned core architecture and layer refactoring )

The "Grade Contract" (declared left_grades, right_grades, output_grades) allows the core to execute only the algebraically relevant lanes. This structurally avoids the $2^n$ Cayley-table materialization.

High-Dimensional Verification ((1)x(1)->(0,2), compact output):

  • $n=16$ : 121 lanes (vs. Dense: 65,536) -> OK
  • $n=32$ : 497 lanes (vs. Dense: 4.2 Billion) -> OK
  • $n=63$ : 1,954 lanes (vs. Dense: $2^{63}$) -> OK

3. Performance Benchmarks: 75x Structural Speedup

The performance gain is driven by optimizing the computational tensor program itself, not just compiler magic.
Measured CPU results for vector GP (1)x(1) -> (0,2):

Dimension ($n$) Dense Engine Compact Planned Speedup
$n=5$ 0.477 ms 0.053 ms 8.9x
$n=6$ 1.402 ms 0.065 ms 21.7x
$n=7$ 2.147 ms 0.057 ms 37.8x
$n=8$ 4.240 ms 0.057 ms 75.0x

Also checked:

  • Pairwise wedge (2)x(1)->(3) works at n=12, n=16, n=24.
  • At n=32, grade-3 output works when raised through PlanningLimits(max_lanes=8192).
  • MultiRotorLayer works compactly at n=16, n=32, and n=63.
  • aot_eager fullgraph captures compact GP at n=32 and n=63 with zero diff.
  • Dense materialization at n=63 is intentionally blocked.

@Concode0 Concode0 merged commit 9c26623 into main May 19, 2026
8 checks passed
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