Repository navigation
native: the Metal open paths' shared helpers move to metal_shared.zig (metal.zig 593 to 546 lines) - #2425
Merged
Conversation
…, 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.
ashhart
force-pushed
the
lead/metal-room
branch
from
November 7, 2026 12:11
a48a691 to
69c96ae
Compare
ashhart
added a commit
to jschmied/TensorFold
that referenced
this pull request
Nov 17, 2026
) Port of ashhart#1850 onto main's prefill_metal.zig and prefill_steps.zig: Ops.open begins the store's pass before the cache opens (its held pages less the lane's promise) and resumes on the adopted pages before the host cache's restore; the pass lives per stream across prefill_step calls, its marks cut the chunks, and it ends ok on finish and not ok on error, cancel and Steps.forget. kv_prompts takes a Query now: .of(s.prompt()). Rebase notes on jschmied's 7e98a79: its hunks in backend.zig's old prefillFn are carried here instead (main moved that loop out in ashhart#3021), its traceLessons move to slide.zig is dropped (main has it in prefill_metal.zig), and metal.zig takes modelContext from cuda_window.zig with metal_shared.zig's copy removed, as the branch's merge of ashhart#2425 did.
ashhart
added a commit
to jschmied/TensorFold
that referenced
this pull request
Nov 18, 2026
) Port of ashhart#1850 onto main's prefill_metal.zig and prefill_steps.zig: Ops.open begins the store's pass before the cache opens (its held pages less the lane's promise) and resumes on the adopted pages before the host cache's restore; the pass lives per stream across prefill_step calls, its marks cut the chunks, and it ends ok on finish and not ok on error, cancel and Steps.forget. kv_prompts takes a Query now: .of(s.prompt()). Rebase notes on jschmied's 7e98a79: its hunks in backend.zig's old prefillFn are carried here instead (main moved that loop out in ashhart#3021), its traceLessons move to slide.zig is dropped (main has it in prefill_metal.zig), and metal.zig takes modelContext from cuda_window.zig with metal_shared.zig's copy removed, as the branch's merge of ashhart#2425 did.
ashhart
added a commit
to jschmied/TensorFold
that referenced
this pull request
Nov 19, 2026
) Port of ashhart#1850 onto main's prefill_metal.zig and prefill_steps.zig: Ops.open begins the store's pass before the cache opens (its held pages less the lane's promise) and resumes on the adopted pages before the host cache's restore; the pass lives per stream across prefill_step calls, its marks cut the chunks, and it ends ok on finish and not ok on error, cancel and Steps.forget. kv_prompts takes a Query now: .of(s.prompt()). Rebase notes on jschmied's 7e98a79: its hunks in backend.zig's old prefillFn are carried here instead (main moved that loop out in ashhart#3021), its traceLessons move to slide.zig is dropped (main has it in prefill_metal.zig), and metal.zig takes modelContext from cuda_window.zig with metal_shared.zig's copy removed, as the branch's merge of ashhart#2425 did.
ashhart
added a commit
to jschmied/TensorFold
that referenced
this pull request
Nov 22, 2026
) Port of ashhart#1850 onto main's prefill_metal.zig and prefill_steps.zig: Ops.open begins the store's pass before the cache opens (its held pages less the lane's promise) and resumes on the adopted pages before the host cache's restore; the pass lives per stream across prefill_step calls, its marks cut the chunks, and it ends ok on finish and not ok on error, cancel and Steps.forget. kv_prompts takes a Query now: .of(s.prompt()). Rebase notes on jschmied's 7e98a79: its hunks in backend.zig's old prefillFn are carried here instead (main moved that loop out in ashhart#3021), its traceLessons move to slide.zig is dropped (main has it in prefill_metal.zig), and metal.zig takes modelContext from cuda_window.zig with metal_shared.zig's copy removed, as the branch's merge of ashhart#2425 did.
ashhart
added a commit
to jschmied/TensorFold
that referenced
this pull request
Nov 23, 2026
) Port of ashhart#1850 onto main's prefill_metal.zig and prefill_steps.zig: Ops.open begins the store's pass before the cache opens (its held pages less the lane's promise) and resumes on the adopted pages before the host cache's restore; the pass lives per stream across prefill_step calls, its marks cut the chunks, and it ends ok on finish and not ok on error, cancel and Steps.forget. kv_prompts takes a Query now: .of(s.prompt()). Rebase notes on jschmied's 7e98a79: its hunks in backend.zig's old prefillFn are carried here instead (main moved that loop out in ashhart#3021), its traceLessons move to slide.zig is dropped (main has it in prefill_metal.zig), and metal.zig takes modelContext from cuda_window.zig with metal_shared.zig's copy removed, as the branch's merge of ashhart#2425 did.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
zig/src/native/metal.zigis at 593 lines, and #1850 (Nemotron on Metal withTF_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,modelContextandgibBytes. The only change to them ispubon the three thatmetal.zignow reaches from the other file.metal.ziggoes from 593 to 546 lines.For #1850: it moves
modelContexttocuda_window.zig. After this lands, its rebase removesmodelContextfrommetal_shared.ziginstead of frommetal.zig.Tests
metal.zig,zig build testand the plainzig buildgive the same results before and after.zig build -lis byte-identical.metal.zig's steps.No behaviour change.