Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
3 changes: 3 additions & 0 deletions app/serve.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -660,6 +660,9 @@ Launch launch_for(const Options& o, const std::string& device, int child_port) {
if (device != "rocm") throw std::runtime_error(o.model + " is Hadamard-rotated: it runs on --device rocm only");
if (!std::getenv("GGML_Q4_0_HADAMARD")) env.push_back("GGML_Q4_0_HADAMARD=1");
if (!std::getenv("GGML_W4A4_TENSORS")) env.push_back("GGML_W4A4_TENSORS=all");
// 1024-token micro-batches: prompt processing +3-8% over the default 512 (Qwen3-Coder-30B-A3B,
// pp2048 2,001 -> 2,158, pp16384 1,227 -> 1,283; 2048 is no better), decode unchanged
argv.insert(argv.end(), {"-ub", "1024"});
}
} else if (device == "vulkan" || device == "hrx") {
// --prefill-device hrx: the HRX build (it has both devices and the shared-KV split), flash
Expand Down
4 changes: 3 additions & 1 deletion docs/serve.md
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,9 @@ Qwen3-Coder-30B-A3B, 256 output tokens, effective tok/s (output tokens over the
| **`--long-model`** | **71.3** | 53.1 | 25.5 | 13.1 |

The `--long-model` row ran while another job used the box's memory bus, which cost its long
side 2-5% against the W4A4 row. Both files stay loaded (here 17 + 16 GiB). It needs the Vulkan
side 2-5% against the W4A4 row. A rotated file now runs 1024-token micro-batches (`-ub 1024`),
which raises the W4A4 prefill 6-10% (server-reported 2,217 / 1,742 / 1,295 tok/s at 2K / 8K /
16K, from 2,000 / 1,607 / 1,221): a 16K-token prompt's first token at 12.96 s instead of 13.89. Both files stay loaded (here 17 + 16 GiB). It needs the Vulkan
build and `ONEBIT_LEAN` + `ONEBIT_LEAN_ROCM`, and `-m` on a llama-server route (vulkan, hrx or
rocm); it does not combine with `--laya`, `--adaptive` or `--mmproj`.

Expand Down
3 changes: 2 additions & 1 deletion tests/hadamard_route.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
# onebit.hadamard_q4_0 = 32; docs/lean.md), without a GPU:
# - --device vulkan refuses it,
# - --device auto sends it to the ROCm route (--device ROCm0) with GGML_Q4_0_HADAMARD=1 and
# GGML_W4A4_TENSORS=all in the backend's environment,
# GGML_W4A4_TENSORS=all in the backend's environment and 1024-token micro-batches (-ub 1024),
# - an unstamped file with --device auto still goes to Vulkan with neither variable,
# - --dflash on a rotated file adds the DFlash drafter with full blocks (n-max 16, p-min 0):
# one ROCm server, W4A4 prompt processing and DFlash2 decode.
Expand Down Expand Up @@ -84,6 +84,7 @@ run "$scratch/h32.gguf" "$scratch/h32.json"
check "--device auto sends a rotated file to ROCm0" '[ "$(field "$scratch/h32.json" "r[\"argv\"][r[\"argv\"].index(\"--device\")+1]")" = ROCm0 ]'
check " with GGML_Q4_0_HADAMARD=1" '[ "$(field "$scratch/h32.json" "r[\"env\"].get(\"GGML_Q4_0_HADAMARD\")")" = 1 ]'
check " and GGML_W4A4_TENSORS=all" '[ "$(field "$scratch/h32.json" "r[\"env\"].get(\"GGML_W4A4_TENSORS\")")" = all ]'
check " with 1024-token micro-batches" '[ "$(field "$scratch/h32.json" "r[\"argv\"][r[\"argv\"].index(\"-ub\")+1]")" = 1024 ]'

run "$scratch/plain.gguf" "$scratch/plain.json"
check "an unstamped file still goes to Vulkan0" '[ "$(field "$scratch/plain.json" "r[\"argv\"][r[\"argv\"].index(\"--device\")+1]")" = Vulkan0 ]'
Expand Down
Loading