[PR #358] [CLOSED] DeepSeek on Windows: 1 ms timer resolution (decode 36-41 -> 68.5 tok/s here) #486

Closed
opened 2026-10-29 21:25:57 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/mw00/project-maya/pull/358
Author: @OscarSheng
Created: 10/21/2026
Status: ❌ Closed

Base: main ← Head: ds4-windows-timer


📝 Commits (1)

  • 1415b8d DeepSeek on Windows: 1 ms timer resolution

📊 Changes

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

View changed files

📝 src/ds4/ds4_main.cpp (+14 -0)

📄 Description

What it changes: timeBeginPeriod(1) when maya-ds4 starts, _WIN32 only. MAYA_DS4_TIMER_MS=0 leaves the
system's 15.6 ms tick; =N asks for N ms.

Why: serve_lane naps (sleep_for(20 us)) after 2 ms without a request, between tokens. On Windows that nap lasts a
timer tick, and the next token's first wait_seq waits it out (DS4_PROF: "waiting for the CPU lane" and attention
grow by the tick).

What it leaves alone: Linux / macOS builds (the code is under _WIN32); the lane's logic.

Measured (v1.1.21 + PR 1 and the other PRs below, --mmap-experts off, MAYA_DS4_STREAM=0, one process a config, two
rounds; decode = 1,500 tokens at temperature 1 after a 23-token prompt; every run reached 1,500):

decode, round 1 / 2
MAYA_DS4_TIMER_MS=0 (as before) 40.6 / 36.1 tok/s
default (1 ms) 68.6 / 68.5

Prompts: unchanged (8,517 tokens 1,850-1,894 against 1,876-1,902 tok/s). On v1.1.19 with the next PR off as well:
20.08 -> 30.52 tok/s (DS4_PROF: GPU a token 47.9 -> 30.7 ms, waiting for the CPU lane 25.7 -> 18.4 ms).

Same answers: a 3,000-token prompt + 48 greedy tokens gave the same token ids with this and the next PR on and both off.

Not measured: other Windows PCs. Possibly related: #316 (Windows decode slower in v1.1.18) - not checked.

🤖 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/mw00/project-maya/pull/358 **Author:** [@OscarSheng](https://github.com/OscarSheng) **Created:** 10/21/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `ds4-windows-timer` --- ### 📝 Commits (1) - [`1415b8d`](https://github.com/mw00/project-maya/commit/1415b8d303af8d221323fc6b13797a9b5d1dcbb0) DeepSeek on Windows: 1 ms timer resolution ### 📊 Changes **1 file changed** (+14 additions, -0 deletions) <details> <summary>View changed files</summary> 📝 `src/ds4/ds4_main.cpp` (+14 -0) </details> ### 📄 Description What it changes: `timeBeginPeriod(1)` when maya-ds4 starts, `_WIN32` only. `MAYA_DS4_TIMER_MS=0` leaves the system's 15.6 ms tick; `=N` asks for N ms. Why: `serve_lane` naps (`sleep_for(20 us)`) after 2 ms without a request, between tokens. On Windows that nap lasts a timer tick, and the next token's first `wait_seq` waits it out (`DS4_PROF`: "waiting for the CPU lane" and attention grow by the tick). What it leaves alone: Linux / macOS builds (the code is under `_WIN32`); the lane's logic. Measured (v1.1.21 + PR 1 and the other PRs below, `--mmap-experts off`, `MAYA_DS4_STREAM=0`, one process a config, two rounds; decode = 1,500 tokens at temperature 1 after a 23-token prompt; every run reached 1,500): | | decode, round 1 / 2 | |---|---:| | `MAYA_DS4_TIMER_MS=0` (as before) | 40.6 / 36.1 tok/s | | default (1 ms) | **68.6 / 68.5** | Prompts: unchanged (8,517 tokens 1,850-1,894 against 1,876-1,902 tok/s). On v1.1.19 with the next PR off as well: 20.08 -> 30.52 tok/s (`DS4_PROF`: GPU a token 47.9 -> 30.7 ms, waiting for the CPU lane 25.7 -> 18.4 ms). Same answers: a 3,000-token prompt + 48 greedy tokens gave the same token ids with this and the next PR on and both off. Not measured: other Windows PCs. Possibly related: #316 (Windows decode slower in v1.1.18) - not checked. 🤖 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>
bsakaguchi 2026-10-29 21:25:57 +07:00
Sign in to join this conversation.
No labels
pull-request
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
mw00/project-maya#486
No description provided.