[PR #4960] [Engine] Metal batch slots: the slot window beats the serve watchdog #5265

Open
opened 2026-11-07 16:33:55 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Niko1221/Strata/pull/4960
Author: @oceanio
Created: 11/1/2026
Status: 🔄 Open

Base: main ← Head: fix/metal-slot-watchdog


📝 Commits (1)

  • c47b80b metal: a batch slot window beats the serve watchdog, as on CUDA

📊 Changes

1 file changed (+2 additions, -0 deletions)

View changed files

📝 src/core/verify.cpp (+2 -0)

📄 Description

Problem and result

With "parallel": 2 on the Mac engine (0.2.9 and 0.2.10), two requests that decode side by side in the batch slots for more than 60 s are stopped by the serve watchdog. Both requests end with an error, and the log says:

strata serve: no progress for 60 s during a request (idle -1) - stopping the engine so the server starts it again (issue #29)
strata serve: stall report (engine 0.1.56-metal): stage "idle -1" for 61 s; 0 layers served since the last finished step (0 = stopped, more = slow)

On an M5 Max with Swift 1.5 IQ3_S at 262K context, two long requests ("count from 1 to 5000 in words", up to 7,000 tokens, the second 1 s after the first) both ended in an error after 70-71 s, in two runs on 0.2.10 (and two on 0.2.9).

The cause: the Metal branch of Verifier::run_slot_rows returns without progress_beat(), while CUDA's branch ends with progress_at("decode") and progress_beat(). batch_step holds busy for each window, so while the slots decode and no request is being read (no prompt chunks, no admissions), nothing beats. A request alone is not affected: serve moves a request left alone in a slot back to the solo path, which beats.

With this PR the same two requests decode side by side to their 7,000-token limit in 134-140 s, in two runs, and the engine keeps serving.

None. Found while testing the fix for #4908 (#4961).

Approach

Two lines in src/core/verify.cpp, inside #if defined(STRATA_GPU_METAL): the Metal branch of run_slot_rows ends like CUDA's, with progress_at("decode") and then progress_beat(). unifdef -USTRATA_GPU_METAL src/core/verify.cpp gives the same file as 0.2.10's.

Validation

Environment: Apple M5 Max (128 GB), macOS 26.7.1. Revision: this branch, c47b80bf = 0.2.10 (ffa80d73) + 1 commit, engine 0.1.56-metal. Rebased from 0.2.9 with one conflict: 0.2.10's per-slot sampling block now sits just above the two lines, which follow it. Model: Swift 1.5 IQ3_S (SC117's abliterated build), repacked by setup, --max-context 262144 --spec 2 with MTP, "parallel": 2, no pictures. Requests go through this tree's serve/server.py on a private port, greedy: the two long requests above.

Passed:

  • Metal build: 0 errors, the same 16 warnings as 0.2.10.
  • unifdef -USTRATA_GPU_METAL src/core/verify.cpp: identical to 0.2.10's.
  • The two long requests above, side by side: both end at their 7,000-token limit (length) after 140 s, and again after 134 s. Each time the engine stays the same process, and the log has no no progress line. Without this commit the same requests ended in an error after 71 s on 0.2.10 itself and after 70 s on 0.2.10 plus #4961 (which changes nothing without --vision).
  • Before the rebase, on 0.2.9 (717ab9aa): 164 s and 154 s with this commit; 70 s, twice, without it.

Failed:
none observed

Not run:

  • CUDA, HIP and SYCL builds: the two lines are inside the Metal branch, and the unifdef check above is my evidence that other builds compile the same code.
  • More than 2 slots, other Macs.

Limits

None known.

🤖 Generated with Claude Code


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/Niko1221/Strata/pull/4960 **Author:** [@oceanio](https://github.com/oceanio) **Created:** 11/1/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `fix/metal-slot-watchdog` --- ### 📝 Commits (1) - [`c47b80b`](https://github.com/Niko1221/Strata/commit/c47b80bf59516e70ee7d95302c230f4e166b02bd) metal: a batch slot window beats the serve watchdog, as on CUDA ### 📊 Changes **1 file changed** (+2 additions, -0 deletions) <details> <summary>View changed files</summary> 📝 `src/core/verify.cpp` (+2 -0) </details> ### 📄 Description ## Problem and result With `"parallel": 2` on the Mac engine (0.2.9 and 0.2.10), two requests that decode side by side in the batch slots for more than 60 s are stopped by the serve watchdog. Both requests end with an error, and the log says: ``` strata serve: no progress for 60 s during a request (idle -1) - stopping the engine so the server starts it again (issue #29) strata serve: stall report (engine 0.1.56-metal): stage "idle -1" for 61 s; 0 layers served since the last finished step (0 = stopped, more = slow) ``` On an M5 Max with Swift 1.5 IQ3_S at 262K context, two long requests ("count from 1 to 5000 in words", up to 7,000 tokens, the second 1 s after the first) both ended in an error after 70-71 s, in two runs on 0.2.10 (and two on 0.2.9). The cause: the Metal branch of `Verifier::run_slot_rows` returns without `progress_beat()`, while CUDA's branch ends with `progress_at("decode")` and `progress_beat()`. `batch_step` holds busy for each window, so while the slots decode and no request is being read (no prompt chunks, no admissions), nothing beats. A request alone is not affected: serve moves a request left alone in a slot back to the solo path, which beats. With this PR the same two requests decode side by side to their 7,000-token limit in 134-140 s, in two runs, and the engine keeps serving. ## Related discussion None. Found while testing the fix for #4908 (#4961). ## Approach Two lines in `src/core/verify.cpp`, inside `#if defined(STRATA_GPU_METAL)`: the Metal branch of `run_slot_rows` ends like CUDA's, with `progress_at("decode")` and then `progress_beat()`. `unifdef -USTRATA_GPU_METAL src/core/verify.cpp` gives the same file as 0.2.10's. ## Validation Environment: Apple M5 Max (128 GB), macOS 26.7.1. Revision: this branch, `c47b80bf` = 0.2.10 (`ffa80d73`) + 1 commit, engine 0.1.56-metal. Rebased from 0.2.9 with one conflict: 0.2.10's per-slot sampling block now sits just above the two lines, which follow it. Model: Swift 1.5 IQ3_S (SC117's abliterated build), repacked by setup, `--max-context 262144 --spec 2` with MTP, `"parallel": 2`, no pictures. Requests go through this tree's `serve/server.py` on a private port, greedy: the two long requests above. **Passed:** - Metal build: 0 errors, the same 16 warnings as 0.2.10. - `unifdef -USTRATA_GPU_METAL src/core/verify.cpp`: identical to 0.2.10's. - The two long requests above, side by side: both end at their 7,000-token limit (`length`) after 140 s, and again after 134 s. Each time the engine stays the same process, and the log has no `no progress` line. Without this commit the same requests ended in an error after 71 s on 0.2.10 itself and after 70 s on 0.2.10 plus #4961 (which changes nothing without `--vision`). - Before the rebase, on 0.2.9 (`717ab9aa`): 164 s and 154 s with this commit; 70 s, twice, without it. **Failed:** none observed **Not run:** - CUDA, HIP and SYCL builds: the two lines are inside the Metal branch, and the unifdef check above is my evidence that other builds compile the same code. - More than 2 slots, other Macs. ## Limits None known. 🤖 Generated with [Claude Code](https://claude.com/claude-code) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Niko1221/Strata#5265
No description provided.