Skip to content

armgit / janas

Public Imported from GitHub
0

37 tok/s from Qwen3-Next-80B (48 GB) on a 32 GB laptop, 24 without drafts vs 2.8 for llama.cpp; reading 62 vs 16 tok/s. Faster than llama.cpp on all 13 models compared in Q4_K_M. LLMs bigger than your RAM, pure C, CPU or GPU.

Release 2026-10-13 (6): a build without GPU support links again, and a glslang too old for the shaders gives one, saying why (issue #22); issue #21 was #17's

camauri94b72c96eb53
diff --git a/ChangeLog.md b/ChangeLog.md
index 5c3fa3c..df4fbb3 100644
--- a/ChangeLog.md
+++ b/ChangeLog.md
@@ -2,6 +2,13 @@
> Curated, user-facing summary of completed work, newest first.
+## [2026-10-13] - A build without the GPU, and a request that never ended
+
+- **A build without GPU support links again** (issue #22, reported by mashirotamigi): two of the GPU's functions had no stand-in in such a build, and without `glslangValidator` the link failed.
+- **A glslang too old for the shaders builds without the GPU, and says so**, where the build stopped at the first shader: the shaders need `GL_EXT_integer_dot_product`, which glslang knows from 15.2 on, and Ubuntu 24.04's is 15.1. `build.sh` tries `glslangValidator` on a probe first; the reason reaches the engine, which gives it when asked for the GPU. `INSTALL.md` says where to find a newer glslang on Ubuntu 24.04.
+- **Issue #21, a server request that never ended on an RTX 5060 Ti with the tuner on, was issue #17's**: on a discrete card the tuner tries the GPU for single tokens too, whose results never reached the CPU, and the model's reasoning, garbled, never closed; in a chat `max_tokens` caps the answer, not the reasoning, so the reply ran towards the end of the context. Reproduced here on the path a discrete card takes: with the code before the fix the request had not ended after 180 s, the server at 57 minutes of CPU; with it, the right answer in 7.5 s.
+
+
## [2026-10-13] - vkcheck: can this GPU run Janas-LLM?
- **`vkcheck` tells whether a GPU can run Janas-LLM's GPU backend, and why not**: every requirement with the driver's answer (Vulkan 1.3, buffer addresses, the integer dot product, the subgroup operations the shaders use, the size of a subgroup, host memory imported in place), the decision the engine would take, then three tests on the device: zero-copy, the int8 dot product (exact, and a rough rate that shows whether the driver emulates it) and the float operations that keep the GPU's results the CPU's to the bit. On the development laptop's Arc everything passes, the dot product at 1,711 billion multiply-adds a second. It is a single C file that builds where Janas does not build yet, macOS with MoltenVK included: the first step of the arm64 and Apple Silicon port proposed in issue #20.
diff --git a/INSTALL.md b/INSTALL.md
index 76ed829..cd6796f 100644
--- a/INSTALL.md
+++ b/INSTALL.md
@@ -22,7 +22,9 @@ sudo apt install libvulkan-dev glslang-tools vulkan-tools
On Fedora: `sudo dnf install gcc make` and, for the GPU, `vulkan-loader-devel glslang vulkan-tools`. On Arch: `sudo pacman -S base-devel` and `vulkan-headers vulkan-icd-loader glslang vulkan-tools`.
-The GPU also needs its Vulkan driver: Mesa (`mesa-vulkan-drivers` on Debian/Ubuntu) for Intel and AMD, the proprietary driver for NVIDIA. `vulkaninfo --summary` should list your GPU with Vulkan 1.3 or later. When the engine takes none, `janas-bench` and the model's description say why: a build without GPU support (`glslangValidator` was missing: install it and build again), no Vulkan loader, a GPU whose driver lacks something (named), or the GPU turned off.
+The shaders need glslang 15.2 or later (`glslangValidator --version`). Ubuntu 24.04's `glslang-tools` is 15.1, too old: the build then goes on without the GPU and says why. A newer one is the prebuilt release from <https://github.com/KhronosGroup/glslang/releases> (`glslang-16.6.0-linux-x86_64-release.tar.gz`, the one Janas's own packages are built with): unpack it and put its `bin/` first in the `PATH` before building.
+
+The GPU also needs its Vulkan driver: Mesa (`mesa-vulkan-drivers` on Debian/Ubuntu) for Intel and AMD, the proprietary driver for NVIDIA. `vulkaninfo --summary` should list your GPU with Vulkan 1.3 or later. When the engine takes none, `janas-bench` and the model's description say why: a build without GPU support (`glslangValidator` missing or older than 15.2: see above, and build again), no Vulkan loader, a GPU whose driver lacks something (named), or the GPU turned off.
Then, in the source directory:
diff --git a/README.md b/README.md
index a050221..13c747a 100644
--- a/README.md
+++ b/README.md
@@ -141,7 +141,7 @@ On Qwen3-Next-80B-A3B, whose file is larger than this laptop's 30 GB, llama.cpp
```sh
sudo apt install build-essential # Debian/Ubuntu
-sudo apt install libvulkan-dev glslang-tools vulkan-tools # optional, GPU
+sudo apt install libvulkan-dev glslang-tools vulkan-tools # optional, GPU (glslang 15.2 or later: INSTALL.md)
sudo pacman -S vulkan-headers glslang vulkan-tools # the same, Arch
./build.sh # everything into bin/x86_64-linux/
diff --git a/build.sh b/build.sh
index e18bd75..937a269 100755
--- a/build.sh
+++ b/build.sh
@@ -239,25 +239,46 @@ if [ "$OS" = windows ] && [ -d /usr/include/vulkan ] &&
VK_INC=(-I"$OBJ/vkinc")
CFLAGS+=("${VK_INC[@]}")
fi
-command -v glslangValidator >/dev/null 2>&1 ||
- GPU_MISSING="glslangValidator (glslang-tools, glslang)"
+GLSLANG=""
+if command -v glslangValidator >/dev/null 2>&1; then
+ # the shaders need GL_EXT_integer_dot_product, which glslang knows from
+ # 15.2 on (Ubuntu 24.04's 15.1 does not: issue #22)
+ printf '#version 450\n#extension GL_EXT_integer_dot_product : require\nlayout(local_size_x = 1) in;\nvoid main() {}\n' \
+ >"$SPV/probe.comp"
+ if glslangValidator -V --target-env vulkan1.3 "$SPV/probe.comp" \
+ -o "$SPV/probe.spv" >/dev/null 2>&1; then
+ GLSLANG=yes
+ else
+ GPU_MISSING="a glslangValidator new enough for the shaders (this one, $(glslangValidator --version 2>/dev/null | sed -n 's/^Glslang Version: [0-9]*://p'), lacks GL_EXT_integer_dot_product: 15.2 or later)"
+ fi
+ rm -f "$SPV/probe.comp" "$SPV/probe.spv"
+else
+ GPU_MISSING="glslangValidator (glslang-tools, glslang), 15.2 or later"
+fi
echo '#include <vulkan/vulkan.h>' | "$CC" "${VK_INC[@]}" -E -x c - >/dev/null 2>&1 ||
GPU_MISSING="${GPU_MISSING:+$GPU_MISSING and }the Vulkan headers (libvulkan-dev, vulkan-headers)"
-[ -z "$GPU_MISSING" ] ||
- echo "note: building without GPU support: $GPU_MISSING not found"
-if command -v glslangValidator >/dev/null 2>&1; then
+if [ -n "$GLSLANG" ]; then
for comp in src/*/shaders/*.comp; do
[ -f "$comp" ] || continue
name=$(basename "${comp%.comp}")
out="$SPV/$name.h"
if [ ! -f "$out" ] || [ "$comp" -nt "$out" ]; then
echo "SPV $comp"
- glslangValidator -V --target-env vulkan1.3 --vn "janas_spv_$name" \
- "$comp" -o "$out" >/dev/null
+ if ! glslangValidator -V --target-env vulkan1.3 \
+ --vn "janas_spv_$name" "$comp" -o "$out" >/dev/null; then
+ rm -f "$out"
+ GLSLANG=""
+ GPU_MISSING="${GPU_MISSING:+$GPU_MISSING and }a glslangValidator that compiles $comp"
+ break
+ fi
fi
done
- CFLAGS+=(-DJANAS_GPU_SPV -I"$SPV")
fi
+[ -z "$GPU_MISSING" ] ||
+ echo "note: building without GPU support: it needs $GPU_MISSING"
+# the reason, for the engine to give when asked for the GPU
+[ -z "$GPU_MISSING" ] || CFLAGS+=(-DJANAS_GPU_WHY="\"$GPU_MISSING\"")
+[ -z "$GLSLANG" ] || CFLAGS+=(-DJANAS_GPU_SPV -I"$SPV")
# Web pages of the programs (src/<tool>/*.html) as C arrays, so that the
# program carries them: janas_<tool>_<name>_html in <tool>_<name>_html.h.
diff --git a/src/llm/gpu.c b/src/llm/gpu.c
index 7294ad9..4f6d9e3 100644
--- a/src/llm/gpu.c
+++ b/src/llm/gpu.c
@@ -2397,7 +2397,10 @@ struct janas_gpu {
struct janas_gpu *janas_gpu_create(char *err, size_t err_len)
{
-#if !defined(JANAS_GPU_SPV)
+#if defined(JANAS_GPU_WHY)
+ snprintf(err, err_len, "built without GPU support: it needs %s",
+ JANAS_GPU_WHY);
+#elif !defined(JANAS_GPU_SPV)
snprintf(err, err_len,
"built without GPU support: glslangValidator was "
"not installed when Janas was built");
@@ -2415,6 +2418,18 @@ void janas_gpu_destroy(struct janas_gpu *g)
(void)g;
}
+/* no fast prompt without a GPU (issue #22: the link failed without them) */
+int janas_gpu_fast_prompt(void)
+{
+ return 0;
+}
+
+void janas_gpu_set_only_fast(struct janas_gpu *g, int on)
+{
+ (void)g;
+ (void)on;
+}
+
int janas_gpu_import(struct janas_gpu *g, const void *p, size_t bytes)
{
(void)g;
diff --git a/tests/test_maps_parse.c b/tests/test_maps_parse.c
index 79583df..feefbb5 100644
--- a/tests/test_maps_parse.c
+++ b/tests/test_maps_parse.c
@@ -68,6 +68,13 @@ int mp_fetch(const char *url, int keep_s, struct janas_buf *out, char *err,
(void)url, (void)keep_s, (void)out, (void)err, (void)err_len;
return -1;
}
+int mp_fetch_ms(const char *url, int keep_s, int timeout_ms,
+ struct janas_buf *out, char *err, size_t err_len)
+{
+ (void)url, (void)keep_s, (void)timeout_ms, (void)out, (void)err,
+ (void)err_len;
+ return -1;
+}
const char *mp_base(const char *env, const char *def)
{
(void)env;