Repository navigation
diag: trace macOS guest EPERM - #3
Closed
devopsfortunato wants to merge 2777 commits into
Closed
devopsfortunato wants to merge 2777 commits into
devopsfortunato wants to merge 2777 commits into
Conversation
…d, /api/tags, /api/show, /api/ps, /api/version) over the native engine (ashhart#3117)
…, and the refused-field bodies are JSON Every test in ollama_e2e_test.zig hung until its 30 s poll timed out, then panicked in deinit. The cause is the fixture, not the routes: the fake engine sent prefilled and its three tokens but never `finished`. The engine API says every request ends with `finished` (core/engine_api.zig:37 and :420), and the server's generation loop (server/chat_generation.zig:216) ends a reply only when it arrives, so the reply, its socket and the open connection never ended. The other loopback fixtures (auth_scope_http_test.zig) send it. With that fixed, "format, tools and images are mapped or refused by name" failed on its own bodies: `format":"xml` and the other two fragments lacked their opening quote, so each request was refused as malformed JSON and the reply never named the field. They are now whole JSON fields, and each refusal is checked to name its field. test-ollama-e2e-host runs these loopback tests alone. No route or server code changes.
A stream that sends stream_options.tensorfold_token_stream_version: 1 interleaves tensorfold.token.chunk events (offset and committed IDs) with the usual chunks, and each chunk carries a tensorfold_stream anchor (token count, last ID, and each logprob entry's raw token position, shaped like the chunk's logprobs). Engine integrations such as exo's proposed TensorFold backend need the real IDs while generation runs, without retokenizing text that merges UTF-8 pieces, reasoning or tool syntax. capabilities --json advertises token_stream_versions [1]. Without the option the wire output is unchanged.
…ap body, and proves the cap without a race "GET body of 65537 bytes against the unread cap" failed on a hosted runner with "[Errno 107] Transport endpoint is not connected". The server refuses that request on its declared length (http_body.zig:79) and closes without reading the body, so the unread bytes reset the connection; on a busy runner the reset can reach the client while it is still sending or shutting down its side, before it reads the 400. - exchange() can treat a reset, a closed pipe or a no-longer-connected socket as the server closing first. Only the over-cap case asks for that; every other case still fails on it. - When the server closed first, whatever arrived must not be a 2xx reply, and a complete reply must be the expected 400. - A new case sends only the head declaring 65,537 bytes. Nothing is left unread, so the server closes cleanly and its 400 always arrives: the cap is proved on every run, with no race.
…o a run never executes a file mid-write A hosted runner failed with "failed to spawn and capture stdio from ./zig-out/bin/check-release-paths: FileBusy" (ETXTBSY). Zig 0.17's run step executes an artifact's installed copy whenever the same build installs it (lib/compiler/Maker/Step/Run.zig:388, `installed_path orelse` the cache path), without waiting for the install. compile-release-paths-host installed the same checker that the release directory and command tests run, so a build doing both, such as test-host, could start a run while the install was still writing zig-out/bin/check-release-paths. compile-release-paths-host now installs a compile of its own; the tests' checker is never installed, so every run starts the finished file in the cache. Both compiles share one cache entry, so nothing builds twice. Traced with strace in one build of compile-release-paths-host, test-release-directory-host and test-release-paths-command-host: on main 17 of 18 runs executed ./zig-out/bin/check-release-paths; now all 18 run from the cache.
…quests, not 150 "sessions writes: on real files the tier writes and reads back exactly what the bench accounts" timed out at its 20-minute limit on a loaded hosted runner. Its time goes to disk: two runs of 150 mixed requests on real files wrote 576 MiB and read back 382 MiB with O_DIRECT, behind 237 fdatasync calls, one a parked file. The test now runs 40 requests with every token size halved (pool, slot capacity, prompts, turns, replies and the conversation cap) and a 512 KiB chunk. That still spills, parks, drops, reads back and, with SKIP_COVERED, writes deltas and drops covered entries; it now also asserts the plain drops, the covered drops, and that files average over one chunk, so a restore still reads across chunks. Real files and the accounted tier must still agree on every count and on peak use. On this box: 46.6 MiB written, 21.4 MiB read, 46 fdatasync calls; the run takes 0.6 s instead of 5 s. No change to the code under test.
Folds ashhart#3306 (its three corrections and the unnumbered duplicate it removes) and the lines checked since.
… whole-buffer download On the 1.2.9 release commit, one sampled stream of Flash Next (MLX 4-bit checkpoint, chat, temperature 1.0) decoded about 10% slower than 1.2.8 on a GB10: 48.7, 46.1 and 48.8 tok/s against 43.9, 44.3 and 42.2, alternating runs; the other sweep cells were level or faster. ashhart#2927's group path runs a top-k launch and a synchronous download of the whole batch buffer every draw step, which one stream cannot amortise. A lone stream now takes the per-stream draw it had before ashhart#2927; two or more streams keep the group draw. Tokens are unchanged either way: both paths draw the same rows, and the batch tests compare them.
baidu/Unlimited-OCR-2 at its released bf16 weights on M5-class GPUs: the publisher's preprocessing (bit-exact), the SAM and CLIP image encoder, the DASH MoE decoder with greedy generation, chunked prefill (bit-identical at any cut), serving through tensorfold-native --vision with the family's chat template, and every kernel under the contract. The SAM encoder, the decoder's attention, its page2d rotary and its MoE gate are written from the papers and from the release's modules measured through their inputs and outputs. tf-uocr-blocks gates each encoder step alone against float32, tf-uocr-vision and tf-uocr-decode gate a page's stages, and tools/zig/uocr_reference.py makes their cases from the release's own code. Fed torch bf16's reply, tf-uocr-decode accepts a departure only as a tie: the same two contenders on both sides, each margin within one bf16 step (the reference records every step's two highest logits); --reply-reported reports them instead. The server's built-in templates share one helper (hf_text_parse.zig): Nemotron Parse's replaces the checkpoint's, this family's fills in when the checkpoint ships none, and a --chat-template wins over both.
Under slots_only without --prompt-cache-gib, plan sets aside the slots that fit past the engine's own window and each other stream's fixed part and page, TF_KV_SHARE at most, before windows and held count the rest. The rest of the default cache still becomes pages after the windows. Plans that already kept all n are unchanged, so is every plan without slots_only or with an asked cache. GLM's advice under 4 states a stream names TF_KV_SHARE alone where its slots now fit, and --prompt-cache-gib only beside a named cache too small for them.
A row said which products its entry takes by rows, items and pairs, and nothing about the weights' width. Timings on gfx1151 show a choice that turns with it: of the two K-parallel tiles a plain prompt of 1 row can run on, one is ahead on 2-bit and 3-bit codes and the other from 4-bit up. `max_bits` is the most bits a weight code holds for the row to take a product (0, the default: any). The registry's cost check refuses wider codes for plain products and plans alike. A bound that does not parse refuses its row instead of being ignored: - a bound that is no code width (2, 3, 4, 5, 6 or 8) stops the build of the table that writes it, naming the entry and the bound, where 7 or 9 would have read as "up to 6" or "any"; a row made by hand with such a bound takes no product. The registry and the kernel cases read the widths from one list, beside the row type; - `tuning.build` copies an entry's fields by name and dropped the ones the row type lacks, so a misspelled bound left its row taking every product. Such a field now stops the build, naming the entry and the field. Every field the four tables carry is the row type's. `hip-affine-tune` prints the bound with a row it proposes. No table sets the bound yet, so no choice changes. Refs ashhart#2923
…-parallel tile A plain prompt product of 1 or 2 rows ran on `kp0` (8 columns a lane set, 1 row a pass) on every card. On gfx1151 `kp3` (4 columns, 2 rows a pass) is ahead at 2 rows at every width, and at 1 row from 4-bit codes up; at 1 row of 2-bit or 3-bit codes `kp0` stays ahead. A resumed prompt ends in such a piece whenever 1 or 2 tokens follow the kept state. gfx1151's table now gives `kp0` one row of codes of at most 3 bits and `kp3` the other plain products of up to 2 rows. Costs stay as they were, so `kp0` keeps the products its row still takes and no row is shadowed. Nothing else is chosen differently: products of 3 rows and more, routed plans, decode and the other three tables keep their tiles. Both tiles are one template and write the 128-row tile's bytes. Tests: - launches: at every width gfx1151 picks `kp3` at 2 rows and, at 1 row, `kp0` for 2-bit and 3-bit codes and `kp3` from 4-bit up, with the matrix cores on or off; it keeps `kp1` and `kp2` past 2 rows and the reference tile with the dot2 GEMM tiles off; gfx1030, gfx1100 and gfx1201 still pick `kp0`. - tuning: gfx1151's bound is set, so a table that lost it fails. - kernel suite: `kp0`, `kp3` and the 128-row dot2 tile, launched by id whatever the card's table picks, write the same bytes at 1 and 2 rows, every width and group, fp32 and rounded into out16; an output left unwritten fails too. Refs ashhart#2923
…ayers before them run A prompt chunk with nothing staged used to read both Engram layers' rows on the host before its command buffer started. It now writes the ids, starts every Engram layer's reads, commits the layers before the first Engram layer, reads that layer's rows while they run, and so on: the chunk becomes up to three command buffers on one queue, each committed once the rows it reads are written. Chunks filled ahead keep one.
…reports a failure Review (D894): Chunk.wait returned at the first failed buffer while later ones could still run when the caller reused the input set or freed its buffers.
The prompt scratch and buffers, each slot's KV regions, tail and taps, the forward buffers, the layer scratch and the RoPE tables were in no residency set, so macOS could unmap them between command buffers and map them again when the next one was submitted. Target.init now holds them in one residency set on the engine's queue (requested resident at once), and deinit removes it before the buffers go.
A checkpoint may store layers.45.shared_head.head (a lighter copy of lm_head, e.g. 4-bit beside an 8-bit backbone). On one Mac the loader loads it beside lm_head and the MTP drafts project through it; lm_head still produces every verified token, so replies are unchanged. Without the tensor nothing changes. 8-bit GLM-5.3-Flash with the 4-bit MTP layer and head, 6 bench prompts: 12/12 replies equal to the 8-bit alone; greedy 53.0 -> 53.2-53.5 tok/s, sampled 48.4 -> 50.1-50.3, 3.5 GB less memory.
…pt path GLM_PROMPT_NLL=ROWS reads each prompt in chunks of ROWS through the prompt kernels a reply's prompt runs, runs the head over every chunk row and scores row i on token i + 1 (checks.promptNll). GLM_PROMPT_NLL_OUT=PREFIX writes the per-token losses (f32) for paired comparisons; GLM_PROMPT_NLL_ONLY stops before the replies. A dev-tool per-token loss check, for comparing builds whose weights differ; over 99,999 tokens on the 8-bit GLM its standard error was 0.067%.
…s re-pointed commit Eight are for PRs that haven't landed (ashhart#3457, ashhart#3560, ashhart#2979, ashhart#3588, ashhart#2824, ashhart#3233, ashhart#2000, ashhart#3038); they return when those PRs land. The ninth repeated ashhart#2878's line, which is already in its release.
…nd 1, each code unpacked once
… M1-M4 keep main's 4, 2 and 1 On an M3 Ultra, decode at a 16,384-token context was 3.5% slower with the 8-row step (28.4 to 27.4 tok/s, both new runs below both base runs); it was measured only on an M5 Ultra. Pipelines.load now records device.tensorUnits(), the chip fact the Qwen3.8-27B Metal code already reads (applegpu_g17 and later), and call and callStrided take the wide pipelines only when it is set. Without tensor units every row count keeps main's pipelines, so M1-M4 run main's kernels and steps exactly. A host test pins that dispatch for every width, both sums and 1 to 32 rows; the existing dispatch test now covers the tensor-unit side.
On Linux the Metal Pipeline is an inert stand-in without an id field, so the two tests that build pipelines by id failed to compile in test-gemma4-owners-host once that step reached this file. They now skip at comptime off macOS.
…fer is sized for it Prefill segments of 18 to 32 rows run the out-of-place mHC boundary program, which writes the second streams buffer (w.x1), but the plan only sized that role for 17 rows, so rows 17 and up wrote past the buffer and the decode came back with repeated begin-of-sentence tokens. Plan a program at block_prefill.split_rows too, skipping counts above the largest segment and the repeat when rows is split_rows. Add 18 and 32 to the full-mode row sizes in the index scratch test, which fails on main and passes with the fix. Fixes ashhart#3366
The lean check flags consecutive // lines as multi-line comments; the four-line note added three new problems. One line keeps the why without tripping the gate.
… replay (ashhart#3366) Every segment from 17 to 33 rows, at starts 0, 2,048 and 65,536, in full mode and in replay's encoder, must find the second streams buffer (w.x1) planned for its rows. On main 25de9d7 it fails at 18, 24 and 32 rows (w.x1 needs 737,280, 983,040 and 1,310,720 bytes against 696,320 planned) and passes with the 32-row program planned; 17 and 33 pass either way. The sweep is @laudney's test from ashhart#3529, widened to both edges and to replay. Co-authored-by: laudney <106273+laudney@users.noreply.github.com>
…oss streams (join kernels) With paged KV and the shared prompt store (TF_QWEN_KV_PAGES, TF_QWEN_KV_SHARE), streams resumed from one prompt hold the same physical prefix pages. tf_q35_attn_rows / rows8 took one stream's rows a pass, so eight such streams read every prefix key tile eight times. attn_rows gains a compile-time JOIN switch. JOIN false is main's kernel: all 43 existing kernels in qwen35 and qwen35_kv8 compile to byte-identical SASS on sm_80/86/89/120/121 (nvcc 13.0.88), so the default contiguous path and every forward without shared pages run main's code, and their records are unchanged. tf_q35_attn_rows_join and tf_q35_attn_rows8_join (JOIN true) let another stream's rows join a class when both hold the chunk's span below their length in the same page ids; each line's arithmetic is its own, so every stream keeps its solo bits. The host takes them only for a paged forward where two parts' caches start on one page (cuda_cache.anyShares), as the graph shape's join bit; the shape key is 64 bits. mt2 takes one segment, so it never joins. Tests: qwen-shared-prefix (new, in the CUDA contract run) checks every stream's PM, PL, PO and merge from the join kernels against main's kernel alone, bit for bit, at 2/4/8 streams x 1/4 rows, beside a 384-key-chunk stream and a contiguous one, with two planted controls (a changed copy of a shared page, a tree row past its length). Its time mode compares the two kernels on shared and distinct pages. Host: the join rule and the shape key's uniqueness with the join bit. Measured on a GB10, Qwen3.8-27B 4-bit with paged KV and the shared store, eight streams resumed from one prompt, replies identical in every arm (344 against main, drafts off and one stream): - rows kernel at a 35K shared prefix, main's -> join: 8 x 1 rows 4.00 -> 0.82 ms, 8 x 4 2.50 -> 1.21, 4 x 1 2.08 -> 0.69; on distinct pages the two are level (-0.19% to 0.00%). - served decode, tokens a second a stream while all decode (main -> join, two arms each): 32K x 8 6.41 -> 10.08 (+57%), drafted +60%; 32K x 4 +28%; 8K x 8 +4.9%, drafted +11%; one stream, 512-token prompts and 32K distinct prompts level (-0.3% to +0.8%, main's kernels). The join kernels' records for nvcc 13.3 and later compilers are pending receipts, like their neighbours'.
Owner
Author
|
Superseded by upstream PR ashhart#3698 head 5998b33 which now carries the trace-diagnostic test. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Temporary diagnostic run for PR ashhart#3698 macOS failure. No production files changed.