Skip to content

Kyojin: open-source engine that runs 100 GB-class open models (GLM-5.3, Qwen3.8, DeepSeek V4.1) on one desktop machine. AMD Strix Halo, NVIDIA RTX and Apple Mac. OpenAI API, built on ExLlamaV3.

split: report actual component placement

Resynth06e8c43e8867
diff --git a/doc/split.md b/doc/split.md
index 16d8fa7..24b6941 100644
--- a/doc/split.md
+++ b/doc/split.md
@@ -41,7 +41,7 @@ otherwise; they are measurements, not assumptions of the interface.
| `--part0-layers auto\|N` | `KYOJIN_PART0_LAYERS` | first N transformer layers on `part0`; 0 = off |
| `--part1-device auto\|cuda:N\|gfxXXXX\|uuid\|name` | `KYOJIN_PART1_DEVICE` | `part1` device selection (`auto` = `cuda:0`) |
| `--part0-device auto\|cuda:N\|gfxXXXX\|uuid\|name` | `KYOJIN_PART0_DEVICE` | `part0` device selection (`auto` = the only other device when two are visible; otherwise a selector is required) |
-| `--endcaps on\|off` | `KYOJIN_ENDCAPS` | move the text allowlist (norm/hc/lm_head-like) and whole MTP/vision components to `part0` (default on) |
+| `--endcaps on\|off` | `KYOJIN_ENDCAPS` | move the text allowlist (norm/hc/lm_head-like) and the whole MTP/vision component (all non-CPU modules) to `part0` (default on) |
| `--part0-reserve-gb` | `KYOJIN_PART0_RESERVE_GB` | VRAM held as a load-time slab on `part0` for workspace (default 1.2; a tuning value, size it to the card) |
| `--split-preset auto\|glm\|qwen\|ds41\|none` | `KYOJIN_SPLIT_PRESET` | per-model unsafe-env preset slot; GLM needs none today |
| `--split-graphs auto\|on\|off` | — | per-segment capture (Stage 6); split forces graphs off until then |
@@ -88,7 +88,11 @@ new map must error.
- Graphs: split mode declines whole-forward, lag-1, `prepare_inputs` and per-block captures
(`split_active`). Per-segment capture is Stage 6.
- Per-component load table and a cache/recurrent placement audit print after load: every
- cache layer must sit on the device its owning layer was mapped to.
+ cache layer must sit on the device its owning layer was mapped to. The table's `devices`
+ column lists the devices that actually hold tensors, not the configured part0/part1 pair;
+ an empty range prints `-`. CPU-resident modules (the shared embedding) are reported
+ separately, so a whole MTP/vision component with endcaps on shows `part1 -` and only
+ part0 in `devices`.
- Auto-N is a Stage 1 skeleton: it uses actual safetensors bytes for each layer, the
cache/recurrent sizes for layers below N, the part0 endcap bytes and the reserve, with
a `KYOJIN_AUTON_SAFETY_GB` margin (default 0.25) for allocator slack. Adapter tuning
diff --git a/exllamav3/device_map.py b/exllamav3/device_map.py
index d10c992..6b32e74 100644
--- a/exllamav3/device_map.py
+++ b/exllamav3/device_map.py
@@ -550,6 +550,23 @@ class ComponentMap:
out.append(self.part0)
return out
+ @property
+ def placed_devices(self) -> list[torch.device]:
+ """Devices that actually hold tensors for this component.
+
+ ``used_devices`` is the configured part1/part0 pair; a whole component with
+ endcaps on has no tensors on part1 even though that pair still contains it.
+ CPU-resident modules (the shared embedding) are reported separately.
+ """
+ out: list[torch.device] = []
+ for module in self._module_refs:
+ if getattr(module, "caps", {}).get("prefer_cpu"):
+ continue
+ device = self.device_for(module)
+ if device.type == "cuda" and device not in out:
+ out.append(device)
+ return sorted(out, key = lambda d: d.index or 0)
+
@property
def policy_or_default(self) -> ComponentPolicy:
return self.policy or component_policy(self.component)
@@ -973,11 +990,12 @@ class SplitPlan:
if d is None:
continue
part0 = f"0..{r.part0_layers - 1}" if r.part0_layers else "-"
- part1 = f"{r.part0_layers}..{r.layer_count - 1}" if r.layer_count else "-"
+ part1 = (f"{r.part0_layers}..{r.layer_count - 1}"
+ if r.part0_layers < r.layer_count else "-")
+ placed = ", ".join(str(x) for x in d.placed_devices) or "-"
self.logger(f"[split] {r.component:7s} {r.seconds:7.1f}s part0 {part0:>10s} "
f"part1 {part1:>10s} weights {r.weight_bytes / GIB:7.2f} GiB "
- f"cache {r.cache_bytes / GIB:6.2f} GiB devices "
- f"{', '.join(str(x) for x in d.used_devices)}")
+ f"cache {r.cache_bytes / GIB:6.2f} GiB devices {placed}")
for w in r.warnings:
self.logger(f"[split] warning: {w}")
diff --git a/tests/test_split_plan_cpu.py b/tests/test_split_plan_cpu.py
index b6065b8..40fc3ea 100644
--- a/tests/test_split_plan_cpu.py
+++ b/tests/test_split_plan_cpu.py
@@ -221,6 +221,21 @@ def test_whole_component_places_every_module_part0_only_with_endcaps(split_modul
assert all(off.device_for(m) == torch.device("cuda", 0) for m in mtp.modules)
+def test_whole_component_reports_only_placed_devices(split_modules):
+ dm, _bridge, _split = split_modules
+ mtp = FakeModel([
+ FakeModule("mtp.embed", caps = {"prefer_cpu": True}),
+ FakeModule("mtp.pre", caps = {}),
+ FakeModule("mtp.block.0", layer_idx = 0),
+ FakeModule("mtp.head", caps = {}),
+ ])
+ on = dm.ComponentMap.from_model(mtp, 0, True, _devices(dm), component = "mtp")
+ off = dm.ComponentMap.from_model(mtp, 0, False, _devices(dm), component = "mtp")
+ assert on.placed_devices == [torch.device("cuda", 1)]
+ assert off.placed_devices == [torch.device("cuda", 0)]
+ assert torch.device("cpu") not in on.placed_devices + off.placed_devices
+
+
def test_module_bytes_uses_compile_or_alt_key_when_prefix_is_empty(split_modules):
dm, _bridge, _split = split_modules
stc = FakeSTC({"embed_tokens": 456})
diff --git a/tools/strix_halo/split_load.py b/tools/strix_halo/split_load.py
index 3870030..0bff538 100644
--- a/tools/strix_halo/split_load.py
+++ b/tools/strix_halo/split_load.py
@@ -118,7 +118,7 @@ def main() -> None:
vision.load(device_map=plan.map("vision"), progressbar=True)
plan.record_load("vision", time.perf_counter() - t1)
print(f"[split] vision loaded in {time.perf_counter() - t1:.1f} s "
- f"on {plan.map('vision').used_devices}", flush=True)
+ f"on {plan.map('vision').placed_devices}", flush=True)
except Exception as exc: # noqa: BLE001
print(f"[split] vision not loaded: {type(exc).__name__}: {exc}", flush=True)
vision = None