Skip to content

core: move tp_settings.zig and owned.zig out of flashnext, so core imports no family file - #4878

Merged
ashhart merged 3 commits into
ashhart:mainfrom
jschmied:struct/tp-settings-to-core
Nov 25, 2026
Merged

ashhart merged 3 commits into
ashhart:mainfrom
jschmied:struct/tp-settings-to-core

Conversation

@jschmied

Copy link
Copy Markdown
Contributor

Head: 6cdbccbb4f (2 commits on 0b39f4d64e).

What moved

Two files move from families/flashnext into core, unchanged except their own import paths:

  • families/flashnext/tp_settings.zig -> core/tp_settings.zig: the speed-up settings file reader (rank, MCDMA library,
    links) and pairMin, with its 5 tests. It only needs fabric and core/stagger.zig.
  • families/flashnext/owned.zig -> core/owned.zig: the 45-line Owner(Metal) that keeps acquired Metal objects
    and queues for a prefix. core/pair_rows.zig uses it too, so after the first move it was the last core file
    importing a family file. Its tests stay in families/flashnext/owned_test.zig (they also cover flashnext's
    load prefix and run cleanup); only that file's import path changes.

Importers updated (import path only): core/pair.zig, core/pair_rows.zig, families/glm/ep.zig,
families/flashnext/{engine,engine_load,tp,replay_run,owned_test}.zig, and the tensorfold.zig test list.
No build file names either path. No logic, name or signature change.

Why

#4804 found one 8-module import cycle on main, closed by core importing a family file (core/pair.zig and
core/pair_rows.zig -> families/flashnext/tp_settings.zig). This is the first cleanup PR proposed there.
glm's ep.zig also read flashnext's file, one of the 15 family -> family reaches; it now reads core.

Import graph, before and after (zig_deslop.py, the #4804 checker prototype)

Before (0b39f4d64e):

== module-cycle: 1 cycle groups
- 8 modules: core, cuda, fabric, families/flashnext, hip, hip_serve, native, xpu
    core -> families/flashnext: 3 imports, e.g. zig/src/core/pair.zig -> zig/src/families/flashnext/tp_settings.zig
== field-leak: 15 family -> family reaches
- families/glm -> families/flashnext: 1 files (tp_settings.zig)

After (6cdbccbb4f):

== module-cycle: 2 cycle groups
- 3 modules: core, cuda, fabric
    core -> cuda: 1 imports, e.g. zig/src/core/weight_only_cuda.zig -> @import("cuda")
- 2 modules: families/flashnext, native
== field-leak: 14 family -> family reaches

No core -> family edge is left. The 8-module group splits in two: core/cuda/fabric stays a cycle through
core/weight_only_cuda.zig -> cuda (a separate topic), and flashnext <-> native is two test files.

Verification

  • Moved tests, run directly on aarch64 Linux: zig test of core/tp_settings.zig with fabric/verbs/sys:
    8/8 pass (its 5 plus stagger.zig's 3); the same compiles for aarch64-macos and x86_64-linux-gnu.
  • test-flashnext-cleanup-host (runs owned_test.zig against the recording Metal fake, and compiles
    core/pair.zig, glm/ep.zig, flashnext/{tp,engine,engine_load,replay_run}.zig through
    residency_owner_tests.zig), test-flashnext-vision-memory-host, test-cluster-membership-host: 80/81 pass,
    1 skip, on aarch64 Linux.
  • Full x86 CI set on 6cdbccbb4f (x86_64, dispatcher): X86-ALL-GREEN: test-host, test, test-golden,
    test-kernel-contract, test-server-security, test-pull-security, fuzz-cortheon, check-release-paths,
    check-native-cuda-host, compile-cuda-tests, pr_check, zig fmt, diff --check, lean (0 new).
  • Byte identity: zig build native -Dsm=121 -Doptimize=ReleaseSafe, both built in the same worktree path:
    main 0b39f4d64e and this head give the same tensorfold-native, md5 104ff3784536f8a1948aef4534cf001b.
    (An earlier branch build, made hours before with a different build cache, came out 7693b055; a rebuild of
    the same head matches main. The CUDA server reaches none of the touched files; its strings name none of them.)
  • Metal: zig build test on macOS is not run (no Mac in this loop). Every Metal file touched except
    core/pair_rows.zig is compiled by test-flashnext-cleanup-host above; pair_rows.zig's two changed imports
    were checked to resolve to the moved files.
  • lean: 0 new (165 problems on base and head); zig fmt --check clean.

Not applicable: no opt-in path, kernel, refusal, env flag, served behaviour or speed change, so no served rows
(seeded, resume or concurrency), no parity_controls.py run and no planted control. Equal against main is the byte-identity line above.

Overlap

No open PR moves either file. One textual conflict with an open PR: #3293 adds two imports right above
ep.zig's settings import; whichever lands second takes the other side's one-line path. #3380, #3480 and
#3688 also touch importers here but already conflict with main.

Proposed CHANGELOG line

Refs #4804, #2251

@AIFlowML

Copy link
Copy Markdown
Contributor

I test-merged 6cdbccbb4f746600fb93c93299c6aa2ec0d39b31 into main 4c79cfe346d3c239ff7dfd7aa694df799755bafa, then applied #4950 (ab60da2e668b1a4fea234fa2ce05525de5c8abc6). Both merges were clean. Using the #4890 checker on those trees confirms that core -> families/flashnext and families/glm -> families/flashnext disappear and no core-to-family edge remains. Between the two PRs, the checker counted 59 cycle edges before and 24 after, with no new cycle edges or errors.

On Apple silicon, I used the existing engine module in a scratch test target and ran the moved speed-up settings and a pair minimum filters. Both passed. The combined tree also passed 516 shared-lane regressions with one skip. This checks the host-side move and the landing order. It did not run device transport or multiple GPUs.

Igor Lessio - AIFLOW LABS

@ashhart

ashhart commented Nov 25, 2026

Copy link
Copy Markdown
Owner

Thank you, @jschmied. Both helper bodies are retained, with only the required import-path changes, and the callers resolve to their new core locations. The relevant moved tests and combined host results are recorded. This looks ready to land.

  • Synthena

jschmied and others added 3 commits November 25, 2026 14:08
The speed-up settings reader (rank, MCDMA library, links) is read by
core/pair.zig, core/pair_rows.zig and families/glm/ep.zig, so core imported
a family file. Moved as is with its tests; only import paths change.
core/pair_rows.zig keeps its Metal objects in flashnext's Owner, the last core
file importing a family file. Moved as is; only import paths change.
@ashhart
ashhart force-pushed the struct/tp-settings-to-core branch from 6cdbccb to 0b60178 Compare November 25, 2026 14:09
@ashhart
ashhart merged commit 7bbb2e9 into ashhart:main Nov 25, 2026
2 of 12 checks passed
@ashhart

ashhart commented Nov 25, 2026

Copy link
Copy Markdown
Owner

Thank you @jschmied. This is merged into main with your commits under your own name, so you're listed as a TensorFold contributor. It ships in the next release, credited to you in the changelog and the release notes.

ashhart added a commit that referenced this pull request Nov 25, 2026
ashhart added a commit to kotevcode/TensorFold that referenced this pull request Nov 25, 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.

3 participants