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.

Ensure gfx1151 is primary target

Resynth4115b33209a4
diff --git a/doc/roc_hip_decode.md b/doc/roc_hip_decode.md
index 2036167..11fad52 100644
--- a/doc/roc_hip_decode.md
+++ b/doc/roc_hip_decode.md
@@ -180,13 +180,17 @@ model that fits the visible device (use the layer-split sibling for larger packs
```sh
# Whole-model chat-path coherence gate: 8 prompts x greedy/default, EOS, production
# loop guard and 20-gram repetition checks.
-HIP_VISIBLE_DEVICES=1 python tools/strix_halo/coherence_suite.py -m <model> -n 192
+python tools/strix_halo/coherence_suite.py -m <model> -n 192
# Per-shape GEMV timings and one streaming pass over every linear; --gemm A/Bs
# ext.exl3_gemm when the tree exports it.
-HIP_VISIBLE_DEVICES=1 python tools/strix_halo/gemv_perf_ab.py -m <model> --mode both --gemm
+python tools/strix_halo/gemv_perf_ab.py -m <model> --mode both --gemm
```
+On the single-gfx1151 target no device variable is needed. With several GPUs
+visible, set `HIP_VISIBLE_DEVICES` to the index whose `gcnArchName` matches; the
+enumeration order is a driver/boot property, so do not hardcode an index.
+
`tests/hip_gemv_logits_oracle.py` is the forced fallback-vs-GEMV logits oracle.
`EXL3_ORACLE_STEPS` sets the trace length (default 16); `EXL3_ORACLE_FREE=1` adds the
unforced diagnostic pass. Both the oracle and worker read the step variable.
diff --git a/tools/strix_halo/coherence_suite.py b/tools/strix_halo/coherence_suite.py
index eb8d99b..aa00d83 100644
--- a/tools/strix_halo/coherence_suite.py
+++ b/tools/strix_halo/coherence_suite.py
@@ -9,7 +9,11 @@ reason, the loop-guard verdicts used by tools/qwen/serve.py, the worst 20-gram
repetition count and whether EOS was reached.
python tools/strix_halo/coherence_suite.py -m <model>
- HIP_VISIBLE_DEVICES=1 python tools/strix_halo/coherence_suite.py -m <model> -n 512
+ python tools/strix_halo/coherence_suite.py -m <model> -n 512
+
+On the single-gfx1151 target no device variable is needed. On a multi-GPU box set
+HIP_VISIBLE_DEVICES to the index whose gcnArchName matches the intended device; the
+index order is a driver/boot property, so do not assume a fixed value.
The model must fit the visible device (use the layer-split sibling for larger packs).
diff --git a/tools/strix_halo/env.sh b/tools/strix_halo/env.sh
index 9d7cf03..1a88c12 100755
--- a/tools/strix_halo/env.sh
+++ b/tools/strix_halo/env.sh
@@ -94,19 +94,39 @@ if [ "${1:-}" = "--check" ]; then
exit 1
fi
"$EXL3_VENV/bin/python" - <<'PY'
+import sys
import torch
-p = torch.cuda.get_device_properties(0)
print(f"torch {torch.__version__} hip {torch.version.hip}")
-print(f"{p.name} / {p.gcnArchName} / warp={p.warp_size} / {p.total_memory/2**30:.1f} GiB / {p.multi_processor_count} CUs")
-a = torch.randn(512, 512, dtype=torch.float16, device="cuda")
+n = torch.cuda.device_count()
+if n == 0:
+ print("no HIP devices visible")
+ sys.exit(1)
+
+def key_of(p):
+ # ROCm: gcnArchName ("gfx1151"); CUDA: sm_XY from major/minor.
+ arch = getattr(p, "gcnArchName", "") or ""
+ arch = arch.split(":", 1)[0]
+ return arch or f"sm_{p.major}{p.minor}"
+
+keys = []
+for i in range(n):
+ p = torch.cuda.get_device_properties(i)
+ keys.append(key_of(p))
+ warp = getattr(p, "warp_size", None)
+ extra = f" / warp={warp}" if warp else ""
+ print(f"[{i}] {p.name} / {keys[-1]}{extra} / "
+ f"{p.total_memory/2**30:.1f} GiB / {p.multi_processor_count} CUs")
+# gfx1151 is the primary target; with an eGPU visible it is not necessarily device 0.
+target = keys.index("gfx1151") if "gfx1151" in keys else 0
+print(f"checking device [{target}] ({keys[target]})")
+a = torch.randn(512, 512, dtype=torch.float16, device=f"cuda:{target}")
(a @ a).sum().item()
torch.cuda.synchronize()
print("GPU compute: OK")
try:
import exllamav3_ext
print("exllamav3_ext: OK")
- print("exl3_gemv_supported(0):", exllamav3_ext.exl3_gemv_supported(0),
- "<- False on gfx1151 => reconstruct+hgemm fallback (expected)")
+ print(f"exl3_gemv_supported({target}):", exllamav3_ext.exl3_gemv_supported(target))
except ImportError as e:
print("exllamav3_ext: NOT BUILT --", e)
import exllamav3
diff --git a/tools/strix_halo/gemv_perf_ab.py b/tools/strix_halo/gemv_perf_ab.py
index 9171a4f..020508b 100644
--- a/tools/strix_halo/gemv_perf_ab.py
+++ b/tools/strix_halo/gemv_perf_ab.py
@@ -64,8 +64,11 @@ launch as well as per config, so no first-launch-time decision can see an
inherited value.
Example:
- HIP_VISIBLE_DEVICES=1 python tools/strix_halo/gemv_perf_ab.py \
+ python tools/strix_halo/gemv_perf_ab.py \
-m <model> --mode both --census --top 40 --sweep --verify --repeats 6
+
+Select the GPU with HIP_VISIBLE_DEVICES=<index> if several are visible; pick the
+index whose gcnArchName matches. Enumeration order is a driver/boot property.
"""
import argparse
import contextlib