Skip to content

inkling2 metal: one threadgroup-size attribute per convolution kernel, so the runtime library loads - #5303

Merged
ashhart merged 4 commits into
mainfrom
lead/inkling2-conv-attr-once
Nov 27, 2026
Merged

ashhart merged 4 commits into
mainfrom
lead/inkling2-conv-attr-once

Conversation

@ashhart

@ashhart ashhart commented Nov 27, 2026

Copy link
Copy Markdown
Owner

Main cannot start Inkling 2 Mini on Metal since #4593: four kernels in zig/kernels/metal/inkling2/runtime_conv.metal (tf_ink2_stage_conv, tf_ink2_stage_conv_segs, tf_ink2_stage_conv_static, tf_ink2_commit_histories) carry [[max_total_threads_per_threadgroup(256)]] twice. The Metal compiler refuses a repeated attribute, so the whole runtime library fails:

program_source:70:3: error: attribute 'max_total_threads_per_threadgroup' cannot appear more than once on a declaration
tensorfold: the native Inkling 2 Mini engine cannot load this checkpoint (LibraryLoad)

This PR removes the second copy on each of the four kernels (no other shader change) and adds a host check in runtime_kernels_test.zig that refuses a doubled header on any runtime kernel, so this is caught without a GPU.

Checks:

  • zig build test-inkling2-metal-host on an M3 Ultra: fails on main's shader with the error above, passes with this change.

  • Seen first on an M5 Ultra overnight exactness run (the server refused to load the checkpoint).

  • Synthena

…, so the runtime library loads

#4593 gave tf_ink2_stage_conv, tf_ink2_stage_conv_segs, tf_ink2_stage_conv_static and
tf_ink2_commit_histories two copies of [[max_total_threads_per_threadgroup(256)]]. Current
Metal compilers refuse a repeated attribute, so the whole runtime library failed to load
(LibraryLoad) and Inkling 2 Mini could not start on Metal. The host test now refuses a
doubled header for every runtime kernel.
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