Author SHA1 Message Date
lotherk 6afd3ff4d8 Build: PASCAL=1 for the experimental sm_61/sm_60 (GTX 10-series, P40) build
Compiles CMAKE_CUDA_ARCHITECTURES=61 and passes -DSTRATA_EXPERIMENTAL_SM60=ON,
with an early error when nvcc is 13+ (which dropped sm_60/sm_70). Default
build is unchanged.
2026-10-13 13:19:00 +01:00
3 changed files with 30 additions and 26 deletions

No files matched your search

+19 -1
View File
@@ -1,7 +1,24 @@
# UnbiasedStrata build. Needs CMake 3.24+, a C++20 compiler and the CUDA toolkit. Nothing is downloaded.
BUILD_DIR ?= build
# Pascal/Volta are a community, experimental build: `make build PASCAL=1` compiles sm_61 (GTX 10-series,
# Tesla P40; sm_60/P100 works too, override with CUDA_ARCHS=60) and turns on the engine's
# STRATA_EXPERIMENTAL_SM60 path (see README.md and src/core/device.cu). It needs a CUDA 12.x toolkit:
# CUDA 13 dropped sm_60/sm_70, so the check below fails early with the reason instead of inside nvcc.
PASCAL ?=
ifeq ($(PASCAL),1)
CUDA_ARCHS ?= 61
PASCAL_CMAKE_FLAGS := -DSTRATA_EXPERIMENTAL_SM60=ON
NVCC ?= $(shell command -v nvcc 2>/dev/null)
NVCC_MAJOR := $(shell $(NVCC) --version 2>/dev/null | sed -n 's/.*release \([0-9]*\).*/\1/p' | head -n1)
ifneq ($(NVCC_MAJOR),)
ifeq ($(shell [ $(NVCC_MAJOR) -ge 13 ] && echo yes),yes)
$(error PASCAL=1 needs a CUDA 12.x toolkit; nvcc $(NVCC_MAJOR) dropped sm_60/sm_70)
endif
endif
else
# RTX 30 (86), RTX 40 (89) and RTX 50 (120) in one binary. sm_120 needs CUDA 12.8+, and upstream recommends 13.0+.
CUDA_ARCHS ?= 86;89;120
endif
# capped: inside a container nproc reports the host's CPUs, not the container's quota
JOBS ?= $(shell n=$$(nproc 2>/dev/null || echo 4); [ $$n -gt 16 ] && n=16; echo $$n)
@@ -13,7 +30,8 @@ build:
@git -C third_party/llama.cpp apply --check --reverse ../../patches/llama.cpp-qwen3-coder-any-argument-order.patch 2>/dev/null || \
git -C third_party/llama.cpp apply ../../patches/llama.cpp-qwen3-coder-any-argument-order.patch
cmake -S . -B $(BUILD_DIR) -DCMAKE_BUILD_TYPE=Release -DSTRATA_ENABLE_CUDA=ON -DSTRATA_NATIVE_EXPERTS=ON \
-DSTRATA_PORTABLE=ON -DSTRATA_BUILD_TESTS=OFF "-DCMAKE_CUDA_ARCHITECTURES=$(CUDA_ARCHS)"
-DSTRATA_PORTABLE=ON -DSTRATA_BUILD_TESTS=OFF "-DCMAKE_CUDA_ARCHITECTURES=$(CUDA_ARCHS)" \
$(PASCAL_CMAKE_FLAGS)
cmake --build $(BUILD_DIR) -j $(JOBS) --target unbiased-strata
@echo "built: $(BUILD_DIR)/unbiased-strata"
+7 -2
View File
@@ -26,6 +26,12 @@ ssh host 'cd UnbiasedStrata && make build' # produces build/unbiased-strata
The tree is 6 MB plus the pinned llama.cpp submodule in `third_party/` (about 170 MB checked out). The
build fetches nothing. `make build JOBS=N` sets the job count; `CUDA_ARCHS` defaults to `86;89;120`.
Pascal is an experimental, community build: `make build PASCAL=1` compiles sm_61 (GTX 10-series, Tesla P40;
`CUDA_ARCHS=60` for P100) and turns on the engine's `STRATA_EXPERIMENTAL_SM60` path. It needs a CUDA 12.x
toolkit (CUDA 13 dropped sm_60/sm_70) and is outside the validated configuration above: no tensor cores, so
expect the portable FP32 attention path and much lower throughput, and a card under 24 GB leans on the expert
cache.
## Run
```
@@ -36,8 +42,7 @@ build fetches nothing. `make build JOBS=N` sets the job count; `CUDA_ARCHS` defa
| | |
| --- | --- |
| Endpoints | `POST /v1/chat/completions` (streaming or not), `GET /v1/models`, `GET /health`, on `127.0.0.1:8080` |
| Options | `--ctx N` (32768), `--threads N` (default: physical cores, or half the CPU quota in a container), `--host`, `--port`, `--mmproj PATH`, `--vision-tokens N` (1024), `--fit-max-tokens` / `--no-fit-max-tokens` (default: on); engine flags after `--` |
| Context | a request whose `max_tokens` would run past `--ctx` has it shortened to the room left; with `--no-fit-max-tokens` it is refused (400) instead |
| Options | `--ctx N` (32768), `--threads N` (default: physical cores, or half the CPU quota in a container), `--host`, `--port`, `--mmproj PATH`, `--vision-tokens N` (1024); engine flags after `--` |
| Sampling | greedy unless `temperature` > 0 |
| Reasoning | returned as `reasoning_content`; `"reasoning_effort": "none"` turns it off |
| Tools | OpenAI format (`tools`, `tool_calls`) |
+4 -23
View File
@@ -41,10 +41,6 @@ namespace {
const char* const kModelName = "qwen3.8-flash-next-iq3_xxs";
// The engine's serve loop refuses a request unless prompt + max_new + this margin fits --ctx
// (src/program/generate.cpp:6403): the last cells are the engine's own, not ours to hand out.
constexpr long long kEngineReserve = 8;
struct Options {
std::string model; // shard 1 of the GGUF
std::string pack; // the prepared pack directory
@@ -55,7 +51,6 @@ struct Options {
int port = 8080;
long long ctx = 32768;
int threads = 0; // CPU expert workers; 0 = the engine's default (every physical core)
bool fit_max_tokens = true; // shorten a request's max_tokens to the room left instead of refusing it
std::vector<std::string> extra; // after `--`: passed to the engine as they are
};
@@ -68,8 +63,6 @@ void usage() {
" --mmproj PATH enable image input using this vision encoder (CPU)\n"
" --vision-tokens N maximum tokens per image (default 1024)\n"
" --ctx N context length in tokens (default 32768)\n"
" --fit-max-tokens / --no-fit-max-tokens\n"
" shorten a request's max_tokens to the room left instead of refusing it (default: on)\n"
" --threads N CPU threads for the experts the GPU does not hold (default: every physical core,\n"
" or half the CPU quota inside a container that has one)\n"
" --host ADDR address to listen on (default 127.0.0.1)\n"
@@ -239,26 +232,16 @@ struct Server {
// (pi sends max_tokens 32768 on a 64K card) was refused on every prompt longer than ctx - max_tokens.
constexpr long long kEngineReserve = 8;
const long long n = (long long) p.ids.size();
const long long room = opt.ctx - n - kEngineReserve;
if (room < 1) {
err = "the prompt is " + std::to_string(n) + " tokens, which leaves no room to generate in the context of " +
if (n + 1 + kEngineReserve > opt.ctx) {
err = "the prompt is " + std::to_string(n) + " tokens, which does not fit the context of " +
std::to_string(opt.ctx);
return false;
}
long long max_new = room;
long long max_new = opt.ctx - n - kEngineReserve;
for (const char* key : {"max_completion_tokens", "max_tokens"})
if (body.contains(key) && body.at(key).is_number()) {
const long long want = body.at(key).get<long long>();
if (want >= 1) {
if (want <= room) max_new = want;
else if (opt.fit_max_tokens) max_new = room;
else {
err = "the request asks for " + std::to_string(want) + " tokens and the prompt is " +
std::to_string(n) + ", which does not fit the context of " + std::to_string(opt.ctx) +
" (--fit-max-tokens shortens the request to the room left)";
return false;
}
}
if (want >= 1) max_new = std::min(max_new, want);
break;
}
p.max_new = max_new;
@@ -591,8 +574,6 @@ bool parse_args(int argc, char** argv, Options& o) {
else if (a == "--host") o.host = next("--host");
else if (a == "--port") o.port = std::atoi(next("--port").c_str());
else if (a == "--ctx") o.ctx = std::atoll(next("--ctx").c_str());
else if (a == "--fit-max-tokens") o.fit_max_tokens = true;
else if (a == "--no-fit-max-tokens") o.fit_max_tokens = false;
else if (a == "--threads") o.threads = std::atoi(next("--threads").c_str());
else if (a == "--") {
for (++i; i < argc; ++i) {