Skip to content

fabric tp roce: a kernel without transparent hugepages keeps the 4 KiB property without the NOHUGEPAGE advice - #2380

Merged
ashhart merged 2 commits into
ashhart:mainfrom
devopsfortunato:roce-thp-less-kernel
Nov 7, 2026
Merged

ashhart merged 2 commits into
ashhart:mainfrom
devopsfortunato:roce-thp-less-kernel

Conversation

@devopsfortunato

@devopsfortunato devopsfortunato commented Nov 6, 2026 •

Copy link
Copy Markdown
Contributor

What this changes

Before: on a Linux kernel built without transparent hugepages, Roce.prepareRegion asked for MADV_NOHUGEPAGE, got EINVAL, and refused to start a RoCE transport; the host test "the region is DONTFORK and NOHUGEPAGE before registration" failed with error.VerbsFailed. After: the advice is asked for only where the kernel can apply it, one startup line says why it was skipped, and MADV_DONTFORK stays strict on every Linux host.

Checks on this head

  • Head commit: 06a59d369 (8e387e02c is the change; 06a59d369 adds the changelog line the issue asked for).
  • Lean checker, python3 tools/zig/lean_check.py: base 0d7152955 252 problems, this head 252, 0 new.
  • Tests run, on aarch64 Linux with kernel 6.18.50+rpt-v8 (no THP):
    • zig test, fabric inflight suite with the build graph's modules (-Mroot=…/roce_inflight_test.zig -Mcuda=… -Mverbs=… -Msys=…): 11 passed, 0 failed. Before the change, same machine and flags: 9 passed, 1 failed (that region test).
    • zig test, zig/src/fabric/tp/roce_verbs_test.zig: 11 passed.
    • zig test, zig/src/fabric/tp/roce_multi_wire_test.zig (same module flags): 25 passed.
    • zig fmt --check on the three files and git diff --check: clean.
    • Full zig build test on this host with this change: 569/569 steps succeeded; 4516/4540 tests passed (24 skipped),
      exit 0. On pristine 0d7152955 the only failing assertion was the region test above.
  • CI: the two runs created for 8e387e02c were cancelled during runner provisioning; GitHub has not created runs for 06a59d369 yet. I'll report the result here as soon as they run.
  • Not run, and why: no GPU, checkpoint or InfiniBand/RoCE hardware on this machine, so no device or multi-node run; the change reaches only the transport's startup path. macOS and Windows return from prepareRegion before this code (unchanged), and CI's x86_64 kernels have THP, so the THP path is unchanged there.

Receipt

n/a for inference: this change decides only whether two madvise calls are attempted while a RoCE region is prepared. It does not touch a byte of a prompt, reply, kernel, lane round or numerical path, so the exactness, decode-speed and prompt-speed lines do not apply.

  • Environment: TensorFold 0d7152955 + this branch, Zig 0.17.0 (.zig-version), aarch64 Linux (Raspberry Pi 5), kernel 6.18.50+rpt-v8 built without CONFIG_TRANSPARENT_HUGEPAGE (/sys/kernel/mm/transparent_hugepage absent); no GPU or checkpoint involved.
  • Paths and platforms the change reaches: prepareRegion is called at zig/src/fabric/tp/roce.zig:201 (one pair) and zig/src/fabric/tp/roce_multi.zig:217 (multi-HCA); both now share the one function. Linux measured here (THP-less) and by CI (x86_64, THP); macOS and Windows take the existing early return.

Checklist

  • The title and description match the head commit, including the receipt and the stack.
  • New tests fail before the change, pass after it, and skip cleanly without their dependency (the region test skips on non-Linux, as before).
  • Comments and docstrings are one line. No measurements or history in the source.
  • No personal data, machine names, internal hosts or local paths in the diff or its commits. No AI attribution lines.

devopsfortunato added a commit to devopsfortunato/TensorFold that referenced this pull request Nov 6, 2026
@devopsfortunato
devopsfortunato marked this pull request as ready for review November 6, 2026 16:39
@ashhart

ashhart commented Nov 6, 2026

Copy link
Copy Markdown
Owner

Thanks @devopsfortunato, that was quick, and it's what we discussed on #2378. The multi-rank path now takes the one prepareRegion. DONTFORK stays strict. NOHUGEPAGE is asked for only where THP is present and not [never], and a skipped advice says so at startup. The test's nh assertion follows the same condition, and the three-spellings test pins the parse. A malformed enabled file still attempts the advice, so it fails safe. On a kernel with THP nothing changes, so no device run is needed. It's in the landing queue once CI is green.

@devopsfortunato

Copy link
Copy Markdown
Contributor Author

Heads-up on CI: the two runs created for 8e387e02c were cancelled while provisioning, and GitHub has not created runs for the current head 06a59d369 yet — from here the fork-run approval queue looks like the gate. The branch is ready whenever you clear it; I'll keep the receipt's test line updated with the full host suite from this THP-less aarch64 host as it finishes.

@devopsfortunato

Copy link
Copy Markdown
Contributor Author

State for the landing queue: main has moved 59 commits since 0d7152955, and the only conflicting file is CHANGELOG.md — the new Clusters: bullet against other arrivals under ## Unreleased (checked with git merge-tree; the three code files are clean). Per docs/recipes/SKILL.md I'm not force-pushing this branch to follow main, so the changelog anchor is yours to place at landing; say the word if you'd rather I rebase it first.

…B property without the NOHUGEPAGE advice

prepareRegion asked for MADV_DONTFORK and MADV_NOHUGEPAGE and refused to start
on any error. A Linux kernel built without THP answers MADV_NOHUGEPAGE with
EINVAL, so a RoCE transport could not start there and the host test "the region
is DONTFORK and NOHUGEPAGE before registration" failed with error.VerbsFailed
(aarch64, kernel 6.18.50+rpt: DONTFORK succeeds, NOHUGEPAGE is EINVAL).

Ask for NOHUGEPAGE only where the kernel can apply it: the enabled file exists
and its mode is not never. Without THP no anonymous page is promoted, so the
region's pages are 4 KiB already; the skip logs one startup line saying so.
DONTFORK stays strict on every Linux host, and a failed advice on a THP kernel
still refuses to start. roce_multi_verbs.zig re-exports the one function
instead of carrying a second copy.

Tests: the region test gates its nh assertion on the same condition and asserts
dc either way; a new test covers the enabled file's three spellings and a
malformed one. Before: 9 passed, 1 failed. After: 11 passed.
@ashhart
ashhart force-pushed the roce-thp-less-kernel branch from 06a59d3 to e5f7839 Compare November 7, 2026 02:58
@ashhart
ashhart merged commit 3aeb819 into ashhart:main Nov 7, 2026
0 of 7 checks passed
@ashhart

ashhart commented Nov 7, 2026

Copy link
Copy Markdown
Owner

Thank you @devopsfortunato. 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

ashhart commented Nov 7, 2026

Copy link
Copy Markdown
Owner

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.

fabric tp roce: prepareRegion refuses to start on Linux kernels built without transparent hugepages (MADV_NOHUGEPAGE is EINVAL)

2 participants