perf(cpp): tune NUMA mmap policy for CPU inference - #30
Closed
Jackson57279 wants to merge 1 commit into
Closed
Conversation
Contributor
Author
|
Closing as superseded by the #28 → #29 → #31 stack: #28's MmapPolicy generalizes the mmap_advice here (same madvise mechanism, four policies vs two), the kv_context_ stride fix is already included verbatim in that stack, and #31's benchmarks reversed the single/16 thread cap in favor of interleave + all cores for large dense models. Unique bits worth lifting from |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
plans/oxidize-cpp-cpu-performance.mdwith the scoped CPU performance spec.mmap_adviceso dense single-node loads usesequential_prefetch, while huge or near-RAM-limit interleaved loads userandommmap advice.single/16, and made split GGUF fingerprints sum all shards.GgufModel::load()/ split GGUF loading, and exposed it in--print-plan --json.kv_context_instead of advertised GGUF context size.Validation
Local:
git diff --checkcmake --build oxidize-cpp/build --target oxidize-cpp autotune_test gguf_mmap_advice_test kernels_test parity_test grad_check -j$(nproc)ctest --test-dir oxidize-cpp/build --output-on-failure-> 5/5 passedscripts/test_bench_ai_box_matrix.shscripts/test_cpp_kv_context_stride.shRemote
ai@192.168.1.132:single,threads=16,mmap_advice=sequential_prefetchsingle,threads=16,mmap_advice=sequential_prefetchinterleave,threads=48,mmap_advice=randomprefill_tps=1.626562,decode_tps=1.410998,total_s=56.694285prefill_tps=0.185467,decode_tps=0.208863,total_s=131.529042The >500B-class file is present and exercises planning/loading, but generation is not available until oxidize-cpp supports that MLA/lightning-attn/shortconv architecture.
Summary by cubic
Tune CPU inference by auto-selecting mmap advice based on NUMA mode and model size, and apply it during GGUF loading. Also cap dense dual-socket plans to 16 threads and fix a KV-cache stride bug.
New Features
mmap_adviceto autotune:sequential_prefetchfor single-node dense loads;randomfor huge or near-RAM-limit interleaved loads.GgufModel::load()(including split GGUF); CLI passes the advice;--print-plan --jsonnow shows it.single/16; fingerprinting sums split GGUF shard sizes; CLI validates model existence before planning.Bug Fixes
kv_context_for KV-cache layer indexing in batched forward to avoid stride errors.Written for commit 7a32d74. Summary will update on new commits.