فهرست منبع

engine: tensorfold driver + tensorfold_1017_prepare built-in (NODE_RANK exported to hooks)

- src/engine/{mod,drivers}.rs: split the five driver impls out of engine.rs (it
  had crossed the 500-line gate) and add TensorFoldDriver:
  `python -m tensorfold serve <model>` with --tp/--rank/--master/--master-port
  rendezvous, no headless workers, configurable API port.
- before_serve exports NODE_RANK to built-in scripts (sudo NODE_RANK=<n> bash),
  so a hook can stage per-rank artifacts.
- host-scripts/tensorfold-1017-prepare.sh: idempotent host staging for the
  TensorFold 2x 1017 lane (node-local EXL3 weights, chat template, per-rank
  Engram packs, CPU-only CUDA prebuild). Image-dependent steps degrade
  gracefully when the image is not on the node yet (pre-serve runs before the
  image sync) — helper files come from the NAS published by the image build.
Alexander Korolev 4 روز پیش
والد
کامیت
198e6137dd
6فایلهای تغییر یافته به همراه353 افزوده شده و 152 حذف شده
  1. 13 3
      AGENTS.md
  2. 108 0
      host-scripts/tensorfold-1017-prepare.sh
  3. 6 1
      src/before_serve.rs
  4. 7 0
      src/builtin_scripts.rs
  5. 187 0
      src/engine/drivers.rs
  6. 32 148
      src/engine/mod.rs

+ 13 - 3
AGENTS.md

@@ -368,9 +368,12 @@ The `deploy` field selects how the recipe is launched on each node:
   the same pin skips the build (the native analog of the docker image build +
   checksum label). No `repo`/`rev` → assume pre-installed.
 
-**First-class engines** (`engine` selects an `EngineDriver` in `src/engine.rs`):
-`vllm` (default), `sglang`, `gr8` (`kindlingai/gr8`, docker deploy, `--tp/--peers`
-rendezvous, fixed API :8100), and `dgpp` (`HawkBearPig/dgpp`, native deploy).
+**First-class engines** (`engine` selects an `EngineDriver` in
+`src/engine/{mod,drivers}.rs`): `vllm` (default), `sglang`, `gr8`
+(`kindlingai/gr8`, docker deploy, `--tp/--peers` rendezvous, fixed API :8100),
+`dgpp` (`HawkBearPig/dgpp`, native deploy), and `tensorfold`
+(`python -m tensorfold serve <model>`, docker deploy, `--tp/--rank/--master/
+--master-port` rendezvous on the fabric IP).
 Engines whose driver returns `takes_host_port() == false` (gr8, dgpp) get no
 `--host/--port` and are exempt from `validate`'s port-convention rule (their API
 port is fixed). Design: `specs/tech-architecture/engine-drivers.md`.
@@ -483,6 +486,13 @@ Built-in aliases:
 |-------|------|---------|
 | `stop_dgx_services` | `host-scripts/stop-dgx-services.sh` | Stop non-essential services on a DGX node (frees unified memory) |
 | `restore_dgx_services` | `host-scripts/restore-dgx-services.sh` | Restore services stopped by `stop_dgx_services` |
+| `tensorfold_1017_prepare` | `host-scripts/tensorfold-1017-prepare.sh` | Stage the TensorFold 2x 1017 lane: node-local EXL3 weights, chat template, per-rank Engram packs, CUDA prebuild (idempotent; uses `NODE_RANK`) |
+
+Built-in scripts run with **`NODE_RANK` exported** (`sudo NODE_RANK=<n> bash
+<remote>`), so a hook can stage per-rank artifacts. Helper files a hook needs
+(e.g. the Engram packer, chat template) are published to the NAS by the recipe
+image's `build.sh` — pre-serve hooks run **before** the image is built/synced,
+so a hook must not assume the image is on the node yet.
 
 To add a built-in: drop the `.sh` into `host-scripts/`, add an
 `include_str!` + `BuiltinScript` entry in `src/builtin_scripts.rs`, document

+ 108 - 0
host-scripts/tensorfold-1017-prepare.sh

@@ -0,0 +1,108 @@
+#!/usr/bin/env bash
+# tensorfold-1017-prepare — host-side staging for the TensorFold 2x 1017 lane.
+#
+# Idempotent: every step is skipped when its output already exists. Runs on
+# each launch node before the containers start (recipe `before_serve`), with
+# NODE_RANK exported by the launcher.
+#
+# Everything here works WITHOUT the image: the launcher runs pre-serve hooks
+# *before* it builds/syncs the image, so the helper files (Engram packer, chat
+# template, CUDA prebuild inputs) are published to the NAS by the recipe image's
+# build.sh. The one image-dependent step (CUDA prebuild) is skipped when the
+# image is not on this node yet and simply runs on the next serve.
+#
+# Steps
+#   1. node-local copy of the EXL3 2.9bpw checkpoint (EXL3 streams weights on
+#      every decode step — reading them off the NAS costs most of the decode);
+#   2. the chat template the TensorFold HTTP app requires at init (the EXL3
+#      checkpoint carries none);
+#   3. the per-rank Engram packs (layers 1 + 14, ~47 GiB each) built from the
+#      official 1017 shards 47/48 — rank r owns hash heads [12r, 12r+12);
+#   4. the CUDA extension prebuild (CPU-only, 18/18 builders) when the image is
+#      already present.
+#
+# Overrides (env): TF1017_ROOT (default /home/kilork/ns/1017-tf),
+# TF1017_NAS (default /mnt/nas/ai/huggingface/hub), TF1017_IMAGE,
+# TF1017_SKIP_WEIGHTS=1, TF1017_SKIP_PACK=1, TF1017_SKIP_PREBUILD=1.
+set -euo pipefail
+
+ROOT="${TF1017_ROOT:-/home/kilork/ns/1017-tf}"
+NAS="${TF1017_NAS:-/mnt/nas/ai/huggingface/hub}"
+PUB="${TF1017_PUB:-/mnt/nas/ai/sm121/dsv41-tf-1017}"
+IMG="${TF1017_IMAGE:-dsv41-tf-1017:v1}"
+RANK="${NODE_RANK:-0}"
+REV="${TF1017_MODEL_REV:-afc7aa0aab98ee735c0f54e0a122019af1ac08f1}"
+EREV="${TF1017_ENGRAM_REV:-1bae0e1088993b9b82de08f59de5be5a34e42170}"
+
+WBUNDLE="$NAS/models--LibertAIDAI--DeepSeek-V4.1-Flash-1017-EXL3-2.9bpw/snapshots/$REV"
+EBUNDLE="$NAS/models--deepseek-ai--DeepSeek-V4.1-Flash-1017/snapshots/$EREV"
+CKPT="$ROOT/models/checkpoint"
+PACKED="$ROOT/engram-packed-1017"
+CACHE="$ROOT/cache"
+HELP="$ROOT/helpers"
+
+mkdir -p "$CKPT" "$PACKED" "$CACHE" "$HELP" "$ROOT/state"
+
+echo "[tf1017] rank $RANK — root $ROOT"
+
+# 0. helper files (published to the NAS by the image's build.sh) -------------
+for f in pack_engram.py prebuild_ext.py prebuild-offline.py pfdense-table.json \
+         chat_template.jinja; do
+    if [[ ! -s "$HELP/$f" ]]; then
+        if [[ -s "$PUB/$f" ]]; then
+            cp -f "$PUB/$f" "$HELP/$f"
+        elif docker image inspect "$IMG" >/dev/null 2>&1; then
+            docker run --rm --network none --entrypoint cat "$IMG" "/opt/sm121-helpers/$f" > "$HELP/$f"
+        else
+            echo "[tf1017] FATAL: $f not published at $PUB and image $IMG absent" >&2
+            exit 1
+        fi
+    fi
+done
+
+# 1. weights -----------------------------------------------------------------
+if [[ "${TF1017_SKIP_WEIGHTS:-0}" != "1" ]]; then
+    have=$(find "$CKPT" -maxdepth 1 -name '*.safetensors' | wc -l)
+    if [[ "$have" -lt 43 ]]; then
+        echo "[tf1017] copying EXL3 checkpoint from the NAS ($have/43 shards present)"
+        tar -chf - -C "$WBUNDLE" . | tar -xf - -C "$CKPT"
+    fi
+    have=$(find "$CKPT" -maxdepth 1 -name '*.safetensors' | wc -l)
+    [[ "$have" -ge 43 ]] || { echo "[tf1017] FATAL: checkpoint incomplete ($have/43)" >&2; exit 1; }
+fi
+
+# 2. chat template -----------------------------------------------------------
+[[ -s "$CKPT/chat_template.jinja" ]] || cp "$HELP/chat_template.jinja" "$CKPT/chat_template.jinja"
+
+# 3. per-rank Engram packs (host python + numpy; no image needed) ------------
+if [[ "${TF1017_SKIP_PACK:-0}" != "1" ]]; then
+    if [[ ! -s "$PACKED/engram-l14-r${RANK}of2.bin" ]]; then
+        python3 -c 'import numpy' 2>/dev/null || python3 -m pip install --user --quiet numpy
+        echo "[tf1017] packing Engram tables for rank $RANK (~94 GiB, reads 189 GiB from the NAS)"
+        python3 "$HELP/pack_engram.py" \
+            --src "$EBUNDLE" --config "$CKPT/config.json" \
+            --out "$PACKED" --rank "$RANK"
+    fi
+    [[ -s "$PACKED/engram-l1-r${RANK}of2.bin" && -s "$PACKED/engram-l14-r${RANK}of2.bin" ]] \
+        || { echo "[tf1017] FATAL: Engram packs missing for rank $RANK" >&2; exit 1; }
+fi
+
+# 4. CUDA extension prebuild (needs the image; skipped on a first serve) -----
+if [[ "${TF1017_SKIP_PREBUILD:-0}" != "1" && ! -s "$CACHE/pfdense-table.json" ]]; then
+    if docker image inspect "$IMG" >/dev/null 2>&1; then
+        echo "[tf1017] prebuilding CUDA extensions (CPU-only)"
+        docker run --rm --network none --memory 8g --cpus 4 \
+            -e CUDA_VISIBLE_DEVICES= -e TORCH_CUDA_ARCH_LIST=12.1 -e MAX_JOBS=4 \
+            -e TORCH_EXTENSIONS_DIR=/cache/torch_extensions \
+            -v "$CACHE":/cache \
+            -v "$HELP/prebuild-offline.py":/offline.py:ro \
+            -v "$HELP/prebuild_ext.py":/prebuild.py:ro \
+            -v "$HELP/pfdense-table.json":/table.json:ro \
+            --entrypoint bash "$IMG" \
+            -c 'python /offline.py && cp /table.json /cache/pfdense-table.json'
+    else
+        echo "[tf1017] image $IMG not on this node yet — extensions will compile at first start"
+    fi
+fi
+
+echo "[tf1017] rank $RANK ready"

+ 6 - 1
src/before_serve.rs

@@ -124,7 +124,12 @@ async fn run_for_node(
                 })?;
                 let remote = format!("/tmp/sm121-builtin-{}.sh", script);
                 crate::ssh::upload_script(config, node, body, &remote, dry_run).await?;
-                (format!("script:{script}"), format!("sudo bash {remote}"))
+                // `NODE_RANK` lets a built-in stage per-rank artifacts (e.g. the
+                // TensorFold Engram packs) without inventing a second mechanism.
+                (
+                    format!("script:{script}"),
+                    format!("sudo NODE_RANK={} bash {remote}", node.rank),
+                )
             }
             _ => {
                 let c = cmd.command();

+ 7 - 0
src/builtin_scripts.rs

@@ -39,6 +39,13 @@ pub static BUILTIN_SCRIPTS: &[BuiltinScript] = &[
         alias: "restore_display_ram",
         body: include_str!("../host-scripts/restore-display-ram.sh"),
     },
+    // Host-side staging for the TensorFold 2x 1017 lane: node-local EXL3
+    // weights, chat template, per-rank Engram packs, CUDA prebuild. Idempotent;
+    // needs NODE_RANK (exported by before_serve) to pick the right Engram pack.
+    BuiltinScript {
+        alias: "tensorfold_1017_prepare",
+        body: include_str!("../host-scripts/tensorfold-1017-prepare.sh"),
+    },
 ];
 
 /// Resolve an alias to its script body. Returns `None` (and the caller

+ 187 - 0
src/engine/drivers.rs

@@ -0,0 +1,187 @@
+//! The concrete engine drivers. Each encapsulates one engine's model argument,
+//! rendezvous flags, headless convention, bind-IP env var, API-port semantics,
+//! tmux entrypoint fallback and doctor hint.
+
+use super::{EngineDriver, EngineFlagsCtx};
+use crate::config::{DistributedBackend, Node, Recipe};
+
+/// vLLM: positional model, `--tensor-parallel-size`/`--nnodes`/`--master-addr`
+/// rendezvous, `--headless` workers, `VLLM_HOST_IP`.
+pub struct VllmDriver;
+
+impl EngineDriver for VllmDriver {
+    fn distributed_args(&self, ctx: &EngineFlagsCtx<'_>, node: &Node) -> Vec<String> {
+        let mut fp = vec![
+            "--tensor-parallel-size".into(),
+            ctx.tp_size.to_string(),
+            "--pipeline-parallel-size".into(),
+            ctx.pp_size.to_string(),
+            "--nnodes".into(),
+            ctx.nnodes.to_string(),
+            "--node-rank".into(),
+            node.rank.to_string(),
+            "--master-addr".into(),
+            ctx.master_ib_ip.to_string(),
+            "--master-port".into(),
+            ctx.init_port.to_string(),
+        ];
+        if ctx.recipe.distributed_backend == Some(DistributedBackend::Ray) {
+            fp.push("--distributed-executor-backend".into());
+            fp.push("ray".into());
+        }
+        fp
+    }
+
+    fn headless_workers(&self) -> bool {
+        true
+    }
+
+    fn engine_ip_env(&self) -> Option<&'static str> {
+        Some("VLLM_HOST_IP")
+    }
+
+    fn entrypoint_default(&self) -> Vec<String> {
+        vec!["python -m vllm.entrypoints.openai.api_server".into()]
+    }
+
+    fn install_hint(&self) -> &'static str {
+        "pip install vllm"
+    }
+}
+
+/// SGLang: `--model-path`, `--tp`/`--nnodes`/`--dist-init-addr` rendezvous,
+/// no headless (port on every node), `SGLANG_WORKER_IP`.
+pub struct SglangDriver;
+
+impl EngineDriver for SglangDriver {
+    fn model_args(&self, recipe: &Recipe) -> Vec<String> {
+        if recipe.model.is_empty() {
+            Vec::new()
+        } else {
+            vec!["--model-path".into(), recipe.model.clone()]
+        }
+    }
+
+    fn distributed_args(&self, ctx: &EngineFlagsCtx<'_>, node: &Node) -> Vec<String> {
+        vec![
+            "--tp".into(),
+            ctx.tp_size.to_string(),
+            "--nnodes".into(),
+            ctx.nnodes.to_string(),
+            "--node-rank".into(),
+            node.rank.to_string(),
+            "--dist-init-addr".into(),
+            format!("{}:{}", ctx.master_ib_ip, ctx.init_port),
+        ]
+    }
+
+    fn engine_ip_env(&self) -> Option<&'static str> {
+        Some("SGLANG_WORKER_IP")
+    }
+
+    fn port_on_all_nodes(&self) -> bool {
+        true
+    }
+
+    fn entrypoint_default(&self) -> Vec<String> {
+        vec!["python -m sglang.launch_server".into()]
+    }
+
+    fn install_hint(&self) -> &'static str {
+        "pip install sglang"
+    }
+}
+
+/// gr8 (`kindlingai/gr8`): a from-scratch CUDA engine for full GLM-5.3,
+/// tensor-parallel across 3/4/6 Sparks. Per-node launch (every box runs the
+/// same `gr8 glm53 up` command; each rank finds itself in `--peers`). Model
+/// via `--model`, rendezvous via `--tp`/`--peers` (mgmt-LAN IPs), no headless,
+/// no bind-IP env, fixed API port :8100 (no `--host`/`--port`).
+pub struct Gr8Driver;
+
+impl EngineDriver for Gr8Driver {
+    fn model_args(&self, recipe: &Recipe) -> Vec<String> {
+        if recipe.model.is_empty() {
+            Vec::new()
+        } else {
+            vec!["--model".into(), recipe.model.clone()]
+        }
+    }
+
+    fn distributed_args(&self, ctx: &EngineFlagsCtx<'_>, _node: &Node) -> Vec<String> {
+        vec![
+            "--tp".into(),
+            ctx.tp_size.to_string(),
+            "--peers".into(),
+            ctx.peers.join(","),
+        ]
+    }
+
+    fn takes_host_port(&self) -> bool {
+        false
+    }
+
+    fn entrypoint_default(&self) -> Vec<String> {
+        vec!["/opt/gr8/gr8".into(), "glm53".into(), "up".into()]
+    }
+}
+
+/// DGPP (`HawkBearPig/dgpp`): a C++/CUDA engine, config-JSON driven and
+/// head-coordinated — rank 0 runs `dgpp-cluster up`, which brings up the
+/// peers itself. No CLI model/distributed flags (the cluster JSON carries
+/// model + world size + engine knobs), no bind-IP env, fixed API port
+/// (:18080). `deploy = native`.
+pub struct DgppDriver;
+
+impl EngineDriver for DgppDriver {
+    // The cluster JSON carries the model; no CLI model argument.
+    fn model_args(&self, _recipe: &Recipe) -> Vec<String> {
+        Vec::new()
+    }
+
+    // World size + rendezvous live in the cluster JSON, not CLI flags.
+    fn distributed_args(&self, _ctx: &EngineFlagsCtx<'_>, _node: &Node) -> Vec<String> {
+        Vec::new()
+    }
+
+    fn takes_host_port(&self) -> bool {
+        false
+    }
+
+    fn entrypoint_default(&self) -> Vec<String> {
+        vec!["scripts/dgpp-cluster".into(), "up".into()]
+    }
+}
+
+/// TensorFold (`x00byte/DeepSeek-V4.1-Flash-1017-Dual-Spark`, upstream
+/// `TensorFold`): a Python engine for a dual-Spark kit. The model is a
+/// positional directory (`python -m tensorfold serve <model>`), rendezvous via
+/// `--tp`/`--rank`/`--master`/`--master-port`, no headless workers (rank 1
+/// accepts `--host`/`--port` and ignores them — the HTTP app only starts on
+/// rank 0), no bind-IP env var, and the same configurable API port as
+/// vLLM/SGLang.
+pub struct TensorFoldDriver;
+
+impl EngineDriver for TensorFoldDriver {
+    fn distributed_args(&self, ctx: &EngineFlagsCtx<'_>, node: &Node) -> Vec<String> {
+        vec![
+            "--tp".into(),
+            ctx.tp_size.to_string(),
+            "--rank".into(),
+            node.rank.to_string(),
+            "--master".into(),
+            ctx.master_ib_ip.to_string(),
+            "--master-port".into(),
+            ctx.init_port.to_string(),
+        ]
+    }
+
+    fn entrypoint_default(&self) -> Vec<String> {
+        vec![
+            "python".into(),
+            "-m".into(),
+            "tensorfold".into(),
+            "serve".into(),
+        ]
+    }
+}

+ 32 - 148
src/engine.rs → src/engine/mod.rs

@@ -13,6 +13,10 @@
 //! **not** include the entrypoint, `--host`, or `--port` — those are
 //! deployment-specific and added by each path.
 
+mod drivers;
+
+pub use drivers::{DgppDriver, Gr8Driver, SglangDriver, TensorFoldDriver, VllmDriver};
+
 use crate::config::{DistributedBackend, Node, Recipe};
 
 /// Context for [`build_engine_args`] — the subset of `DockerCommandCtx` /
@@ -79,154 +83,6 @@ pub trait EngineDriver: Send + Sync {
     }
 }
 
-/// vLLM: positional model, `--tensor-parallel-size`/`--nnodes`/`--master-addr`
-/// rendezvous, `--headless` workers, `VLLM_HOST_IP`.
-pub struct VllmDriver;
-
-impl EngineDriver for VllmDriver {
-    fn distributed_args(&self, ctx: &EngineFlagsCtx<'_>, node: &Node) -> Vec<String> {
-        let mut fp = vec![
-            "--tensor-parallel-size".into(),
-            ctx.tp_size.to_string(),
-            "--pipeline-parallel-size".into(),
-            ctx.pp_size.to_string(),
-            "--nnodes".into(),
-            ctx.nnodes.to_string(),
-            "--node-rank".into(),
-            node.rank.to_string(),
-            "--master-addr".into(),
-            ctx.master_ib_ip.to_string(),
-            "--master-port".into(),
-            ctx.init_port.to_string(),
-        ];
-        if ctx.recipe.distributed_backend == Some(DistributedBackend::Ray) {
-            fp.push("--distributed-executor-backend".into());
-            fp.push("ray".into());
-        }
-        fp
-    }
-
-    fn headless_workers(&self) -> bool {
-        true
-    }
-
-    fn engine_ip_env(&self) -> Option<&'static str> {
-        Some("VLLM_HOST_IP")
-    }
-
-    fn entrypoint_default(&self) -> Vec<String> {
-        vec!["python -m vllm.entrypoints.openai.api_server".into()]
-    }
-
-    fn install_hint(&self) -> &'static str {
-        "pip install vllm"
-    }
-}
-
-/// SGLang: `--model-path`, `--tp`/`--nnodes`/`--dist-init-addr` rendezvous,
-/// no headless (port on every node), `SGLANG_WORKER_IP`.
-pub struct SglangDriver;
-
-impl EngineDriver for SglangDriver {
-    fn model_args(&self, recipe: &Recipe) -> Vec<String> {
-        if recipe.model.is_empty() {
-            Vec::new()
-        } else {
-            vec!["--model-path".into(), recipe.model.clone()]
-        }
-    }
-
-    fn distributed_args(&self, ctx: &EngineFlagsCtx<'_>, node: &Node) -> Vec<String> {
-        vec![
-            "--tp".into(),
-            ctx.tp_size.to_string(),
-            "--nnodes".into(),
-            ctx.nnodes.to_string(),
-            "--node-rank".into(),
-            node.rank.to_string(),
-            "--dist-init-addr".into(),
-            format!("{}:{}", ctx.master_ib_ip, ctx.init_port),
-        ]
-    }
-
-    fn engine_ip_env(&self) -> Option<&'static str> {
-        Some("SGLANG_WORKER_IP")
-    }
-
-    fn port_on_all_nodes(&self) -> bool {
-        true
-    }
-
-    fn entrypoint_default(&self) -> Vec<String> {
-        vec!["python -m sglang.launch_server".into()]
-    }
-
-    fn install_hint(&self) -> &'static str {
-        "pip install sglang"
-    }
-}
-
-/// gr8 (`kindlingai/gr8`): a from-scratch CUDA engine for full GLM-5.3,
-/// tensor-parallel across 3/4/6 Sparks. Per-node launch (every box runs the
-/// same `gr8 glm53 up` command; each rank finds itself in `--peers`). Model
-/// via `--model`, rendezvous via `--tp`/`--peers` (mgmt-LAN IPs), no headless,
-/// no bind-IP env, fixed API port :8100 (no `--host`/`--port`).
-pub struct Gr8Driver;
-
-impl EngineDriver for Gr8Driver {
-    fn model_args(&self, recipe: &Recipe) -> Vec<String> {
-        if recipe.model.is_empty() {
-            Vec::new()
-        } else {
-            vec!["--model".into(), recipe.model.clone()]
-        }
-    }
-
-    fn distributed_args(&self, ctx: &EngineFlagsCtx<'_>, _node: &Node) -> Vec<String> {
-        vec![
-            "--tp".into(),
-            ctx.tp_size.to_string(),
-            "--peers".into(),
-            ctx.peers.join(","),
-        ]
-    }
-
-    fn takes_host_port(&self) -> bool {
-        false
-    }
-
-    fn entrypoint_default(&self) -> Vec<String> {
-        vec!["/opt/gr8/gr8".into(), "glm53".into(), "up".into()]
-    }
-}
-
-/// DGPP (`HawkBearPig/dgpp`): a C++/CUDA engine, config-JSON driven and
-/// head-coordinated — rank 0 runs `dgpp-cluster up`, which brings up the
-/// peers itself. No CLI model/distributed flags (the cluster JSON carries
-/// model + world size + engine knobs), no bind-IP env, fixed API port
-/// (:18080). `deploy = native`.
-pub struct DgppDriver;
-
-impl EngineDriver for DgppDriver {
-    // The cluster JSON carries the model; no CLI model argument.
-    fn model_args(&self, _recipe: &Recipe) -> Vec<String> {
-        Vec::new()
-    }
-
-    // World size + rendezvous live in the cluster JSON, not CLI flags.
-    fn distributed_args(&self, _ctx: &EngineFlagsCtx<'_>, _node: &Node) -> Vec<String> {
-        Vec::new()
-    }
-
-    fn takes_host_port(&self) -> bool {
-        false
-    }
-
-    fn entrypoint_default(&self) -> Vec<String> {
-        vec!["scripts/dgpp-cluster".into(), "up".into()]
-    }
-}
-
 /// Resolve the driver for a recipe's `engine` string. Unknown engines fall
 /// back to the vLLM driver (matching the historical default: an engine with no
 /// dedicated driver still gets the vLLM-style tail).
@@ -235,6 +91,7 @@ pub fn driver_for(engine: &str) -> &'static dyn EngineDriver {
         "sglang" => &SglangDriver,
         "gr8" => &Gr8Driver,
         "dgpp" => &DgppDriver,
+        "tensorfold" => &TensorFoldDriver,
         "vllm" => &VllmDriver,
         _ => &VllmDriver,
     }
@@ -446,4 +303,31 @@ pub(crate) mod tests {
         // gr8 does not take --host/--port (fixed API port).
         assert!(!driver_for("gr8").takes_host_port());
     }
+
+    #[test]
+    fn tensorfold_uses_rank_master_rendezvous() {
+        let mut r = base_recipe();
+        r.engine = "tensorfold".into();
+        r.model = "/model".into();
+        r.entrypoint = vec![
+            "python".into(),
+            "-m".into(),
+            "tensorfold".into(),
+            "serve".into(),
+        ];
+        let c = ctx_peers(&r, 2, 2, &[]);
+        let head = build_engine_args(&c, &tnode(0));
+        assert_eq!(head.first().map(String::as_str), Some("/model"));
+        assert!(head.contains(&"--tp".into()));
+        assert!(head.contains(&"--rank".into()));
+        assert!(head.contains(&"--master".into()));
+        assert!(head.contains(&"--master-port".into()));
+        // no headless flag on workers, no engine bind-IP env
+        assert!(!driver_for("tensorfold").headless_workers());
+        assert!(driver_for("tensorfold").engine_ip_env().is_none());
+        let worker = build_engine_args(&c, &tnode(1));
+        assert!(!worker.contains(&"--headless".into()));
+        // the API port stays configurable (--host/--port on the tail)
+        assert!(driver_for("tensorfold").takes_host_port());
+    }
 }