Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
446ab3a
feat(runtimes): add workers-first native start order and port spans
Marker689 Oct 24, 2026
e04a4f2
feat(tensorfold): add TensorFold runtime, TP2 modes and DeepSeek-V4.1…
Marker689 Oct 24, 2026
89e0c9b
fix(tensorfold): satisfy the pyright return-type baseline
Marker689 Oct 24, 2026
d518915
chore(tensorfold): mark the image build script executable
Marker689 Oct 24, 2026
b90e3dd
fix(tensorfold): track the image pin files past the *.env ignore rule
Marker689 Oct 24, 2026
69473b9
feat(tensorfold): build and wire the DeepSeek TP4 lane image
Marker689 Oct 24, 2026
e29b7c3
fix(tensorfold): make image build scripts work without buildx on a Spark
Marker689 Oct 24, 2026
a89d7f4
refactor(tensorfold): one runtime; drop in-repo images and recipes
Marker689 Oct 24, 2026
0e3b806
fix(tensorfold): give the dsv41 cluster a rank-0 command preview
Marker689 Oct 24, 2026
48c161b
docs(tensorfold): explain pre-placed external images
Marker689 Oct 24, 2026
c673886
fix(tensorfold): declare the native cluster strategy
Marker689 Oct 24, 2026
b92b065
feat(tensorfold): expose dsv41 bundle subdirectory overrides
Marker689 Oct 24, 2026
ceb96bd
feat(tensorfold): expose the native dashboard and keep it rank-0 only
Marker689 Oct 24, 2026
b744a08
Merge origin/develop-next into feature/tensorfold-support
Marker689 Oct 24, 2026
fbfb944
chore: drop stale TensorFold image.env ignore exceptions
Marker689 Oct 24, 2026
e19a28f
Merge origin/develop-next into feature/tensorfold-support
Marker689 Oct 25, 2026
1705127
feat(tensorfold): support the Jayleaton Zig DeepSeek engine
Marker689 Oct 30, 2026
f35f37b
fix(tensorfold): follow the Jayleaton engine's renamed follower
Marker689 Nov 10, 2026
86bc501
Merge remote-tracking branch 'origin/develop-next' into feature/tenso…
Marker689 Nov 23, 2026
a628a93
refactor(tensorfold): upstream-only runtime without model families
Marker689 Nov 23, 2026
5137dc1
style(tensorfold): apply ruff formatting
Marker689 Nov 23, 2026
e733bca
chore(assistant): sync generated plugin references after base merge
Marker689 Nov 24, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,18 @@ first tagged release containing them, regardless of their original commit date.

### Added

- `tensorfold` runtime: TensorFold's upstream Zig/CUDA native server. Solo on
one GB10, NFS/pre-placed checkpoints through the existing absolute `model:`
mechanism, and native TP with the engine's own `--tp/--rank/--master` flags.
The runtime is upstream-only: recipes select `tensor_parallel`, and the
engine decides which model families accept that world; there are no
fork-specific or per-model runtime families.
- Native cluster orchestration can start worker ranks before rank 0
(`RuntimePlugin.native_start_order()`) and reserve a contiguous rendezvous
port range (`native_rendezvous_port_span()`), for engines whose followers
must be listening before the serving rank starts.
- Docs: `docs/TENSORFOLD.md` covers the runtime, NFS weights, TP limits, the
upstream TP placement and the hardware validation checklist.
- The `cluster monitor` recipe picker groups runtime variants into families (such
as `vllm`) and offers an opt-in **All registries** toggle. Enabled registries with
`Stemless: no` then appear in recipe searches and registry filter choices.
Expand All @@ -79,6 +91,9 @@ first tagged release containing them, regardless of their original commit date.

### Changed

- The `tensorfold` monitor log colorizer is now wired to the new in-tree
runtime instead of only an out-of-tree expectation; the DeepSeek fork mode
logs under the same prefixes and shares it.
- Concurrent preparations of the same model wait for the holder's publication lease
instead of failing, and the wait names the holding controller, PID and operation.
Warm launches no longer take the control-machine cache lease.
Expand Down
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,9 @@ sparkrun update --yolo # alias for --alpha

## Highlights

- **Multi-runtime** — vLLM, SGLang, llama.cpp out of the box
- **Multi-runtime** — vLLM, SGLang, llama.cpp, TensorFold and more out of the box
- **Multi-node tensor parallelism** — `--tp 2` = 2 hosts, automatic InfiniBand/RDMA detection
- **TensorFold** — native Zig/CUDA engine with OpenAI/Anthropic APIs; solo, NFS weights, and native TP2 for the engine's family-specific rank modes, plus an experimental DeepSeek-V4.1 TP2/TP4 family (`docs/TENSORFOLD.md`)
- **VRAM estimation** — know if your model fits before you launch (`sparkrun show <recipe>`)
- **Git-based recipe registries** — we publish official recipes, community recipes, and benchmarked recipes via [Spark Arena](https://spark-arena.com), plus you can add your own registries.
- **Guided setup wizard** — cluster creation, SSH mesh, CX7 auto-detection, sudoers, earlyoom
Expand Down
8 changes: 8 additions & 0 deletions RECIPES.md
Original file line number Diff line number Diff line change
Expand Up @@ -783,6 +783,14 @@ Explicit `runtime` always wins. Command-hint detection only fires when `runtime`
| `eugr-vllm` | Ray (inherits vllm-ray) | eugr container builds + Ray cluster |
| `atlas` | Native (`--rank`, `--world-size`, `--master-addr`) | Atlas Spark (azeezish/atlas-gb10) — pure-Rust LLM inference; each rank runs `atlas serve`, rank 0 only HTTP |
| `modular-max` | None — single-node only | Modular MAX (`max serve`); tensor parallelism uses local GPUs via `--devices` (never multi-node) |
| `tensorfold` | Solo; native TP with upstream `--tp/--rank/--master` | TensorFold Zig/CUDA server (OpenAI Chat/Responses/Messages). One upstream runtime: `tensor_parallel` sets the world, followers start **before** rank 0, and the engine refuses worlds a model does not support. See [docs/TENSORFOLD.md](docs/TENSORFOLD.md). |

TensorFold does not use the generic `Common Defaults Keys` column mapping below
for TP: `max_num_seqs` maps to the engine's `--parallel` (request concurrency,
**not** tensor parallelism), `max_model_len` maps to `--context`, and
`served_model_name` maps to `--name`. Multi-node TP is selected by
`tensor_parallel`, and the runtime emits the upstream `--tp/--rank/--master`
flags; no per-model family key exists.

### Common Defaults Keys

Expand Down
170 changes: 170 additions & 0 deletions docs/TENSORFOLD.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,170 @@
# TensorFold

TensorFold ([ashhart/TensorFold](https://github.com/ashhart/TensorFold)) is a
Zig/CUDA native LLM server with an OpenAI-compatible API. sparkrun supports the
upstream engine only: one runtime, one launch shape, no per-fork or per-model
families.

The runtime is gated to `gb10` hosts (`requires_capability`). TensorFold's
released CUDA fatbins target sm_80/86/120/121, but only the GB10 (sm_121) path
is qualified by sparkrun today.

## Container images are built outside sparkrun

Like the other first-party runtime images, the upstream TensorFold image is not
defined in this repository. It only needs the pinned release archive plus a
CUDA/NCCL-capable base:

- glibc ≥ 2.28 and a driver providing `libcuda.so.1`;
- **NCCL ≥ 2.30** when native ranks are used (TensorFold refuses older NCCL);
- libibverbs/verbs providers for RoCE, and cuBLASLt for `--vision`/projections.

The DGX Spark platform default names the upstream image tag; recipes may
override `container:` to pin an exact engine version or a locally built image.
If an image exists only on the targets (pre-built locally, not published),
set `distribution_config.containers.enabled: false`; the launcher then skips
the control-machine pull/save and leaves the local tag to each host. The
runtime still probes the image on every target before the model starts.

## Solo: one Spark

The runtime emits, inside the container:

```text
tensorfold-native serve <model> --host 0.0.0.0 --port <port> --name <served>
--no-update-check [--context N] [--parallel N] [--vision] [--no-thinking] ...
```

`--host`/`--port` are mandatory and are always emitted: the engine defaults to
`127.0.0.1:8080`, while sparkrun's readiness watcher and proxy expect the
recipe/chain port on the head host. The engine exits on SIGTERM after a
graceful drain (`TF_DRAIN_S`, 20 s by default), which is what `sparkrun stop`
uses.

Served APIs: Chat/Completions, Responses and Anthropic Messages. The runtime
declares all three to the proxy/readiness layers and uses `/health`.

### Common `defaults:` keys

| recipe key | TensorFold flag | notes |
|---|---|---|
| `port`, `host` | `--port`, `--host` | `host` defaults to `0.0.0.0` |
| `served_model_name` | `--name` | advertised model id |
| `max_model_len` | `--context` | prompt + reply window |
| `max_num_seqs` | `--parallel` | concurrent streams, **not** tensor parallelism |
| `max_tokens` | `--max-tokens` | default reply cap |
| `temperature`, `top_p`, `top_k`, `min_p` | same | sampling defaults |
| `thinking` | `--thinking` / `--no-thinking` | false emits `--no-thinking` |
| `vision`, `no_drafts`, `loop_guard`, `metrics_open`, `dashboard` | presence flags | `metrics_open`/`dashboard` are rank-0 only |
| `drafter`, `drafter_bits`, `alias`, `chat_template` | same | |
| `api_key` | `--api-key` | also surfaced to proxy discovery |
| `command_binary` | replaces `tensorfold-native` | for images with an entrypoint |

Anything else is reported by the unmapped-key check; use a recipe `command:`
template for exotic flags (solo only).

## NFS / pre-placed weights

TensorFold serves a local checkpoint directory as happily as an HF repo id, so
sparkrun's existing pre-placed model path is the NFS mechanism — no
runtime-specific code:

```yaml
model: /mnt/nfs/models/qwen3.8-27b-mlx4 # absolute path, present on every host
```

or, for a recipe that keeps a portable model id:

```yaml
model: TensorFold/Qwen3.8-27B-MLX-4bit
cluster_config:
resolved_model_path: /mnt/nfs/models/qwen3.8-27b-mlx4
```

In both forms sparkrun skips download and distribution, verifies the path on
every target (`test -e`), identity-mounts the directory into the container at
the same path, and points the serve command at it. `{model}` in a command
template also resolves to that path. Two consequences:

- **Trust matters.** An absolute `model:` (or `cluster_config`) is a
trusted-recipe feature: a local recipe or `--trust` is required. A registry
recipe cannot carry an NFS path that sparkrun will silently honour.
- The path must be the complete checkpoint directory (HF snapshot layout or the
engine's expected model directory), not a partial copy.

A shared Hugging Face cache on NFS is the other supported shape: set the
cluster's `cache_dir` to the shared mount and disable distribution
(`distribution.model.enabled: false` or `skip_fan_out: true`), and the engine
reads the mounted cache (`HF_HOME`/`HF_HUB_CACHE` are set by the runtime).
Prefer the absolute-path form for TensorFold: it survives SHA-pinned downloads
that leave no `refs/` entry in the cache.

## Native TP: upstream rank placement

Upstream TensorFold exposes the rank flags generically on the CUDA server:

```text
tensorfold-native serve <model> --tp <world> --rank <r> --master <head>
--master-port <port> ...
```

sparkrun sets `tensor_parallel` to the number of hosts (one GPU per Spark), puts
one rank on each host, and emits those flags for every rank. Only rank 0 gets
the HTTP flags (`--host/--port/--name/--api-key`); the follower ranks run the
same engine without a listener. The orchestrator starts the followers first,
then rank 0, and skips the head-port gate because the engine owns the join; the
launcher's endpoint watcher still owns readiness.

```yaml
defaults:
tensor_parallel: 2
min_nodes: 2
max_nodes: 2
```

A recipe `command:` template is refused for TP because it cannot emit different
argv for the serving and follower ranks. Rank options are not universal family
support: upstream decides which models accept `--tp` above one and refuses the
rest by name. sparkrun does not second-guess that decision.

### Limits

- Upstream qualifies the family-specific worlds; sparkrun does not add a
separate support matrix. A model that refuses `--tp` fails at engine
startup with the engine's own message.
- TP is not a speed multiplier yet on two GB10s (upstream issue #981); the
reason to run it is capacity.
- Both ranks verify the checkpoint before serving; a shared NFS mount is the
simplest way to guarantee they see the same one.
- The container needs the fabric: the Docker executor already uses host
networking, privileged mode and the optional `/dev/infiniband` device; the
runtime adds `IPC_LOCK` and unlimited memlock. Set `NCCL_IB_GID_INDEX` etc.
through cluster/recipe `env` for your fabric.

## Validation checklist for the hardware run

1. Build/publish the upstream image outside this repository; check
`tensorfold-native --version`.
2. `sparkrun run <recipe> --dry-run` — confirm the rendered command has
`--host 0.0.0.0 --port <port>`, and for TP the `--tp/--rank/--master` flags.
3. Solo: one Spark, then `/v1/models`, `sparkrun proxy`, `sparkrun cluster
monitor` (`[tensorfold]` lines are colorized), `sparkrun logs`, `stop`.
4. NFS: an absolute `model:` present on the target; confirm no download and the
identity mount.
5. TP: a model the upstream engine supports at that world; rank 1 must start
before rank 0; both logs under the normal `sparkrun logs`; stop removes both
containers.
6. Report the exact engine tag, CUDA/NCCL versions, model pack and revision.

## Known limitations / non-goals

- Only upstream TensorFold is supported. Out-of-tree forks and their prepared
bundles are not modelled by this runtime; when upstream serves a checkpoint,
it runs through this same path.
- No macOS/`--speed-up` (upstream-only) and no CPU execution.
- TensorFold moves fast (several releases a week; only the latest gets security
fixes). Mirror the runtime's `container:` override to a pinned image tag and
bump it deliberately.
- The engine binds unauthenticated on `0.0.0.0`. Set `api_key` (forwarded as
`--api-key`) when more than the control machine can reach the host, exactly as
with any other sparkrun runtime.
11 changes: 11 additions & 0 deletions sparkrun-omp-plugin/skills/configuration/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ sequence. `--yes` accepts defaults, not SSH/sudo passwords; it does not guarante
an unattended run.

`setup check` is read-only and detects duplicate SSH host keys and machine IDs.
`setup ssh` asks `[y/N]` before replacing a *changed* host key on the control machine
(re-imaged host vs man-in-the-middle is the user's call); never answer it for them.
The wizard can offer repair. Rotation is a separate confirmed action:

```bash
Expand Down Expand Up @@ -87,6 +89,15 @@ sparkrun setup diagnose --cluster mylab --output diagnostics.ndjson

Clusters hold candidate hosts; actual placement may select a subset/different
head. Incremental changes use `--add-host`/`--remove-host` (repeatable, comma lists).
`SPARKRUN_CLUSTER=<name>` overrides the default cluster for one shell (ignored with a
warning if it names no saved cluster); explicit `--cluster`/`--hosts` still win.
`sparkrun ssh [N | <cluster>[/N]] [-- <cmd>]` opens SSH on a node (index into the saved
host list; default node 0 of the default cluster). `sparkrun exec [N | <workload>[/N]] [-- <cmd>]`
opens a shell in a running workload's container (node = container, head first; no target =
the only running workload). `-n` prints the command. One word after `--` is shell syntax
(`-- 'ps | grep x'`). On for beta/alpha; on stable, `sparkrun setup features enable cli.ssh`
(or `cli.exec`). Shells are interactive: the user runs them (`! sparkrun ssh ...`); only
`-- <cmd>` or `-n` fit here.
SSH and shared sudo fallback can prompt: use a user terminal. `fix-permissions`
and `clear-cache` offer `--save-sudo` for scoped sudoers entries. `clear-cache`
drops Linux **page cache**, not model files. Diagnostics are NDJSON;
Expand Down
6 changes: 4 additions & 2 deletions sparkrun-omp-plugin/skills/workloads/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -187,8 +187,10 @@ sparkrun daemon --url https://controller:8443 --token-file <token_file> status
sparkrun daemon --socket <socket_path> jobs list
```

Connection flags precede the daemon subcommand. Inspect `/v1/ops` for actual
operation names/schemas; plugins use `plugins.<plugin_id>.*`. Jobs may need prompt
Connection flags precede the daemon subcommand. `sparkrun daemon help` lists actual
operation names; `sparkrun daemon help <operation>` shows its fields, scope and a
`daemon call` example (`--json` for the `/v1/ops` schemas). Plugins use
`plugins.<plugin_id>.*`. Jobs may need prompt
responses. Events follow streams; `jobs show` is a finite poll. Never print tokens.

<Tool_Usage>
Expand Down
10 changes: 5 additions & 5 deletions src/sparkrun/cli/_monitor_colorize.py
Original file line number Diff line number Diff line change
Expand Up @@ -375,11 +375,11 @@ class TensorFoldColorizer(LogColorizer):

#: Canonical runtime name -> colorizer. Keys cover the in-tree runtimes
#: (``vllm-ray``, ``vllm-distributed``, ``eugr-vllm``, ``sglang``, ``trtllm``,
#: ``atlas``, ``llama-cpp``) plus aliases. ``modular-max`` and ``tokenary`` are
#: deliberately absent: their lines are Python-logging shaped, which the generic
#: vocabulary covers, so sniffing handles them. ``tensorfold`` is not in-tree
#: today; the alias means an out-of-tree runtime declaring that name gets its
#: verified rules without sniffing.
#: ``atlas``, ``llama-cpp``, ``tensorfold``) plus aliases. ``modular-max`` and
#: ``tokenary`` are deliberately absent: their lines are Python-logging shaped,
#: which the generic vocabulary covers, so sniffing handles them. The
#: DeepSeek community fork logs under the same ``[tensorfold]``/``tensorfold:``
#: prefixes, so the single runtime's alias covers it without content sniffing.
RUNTIME_COLORIZERS: dict[str, LogColorizer] = {
"vllm": _VLLM,
"vllm-ray": _VLLM,
Expand Down
1 change: 1 addition & 0 deletions src/sparkrun/core/features.py
Original file line number Diff line number Diff line change
Expand Up @@ -315,6 +315,7 @@ def _runtime_flag(engine: str, description: str, *, default: bool = True) -> Fea
FEATURE_RUNTIME_ATLAS = _runtime_flag("atlas", "Atlas runtime")
FEATURE_RUNTIME_MODULAR_MAX = _runtime_flag("modular_max", "Modular MAX runtime")
FEATURE_RUNTIME_TOKENARY = _runtime_flag("tokenary", "tokenary runtime (experimental; off by default)", default=False)
FEATURE_RUNTIME_TENSORFOLD = _runtime_flag("tensorfold", "TensorFold native CUDA runtime")

# The experimental executors are off by default on every channel; users opt
# in explicitly via ``features.executor.*`` in config.yaml (or the
Expand Down
1 change: 1 addition & 0 deletions src/sparkrun/platforms/dgx_spark.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
"modular-max": "modular/max-nvidia-full:latest",
"atlas": "azeezish/atlas-gb10:latest",
"tokenary": "scitrera/tokenary:latest",
"tensorfold": "ghcr.io/spark-arena/tensorfold:1.1.3",
}


Expand Down
Loading
Loading