Skip to content

native: the Metal open paths' shared helpers move to metal_shared.zig (metal.zig 593 to 546 lines) - #2425

Open
ashhart wants to merge 1 commit into
mainfrom
lead/metal-room
Open

ashhart wants to merge 1 commit into
mainfrom
lead/metal-room

Conversation

@ashhart

@ashhart ashhart commented Nov 7, 2026

Copy link
Copy Markdown
Owner

zig/src/native/metal.zig is at 593 lines, and #1850 (Nemotron on Metal with TF_KV_SHARE) needs about 10 more, which would take it past the 600 limit.

This moves six helpers that the Metal open paths share, unchanged, into zig/src/native/metal_shared.zig, together with their test: chip, deviceName, generation, prefillStep, modelContext and gibBytes. The only change to them is pub on the three that metal.zig now reaches from the other file. metal.zig goes from 593 to 546 lines.

For #1850: it moves modelContext to cuda_window.zig. After this lands, its rebase removes modelContext from metal_shared.zig instead of from metal.zig.

Tests

  • The native build, every host step that compiles metal.zig, zig build test and the plain zig build give the same results before and after. zig build -l is byte-identical.
  • No Metal device test ran: each device open was refused and logged, and none came from metal.zig's steps.
  • The landing gate's host checks pass, and lean adds nothing new.

No behaviour change.

…, so metal.zig has room for #1850

zig/src/native/metal.zig was at 593 lines. chip, deviceName, generation, prefillStep, modelContext and
gibBytes, with generation's test, move unchanged to metal_shared.zig; only the three that were private
gain pub. metal.zig names each as before, so every call site and its arguments stay as they were, and
chip and deviceName stay public there. metal.zig is now 546 lines.
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