mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-03 19:03:30 +07:00
[PR #2485] [CLOSED] sycl: pin the RAM-resident expert copy in 2 GiB chunks when one pinned allocation is refused (Arc A770; prompt DMA for every expert, host staging 3.3 s -> 0.16 s) #4068
Labels
No labels
needs-format
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Niko1221/Strata#4068
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/Niko1221/Strata/pull/2485
Author: @aslater3
Created: 10/14/2026
Status: ❌ Closed
Base:
main← Head:a770/up-resident-chunked📝 Commits (1)
a51fc1esycl: pin the RAM-resident expert copy in 2 GiB chunks when one pinned allocation of it is refused (Arc A770)📊 Changes
2 files changed (+63 additions, -6 deletions)
View changed files
📝
sycl/include/strata/core/expert_source.hpp(+8 -0)📝
sycl/src/core/expert_source.cpp(+55 -6)📄 Description
Title
Issue: #1545, #1606 (Arc A770)
Summary
With
--resident-experts, the RAM copy of the experts the VRAM cache does not hold is requested as one pinned host allocation. On an Arc A770 (DG2,xe) every single pinned allocation of 4 GiB or more is refused, even withUR_L0_ENABLE_RELAXED_ALLOCATION_LIMITS=1, while 2 GiB pieces are not. So the 11-18 GiB copy fell back tomalloc+mlock. The CUDA engine registers that fallback (cudaHostRegister); the SYCL port could not (DPCT1027), so the GPU's copies from it ran at the pageable rate and the prompt path streamed every expert through the host stager instead of DMA.This pins the copy in 2 GiB chunks when the single allocation is refused, as
GgufExpertSource::mirroralready does for the--stream-expertsmirror: the blobs are laid out so none crosses a 2 GiB boundary andcomplement_at()maps an offset to its chunk. Cards whose single pinned allocation succeeds take exactly today's path.What changed
sycl/src/core/expert_source.cpp(FileExpertSource::pin_cache_complement): after the singlemalloc_hostis refused, re-lay the offsets and allocateceil(bytes / 2 GiB)pinned chunks; on any refusal, free them and keep the pageable fallback.resident_blob,device_alias, the copy-in loop and the adaptive tier's writes go throughcomplement_at(). The exchange-buffer rotation (one contiguous arena) is not offered with chunks.close()frees the chunks.sycl/include/strata/core/expert_source.hpp:complement_chunks_,complement_at().STRATA_RESIDENT_CHUNKED=0keeps the pageable fallback.How it was checked
Arc A770 16 GB,
xe, Linux 7.0, oneAPI 2026.1 (JIT), Ryzen 7 3800X, 30 GB RAM. Coder IQ1_M,--resident-experts --expert-cache auto --max-context 131072 --kv int8 --kv-resident 20480 --spec 4 --mtp,STRATA_VERIFY_STEPPED=1,UR_L0_ENABLE_RELAXED_ALLOCATION_LIMITS=1, an 18 GiB resident copy, same day, with vs without (STRATA_RESIDENT_CHUNKED=0):Output ids identical in every pair (8K
72b762d5b2a3, 32Keb3432fea981). The end-to-end gain is small because on this card the prompt is GPU-bound (the expert GEMMs), but the stager's ~3 s of host copying per 8K prompt and most of the tier's copy time are gone. This branch alone (a0116b27-eramain= v0.1.44.1): 678.2 tok/s at 8K, all 9,352 by DMA, same ids.The probe for the allocation limit:
pinned_probein the A770 report (#2216) / our fork'ssycl/probe/a770/(onemalloc_hostof 4.00 GiB fails, 7 x 2 GiB succeed, 17.3 GB/s from pinned against 4.2 GB/s from pageable).Not tested: i915 (the A750's arena path does not use this function's pinned branch the same way), Battlemage (its single allocation succeeds, so this path does not run), Windows. CUDA/HIP: SYCL-only files.
🤖 Generated with Claude Code
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.