Skip to content

Merge upstream main - #87

Merged
plotarmordev merged 300 commits into
mainfrom
feat/133-merge-upstream-main
Nov 20, 2026
Merged

plotarmordev merged 300 commits into
mainfrom
feat/133-merge-upstream-main

Conversation

@plotarmordev

Copy link
Copy Markdown
Owner

ashhart and others added 30 commits November 19, 2026 13:33
Save model-aware agent choices, snapshot them before startup, and carry them through Room turns, compaction, ticket workers and delegated child runs. Keep inherited defaults and active-worker composer labels accurate. Split the affected Room modules to satisfy the source-size gate and cover actual HTTP requests, lifecycle boundaries and protected-store reloads. Refs ashhart#3328.
Keep worker effort consistent with the Room session even when saved configuration changes during startup. Reuse the typed worker launch contract, extend the real launch regressions, and retain startup guards after the host split. Refs ashhart#3328.
Reads Inkling 2 Small's config.json into the shapes the engine needs and
refuses by key every layout it does not run: the layer types, the fixed
switches, the quantization, the draft head and the vision tower. Fixtures
are the release's config.json and the tiny-random checkpoint's. The host
step is test-inkling2-host.
Reads a safetensors header into entries of name, dtype and shape, sorted
by name, for the dtypes this family stores: BF16, F32, F8_E4M3 and U8. A
dtype it does not store, a rank past four, a length past the file and bad
JSON are each refused.
The map names every tensor a config implies, backbone, vision tower and
draft head, with its dtype and shape, and checks a safetensors header
against it: missing, wrong and unknown tensors are reported by name. A
layer's expert format is read from its tensors, U8 for NVFP4 and F8 for
MXFP8. The plan derives sliding and global layers, the block boundaries
and the number of states each attention-residual input sums over.

The draft head's rnn_proj sizes and fuse_weight's columns are read from
two headers, tiny-random/inkling-2 and the release, not from code;
fuse_weight's six rows stay open. The fixtures fold the two header tables
of tiny-random/inkling-2 with their sha256. Real headers are checked when
TF_INKLING2_TINY names tiny-random's two files, and when TF_INKLING2_REAL
names the release's 24 shard headers and mtp.safetensors.
Image parts (image, input_image, image_url) and --vision are refused with
their own words until the vision tower has kernels; audio and unknown part
types are refused too, and text parts, plain strings and string parts
pass. A part without a type is read as text, as the chat template reads
it. Nothing calls these checks yet: there is no host.
The release's chat template renders 24 chat cases byte for byte, thinking
effort names and numbers included, and raises for an unknown effort or one
out of range. The tokenizer encodes the rendered prompts and 6 plain
texts to the reference's ids and decodes them back when TF_INKLING2_CKPT
names the release's tokenizer.json. A cut tokenizer.json (its added
tokens, its byte alphabet and the first 1,500 merges, same split regex)
runs on every build against 14 cases, with a control that another split
regex changes its ids. The expected prompts and ids come from the
transformers and tokenizers libraries.
inkling2_fixtures.py writes the files under zig/src/families/inkling2/
fixtures from the release's files and the tiny-random checkpoint's
safetensors headers: the prompt and id cases through transformers, the
cut tokenizer and its cases through tokenizers, and the folded tensor
tables with their sha256. The library versions are pinned and checked;
--check compares the committed files without writing.
The notice for the files taken from the Inkling 2 Small release and from
the tiny-random checkpoint.
refusal.zig and its test have no caller: the server that would call them
is not in this slice. They move to the slice that adds the host. The step
description and the package's test list no longer name them.
The AutoTokenizer.from_pretrained call in inkling2_fixtures.py takes
local_files_only=True, so a mistyped --release fails instead of
reaching the hub.
names.check and names.precisions take core/safetensors.zig's Header, read
with its headerSize and parseHeader, in place of the family's own parser
and dtype enum. header.zig and its test are gone, and the host test module
imports the core reader. names.merge joins the headers of a checkpoint's
files and refuses a name held twice.
…he K loop

Each thread's input, weight and scale/bias cp.async addresses are set up once; a stage only adds its group offset.
The copies, their order and their shared-memory bytes are unchanged, so outputs stay bit-equal to prefill_kernel.

Co-authored-by: terrapinelf <166810331+terrapinelf@users.noreply.github.com>
C4 of ashhart#2444: a store that declares tails cuts at any row its request
schedule allows, and a keep off a page edge holds one copy of the
partial page per prefix group, made by copy_rows and never written
again; a later prompt that repeats those rows, their lookahead,
images and namespace resumes there and copies the page into its own.
Tails count in the page limits, reclaim and eviction like parts, and
a store without them keeps every mark, hit and eviction of P2.2.
A resume at a tail takes its private page from the stream's promise,
trims it back on failure, and leaves the store's copy unwritten; an
idle tail is reclaimed before a page a stream still maps, so the
pool's census stays exact across the tail's whole life.
Shoestring-dev and others added 26 commits November 19, 2026 22:33
….zig beside the other zig/tests/lighton_hip steps

hip.zig was at the 600-line cap with the exl3 group, and main's flashnext
draftBatch line takes a merge to 601. captureQwen and exactTool move
unchanged (pub, with hip.zig's Engine); their four call sites name the
file. hip.zig is 581 lines, lighton_hip.zig 38. zig build -l -Dhip=true
lists the same steps before and after.
After a chat reply the server prefills the next turn's shared prompt in the
background. It built its copy of the reply from role, content and tool calls
only, so with thinking on it left out the reasoning the client was sent. Agent
clients such as omp send that reasoning back, and the checkpoint's template
renders it, so the guess differed from the real next request at the reply's
first reasoning token every time: the request then waited for the background
pass and redid it from before the reply.

warm.reply now takes the reply's reasoning and puts it into its own copy of
the reply when the client sends reasoning back (warm.echoesReasoning: the
latest assistant message has reasoning_content, or there is none). A client
whose history has no reasoning gets the old guess. The copy handed to
cortheon's remember is unchanged.

warm_reasoning_test.zig: the first-turn guess carries the reasoning, an
echoing client keeps getting it, a dropping client does not; it fails without
the fix. test-server-cpu and test-golden pass; lean 0 new.

Served on an M5 Ultra (Qwen3.8-Flash-Next, an omp tool loop): the next two
requests resumed at 7,868 and 7,947, the background passes' ends, and
prefilled only the new tool results (17 and 22 tokens), where before they
restarted at 7,653, before the reply. Earlier in a real omp session requests
had waited 40.8 s in total behind background passes they then redid.
echoesReasoning assumed a client echoes reasoning when its history has no
assistant message yet. Our web and desktop clients drop reasoning_content, and
Qwen3.8 renders an empty think block for them, so their first follow-up missed
the background pass at its first token. Return false for that case and pin it
in warm_reasoning_test.zig; later turns still follow what the history shows.
OpenAI's retrieve-model route answered "unknown path" here. GET
/v1/models/{id} and /models/{id} now return the entry /v1/models lists for
the served name or an --alias, built by the same code, so its capabilities
and every other key match the listing byte for byte. The id is
percent-decoded once, so org/name works raw or as org%2Fname; an id holding
a % that escapes no hex pair is matched as written. Any other id answers 404
with invalid_request_error, param "model", code model_not_found and the
decoded id in the message.

A path ending in /models still lists every model, as the suffix rule did.
Keys are required when keys are on, and inference and read scopes grant the
route by GET only, while a scoped key still cannot reach the listing's
suffix aliases. Host tests and golden cases added, docs/api.md updated.
…d-built copy

GLM's CUDA sampler redeclared sample.cu's Rule and filled it by hand (near 20.0 literal), as MiniMax M3
did before ashhart#2680. It now takes cuda.sample.Rule and cuda.sample.rule, which reach the core rule through
lanes.Sampling.gpuRule. Byte-equal: a host test checks the old hand-built rule against rule and ruleFor
over a 4,500-setting grid; the greedy gate (check) is ruleFor's.
The default pass held 1,536 rows while another stream decoded, so a long prompt ran in
passes of 1,536 and each lane admitted 1,536 rows a pass. It holds 3,072 now: a long prompt
takes about half the passes, and each one holds twice the rows.

A row's bits do not depend on how many rows a pass holds. splitK reads the weight's shape
alone, planSlices gives both sizes the fused plan with one K-slice order because the fused
floor is 256 rows, and every other prompt kernel computes a row from its own inputs and its
absolute position. The change moves launch grouping and the pass's device scratch, not the
arithmetic.

The scratch at the default grows with the rows, so the test that bounded it at two gigabytes
bounds it at three and names the default it prices. The startup line's default pass and the
serving pin file follow, and a server started at one stream keeps its 8,192-row passes, so
only a server with more than one stream changes.
…tests and docs

The empty-setting test expected 1536 and the environment table, its help and the recipe still named it as the default.
The test now expects default_chunk for an empty setting and keeps an explicit 1536 case.
…ream-main

# Conflicts:
#	zig/build/cuda.zig
#	zig/src/cli/hub.zig
Reject unqualified SM110 serving modes before paging, sharing or weight
loading while retaining the BF16 KV and DFlash2 path. Add focused startup
refusal tests and document the development target.

Refs ashhart#2319
@plotarmordev
plotarmordev merged commit 0ea3fd4 into main Nov 20, 2026
@plotarmordev
plotarmordev deleted the feat/133-merge-upstream-main branch November 20, 2026 00:07
plotarmordev added a commit that referenced this pull request Nov 24, 2026
…es; its reason is 83bc871 via #87; 1 KiB subtraction is cubin parsing only
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

App: Tensorfold Desktop - Benchmark fails