Skip to content

Inkling-2-Mini: Add loop message and gate kernels - #4746

Open
ajensenwaud wants to merge 2 commits into
ashhart:mainfrom
ajensenwaud:ink-k-loop
Open

ajensenwaud wants to merge 2 commits into
ashhart:mainfrom
ajensenwaud:ink-k-loop

Conversation

@ajensenwaud

@ajensenwaud ajensenwaud commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

Inkling 2 Mini runs layers 6 to 17 three times, and from the second pass on each of those layers mixes in a message
from the pass before. TensorFold has no CUDA kernels for that step with the fixed sum order a batch-invariant engine
needs. This PR adds them.

What this changes

Adds the loop step's kernels, their launcher and their contract registrations: the cross-pass message attention,
the four rank-64 message gates and their norms. A row gives the same bits in any window or prompt chunk. Nothing
serves them yet.

Checks on this head

  • Head de885595d; lean checker 165 on the base, 165 on this head, 0 new.
  • zig build over 19 host steps, Inkling 2's and test-cuda-host among them, -Dfixed-cpu: 547 of 547 steps, 9,413 of 9,451 tests, 38 skipped.
  • zig fmt --check build.zig zig, git diff --check, test-kernel-symbols-host, cuda_common_check.py and cuda_fragment_check.py: clean.

Receipt

n/a: no served path reaches these kernels yet.

Kernel contract
  • Registered: the eight kernels in loop.cu, each with a float64 reference written from transformers'
    Inkling2LoopMessageGate and Inkling2LoopMessageAttentionResidual, and a planted control after each group.
  • GB10 (sm_121), 25 November, on this head: kernel-contract inkling2 exl3 vit act gives SUMMARY 146 kernels: 144 pass gates 1-4, 2 fail, 0 known findings; 103 controls: 103 red as planted, 0 missed; 27 limit problems. Main under the same words gives the same two failures, both in GLM's wide-expert tests, and the same 27 limit problems.
  • Gate 5: records for nvcc 13.0 and 13.3 on sm_80, 86, 89, 120 and 121; 13.2 stays pending.
  • They compile to the same SASS as in the InkSpark-Mini recipe's build (https://github.com/ajensenwaud/inkspark-mini-2dgx).

@ashhart

ashhart commented Nov 23, 2026

Copy link
Copy Markdown
Owner

Thanks @ajensenwaud for the loop kernels and the thorough contract coverage. One small cleanup: the loop kernel set's init marks its module loaded and then appends registrations without a cleanup on error, and the caller does not clean up the loop set either, so an allocation failure leaves the module loaded. Please add the matching cleanup, as the attention set does.

  • Synthena

@ajensenwaud

Copy link
Copy Markdown
Contributor Author

OK, will do. Thanks, @ashhart.

@ajensenwaud

Copy link
Copy Markdown
Contributor Author

Done in 8b460625a. The loop set now marks itself loaded only after its registrations are set, and cleans up on a failed append, as the attention set does; the family set cleans it up too. The ops set had the same gap, so it gets the same fix.

The cross-pass message attention, the four rank-64 message gates and
their norms, each with a float64 reference and a planted control. Their
nvcc 13.0 records keep 13.2 pending, with the 13.3 receipt beside them.
Both sets marked themselves loaded before their registrations were set
and appended without an errdefer, so a failed append left the module
loaded. They now follow the attention set, and the family set cleans
up the loop set as it does the others.
@AIFlowML

Copy link
Copy Markdown
Contributor

I tested de885595d4 on d1ff890729. There are three merge conflicts. The scratch resolution kept both third-party notices, added the loop image to current main's CUDA limits table, and refreshed the gradient-serving pin for the combined cuda/kernels.zig.

zig build test-inkling2-cuda-host test-inkling2-host test-gradient-serving check-native-cuda-host -Dfixed-cpu -j2 --summary all
zig build compile-cuda-tests -Dtarget=aarch64-linux-gnu -Dfixed-cpu -j2 --summary all

On M5 Max, 90 host tests passed with four skips. The native adapter and full CUDA contract runner both cross-compiled for ARM64 Linux. I also confirmed the loop set and its caller retain the requested cleanup after the rebase. The current-tree GPU rerun remains open, including the same-filter main comparison for the reported GLM and launch-limit findings.

Igor Lessio - AIFLOW LABS

This branch has not been deployed

No deployments
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.

3 participants