Skip to content

Feature/skeep 005 compiled leg - #424

Merged
michalharakal merged 6 commits into
developfrom
feature/skeep-005-compiled-leg
Sep 20, 2026
Merged

michalharakal merged 6 commits into
developfrom
feature/skeep-005-compiled-leg

Conversation

@michalharakal

Copy link
Copy Markdown
Contributor

No description provided.

michalharakal and others added 4 commits September 4, 2026 11:29
…tructure

SKEEP-005 phase 2, "structure at compile time". The engine's SDPA is now
grouped-query native, so the recording paths of MultiHeadAttention and
HybridTransformerBlock hand K/V to it with their own head count —
repeatKVHeads (nKV × narrow + concat per K and V per layer per step) is
gone from tapes, traced graphs and exports. The SmolLM2 and FunctionGemma
export harnesses run ScheduleAnnotationPass before conversion, so every
exported attention states parallel_dims = [batch, heads] in the advisory
skainet.schedule header; no core count is written into a module.

Tests: MultiHeadAttentionRecordingGqaTest (tape carries no narrow/concat,
sdpa sees K/V with nKVHeads, recorded == eager); the schedule parity suite
covers the GQA-native op on (8,2) and (4,2).

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
…ty; phase-2 docs

SKEEP-005 phase 2, "cores at run time":
- iree-android: IreeRedecodeSession(taskTopologyGroupCount) → new JNI
  nativeCreateWithTopology feeds --task_topology_group_count to IREE's flag
  parser (iree/base/tooling/flags.h) before the local-task device is created,
  the same knob iree-run-module takes; nativeCreate is unchanged. A stale
  .so fails loudly (UnsatisfiedLinkError → IllegalStateException). New
  IreeTaskTopology (SKAINET_TASK_GROUPS, groupCountFor(schedule.parallelism));
  IreeRedecodeDecoder.fromAssets defaults to the env knob. Both ABIs'
  libskainet_iree_redecode.so rebuilt with skainet/iree-android:3.11.0
  (+ --link iree_base_tooling_flags iree_task_api); unit test IreeTaskTopologyTest.
- gemma-iree: reads SKAINET_TASK_GROUPS, GEMMA_TASK_GROUPS as deprecated alias.
- llama: OptimizedModeScheduleParityTest — compiled runtimes (ComputeGraphExecutor
  over ctx.ops) are bit-identical between Sequential and CoroutineSchedule.hardware()
  at every step on SmolLM2-135M (9 heads / 3 KV heads, GQA-native SDPA node) and
  match the eager leg at position 0 within 2e-5. Later positions diverge by the
  documented OPTIMIZED limitation (frozen KV/position in the shape-[1] snapshot),
  not by the schedule. No measurable speedup there: ≈1.18 s/step both ways.
- Docs: spec "Phase 2" + AS-9..12, explanation "The compiled leg" (diagram),
  IREE Android runtime reference "Task topology", eager-vs-compiled row,
  compile-model-for-android notes, CHANGELOG. API dumps refreshed (additive).

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Conflicts: CHANGELOG (phase-2 entry stays under Unreleased, above 0.55.0), the SmolLM2 and
FunctionGemma export harnesses (schedule stamping + BufferHandle byte access both kept),
IreeRedecodeSession (module-qualified function name now feeds both nativeCreate and
nativeCreateWithTopology), and libskainet_iree_redecode.so for both ABIs, rebuilt from the
merged JNI source with --vulkan.
@michalharakal

Copy link
Copy Markdown
Contributor Author

Merged develop into the branch (no rebase). Conflicts resolved: CHANGELOG, the SmolLM2/FunctionGemma export harnesses (both sides kept), IreeRedecodeSession (module-qualified function name now feeds nativeCreate and nativeCreateWithTopology), and both libskainet_iree_redecode.so rebuilt from the merged JNI source (--vulkan). Also carries #442 (JVM target 21 for the convention-plugin modules), which is what turned develop red.

Local verification on the merged branch: OptimizedModeScheduleParityTest ✅, IreeTaskTopologyTest ✅ (3), compile of functiongemma/smollm2/iree-android ✅, apiCheck ✅.

Blocked on the engine: MultiHeadAttentionRecordingGqaTest fails against engine 0.54.0 — SDPA: head count mismatch — Q=8 K=2 V=2. Grouped-query-native scaledDotProductAttention (and its StableHLO lowering) lives on SKaiNET feature/skeep-005-compiled-leg, which is not merged or released yet. Order: engine branch → engine release → bump here → this PR.

Grouped-query-native scaledDotProductAttention and the schedule-aware graph contexts this
branch relies on ship in SKaiNET 0.56.0.
@michalharakal

Copy link
Copy Markdown
Contributor Author

SKaiNET 0.56.0 is on Maven Central (grouped-query-native scaledDotProductAttention, its StableHLO lowering, schedule-aware graph contexts). Pushed: develop merged in + chore: consume engine 0.56.0 (skainet = "0.56.0" in gradle/libs.versions.toml).

Locally against the released engine (fresh resolution, nothing in ~/.m2): MultiHeadAttentionRecordingGqaTest ✅ — the test that blocked this PR — and OptimizedModeScheduleParityTest ✅.

@michalharakal
michalharakal merged commit 75382f8 into develop Sep 20, 2026
4 checks passed
@michalharakal
michalharakal deleted the feature/skeep-005-compiled-leg branch September 20, 2026 18:39
@michalharakal michalharakal mentioned this pull request Sep 20, 2026
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