Repository navigation
Conversation
|
I added a second commit, With
Unset or 0, nothing changes. Same computation. Speed, same PC and settings as before,
The agent decode median is lower with the second commit than with the first alone; both vary widely across the 15 turns (15.5-53.4 and 11.3-67.2 tok/s), so I would not read much into it. With these two and #3086 together, the agent decode was 66.1 tok/s (the measurement in #3065). These runs were all on Windows with CUDA only. |
|
Thanks for the pull request. We're resetting the tracker for 0.2.0-beta. There are more than 1,300 open issues and pull requests, too many for us to review properly, so we're closing everything that isn't being worked on right now. Closed here does not mean rejected. To reopen it takes about two minutes:
The rules are in CONTRIBUTING.md. |
…ode without a RAM budget (Niko1221#3065) On a Windows PC whose RAM cannot hold the experts (--mmap-experts), the stager copies a chunk's experts out of the mapped experts.bin: millions of page faults, which on a 32 GB PC with a 35.5 GB experts.bin read the drive at only 0.2-0.5 GB/s and push the decode's cached experts out of RAM. STRATA_PROMPT_DIRECT=1 already reads the prompt path's blobs unbuffered on Linux, but only in the RAM-budget branch. - open_prompt_direct: a Windows branch (experts.bin opened a second time, FILE_FLAG_NO_BUFFERING | FILE_FLAG_OVERLAPPED); read_direct uses these handles when the file tier itself is not unbuffered - generate: on Windows the switch is honoured in the mmap mode without a RAM budget too - ExpertSource::prompt_reads() (Windows, experts.bin with those handles): the stager hands unpinned blobs to copy_blobs, 8 neighbours per request, without touching transient(), so the decode and the prompt CPU share are unchanged; Linux keeps its behaviour Opt-in; with STRATA_PROMPT_DIRECT unset nothing changes. The bytes read are the same, only where they come from.
…ough the file cache (STRATA_PREFILL_DIRECT_RAM, Niko1221#3065) With STRATA_PROMPT_DIRECT=1 in the Windows low-RAM mode every unpinned blob of a prompt chunk is read from the drive, also the ones the decode has just read and still holds mapped in. STRATA_PREFILL_DIRECT_RAM (Windows, only with prompt_reads): - >= 1: a blob whose pages are all in the process working set (QueryWorkingSetEx) is copied from the mapping - no fault, no drive read; the rest are read unbuffered as before - 2: the rest through a cached overlapped handle on experts.bin, which serves what the standby list still holds - 3: as 2, a run of neighbouring blobs of a layer is one read Opt-in; unset or 0, nothing changes. The bytes are the same, only where they come from.
…nds out the file's bytes, read unbuffered, copied from the working set or read through the file cache in merged runs (Niko1221#3065)
|
/reopen |
|
Reopened, thank you. A maintainer will pick it up from here. If it conflicts with main, rebase it first; that speeds up review. |
6268ac1 to
237d6cb
Compare
Problem and result
On a Windows PC whose RAM cannot hold the experts, the low-RAM mode (
--mmap-experts, no--resident-budget-gib) reads each prompt chunk's experts by copying them out of the mappedexperts.bin. Those copies are page faults. On this PC (RTX 5070 12 GB, 31.8 GiB RAM, a 35.5 GB IQ2_XSexperts.binon a drive of about 1.5 GB/s) the drive read only 0.2-0.5 GB/s during a long prompt, and the faulted pages push the decode's cached experts out of RAM.STRATA_PROMPT_DIRECT=1already reads the prompt path's blobs unbuffered, but only on Linux and only with a RAM budget.This PR, opt-in and Windows only:
STRATA_PROMPT_DIRECT=1also works on Windows and in the low-RAM mode without a budget: the stager's blobs are read with unbuffered, overlapped reads from a second handle onexperts.bin, while the decode keeps the mapping.STRATA_PREFILL_DIRECT_RAM(on that path only): a blob whose pages are already in the working set is copied from the mapping;=2reads the rest through a cached handle (what the standby list still holds),=3as 2 with neighbouring blobs of a layer merged into one read.With both unset nothing changes. On 0.2.3.1, same PC and settings,
tools/strata_bench.py, medians of 3:STRATA_PROMPT_DIRECT=1 STRATA_PREFILL_DIRECT_RAM=3Related discussion
#3065 has the problem, the measurements and the reproduction steps. There is no maintainer reply on scope yet; both switches are opt-in and no default changes. This PR was closed in the 0.2.0-beta reset; it is now rebased on
main(7ddc17a, v0.2.3.1) and re-tested there. It is independent of #3086; the two merge cleanly together.Approach
open_prompt_directgets a Windows branch: each expert file is opened again withFILE_FLAG_NO_BUFFERING | FILE_FLAG_OVERLAPPED(experts.binonly, and not when the file tier is already unbuffered). WithSTRATA_PREFILL_DIRECT_RAM >= 2it also opens a cached overlapped handle.read_directuses these handles when the tier itself is not unbuffered.copy_blobsalready reads throughpdirect_, as it does on Linux.ExpertSource::prompt_reads()(default false; true on Windows forexperts.binwith those handles open): the stager inprefill.cppthen hands the unpinned blobs tocopy_blobs, 8 at a time.transient()is not touched, so the decode and the prompt path's CPU share behave as before; only where the bytes come from changes.copy_blobswithSTRATA_PREFILL_DIRECT_RAM(Windows,prompt_reads()only) asksQueryWorkingSetExwhich blobs are already in RAM.generate.cppreads the switch in the mmap mode without a budget on Windows only, so Linux keeps its behaviour also with the switch set.test_prompt_direct_mappedintests/core/file_expert_source_test.cpp: a syntheticexperts.bin,open_prompt_direct, thencopy_blobsof 8 blobs, read unbuffered, copied from the working set, and read through the file cache in merged runs, compared byte for byte with the file.Validation
Passed:
-DCMAKE_CUDA_ARCHITECTURES=120 -DSTRATA_PORTABLE=ON:cmake --build build --target strataon 857b57b (this branch before the test commit; that commit touches onlytests/), andcmake --build build --target file_expert_source_testwith-DSTRATA_BUILD_TESTS=ONon 237d6cb (the head). No new kind of compiler warning; a few more C4996 (getenv), as in the code around it.file_expert_source_teston 237d6cb:file_expert_source_test: PASS. The new test printsprompt direct (unbuffered): 7 of 8 blobs read from the file: bytes PASSandprompt direct (file cache, merged): 7 of 8 blobs read from the file: bytes PASS(the eighth blob was copied from the working set). The test also passes on main 7ddc17a, and on this branch merged with [Engine] Windows low-RAM mode: batch-prefetch a layer's CPU experts for a mapped experts.bin (STRATA_MMAP_PREFETCH, #3065) #3086.STRATA_DUMP_FIRST_LOGITSafter an 8K document and a 300-token prompt, two runs per build and setting, in one round with main: for each prompt there were two outputs in all, the first choice was the same in every run, and main itself gave both outputs for the 300-token prompt (KL 1.9e-4 between them). This branch gave each output once with the switches unset and once with them set, for both prompts. On the 8K document main's two runs gave the first output; the second differs from it by KL 1.24e-3, which is what the 0.1.45 release showed between two of its own runs of this document.tools/strata_bench.pyof 7ddc17a as the client, againstserve/server.pyof the same commit started separately (--url, andPYTHONUTF8=1for tools/strata_bench.py: UnicodeDecodeError reading CMakeLists.txt on non-UTF-8 Windows (GBK/cp932), before any measurement #2792), on the same day with the same settings; only the engine and the two variables differ. The main run is the report in [Benchmark] RTX 5070 12 GB + 32 GB RAM on Windows 10, Flash-Next IQ2_XS low-RAM mode (0.2.3.1) #3063.the prompt path's expert reads go unbuffered (STRATA_PROMPT_DIRECT=1, mmap mode).Failed: none observed.
Not run:
#if defined(_WIN32)) in files that every backend compiles, so the HIP build on Windows compiles it too. I would be glad if someone with a HIP or SYCL setup could build this branch; until then I am leaving it as a draft.STRATA_PROMPT_DIRECT=1on Windows (that combination now opens the handles; before, it was refused as Linux only), the GGUF read in place, other models, contexts above 32K.Limits
read_direct); on this drive they still run near its speed.