Skip to content

[stage CI] 345 at 153050e - #17

Closed
LeoBorcherding wants to merge 2 commits into
night-shift-tester/345-stage-basefrom
night-shift-tester/345-stage
Closed

LeoBorcherding wants to merge 2 commits into
night-shift-tester/345-stage-basefrom
night-shift-tester/345-stage

Conversation

@LeoBorcherding

Copy link
Copy Markdown
Owner

CI staging copy of unslothai#345 at 153050ec5 exactly (the author's branch head), based on its merge base with moe-offload-prefetch-cache, fd7489efb. Nothing is fixed here; review and fixes live on the mirror, #9.

…t's routing

With experts in host memory and the MoE cache, the last large ubatch of each
llama_decode call seeds the cache. When that ubatch had no earlier routing in
the prompt (the first server chunk, or a whole prompt in one chunk) it read its
own ids first, so its expert uploads ran on the compute stream after a
per-layer readback instead of ahead on the prefetch copy queue.

Keep the routing counts across prompts. A long seeding ubatch with no routing
of its own now copies all experts ahead like any other large ubatch and seeds
from the last prompt's routing. Later chunks of the same prompt still seed from
the prompt's own routing. A small ubatch with outputs (the server's last prompt
tokens) also reads the routing of the large ubatch before it, so the fallback
follows the last prompt. Short chunks keep the routed-only copy: they leave
many experts unrouted and have little compute to hide the copies under.
…cache

ggml_backend_cuda_copy_regions_async returned false on HIP, so the prefetch
copy of a large ubatch could only take long runs of cached experts from the
MoE cache and uploaded the rest from host memory again. With the cache seeded
from the last prompt that was every expert of every layer: 23.5 GB per
4.58k-token prompt on an R9700 at ub 8192, 16 GB of it already in VRAM.

On HIP the device copies now go through the copy-regions kernel and the
uploads are one hipMemcpyAsync each (there is no batched copy API), so a
cached expert is copied from the cache and only the misses are uploaded.
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.

1 participant