Repository navigation
feat(libopenbuenos): raise & auto-size weight cache cap (>916 MB) with telemetry (#40) - #45
Merged
Merged
Conversation
- Reject negative/malformed env values instead of letting strtoul wrap to ULONG_MAX and clamp to 8 GiB (OPENBUENOS_WEIGHT_CACHE_MB=-16 was accepted as a massive explicit cap). - Saturating size_t arithmetic for cache accounting adds, meminfo add-back, and platform MemAvailable conversion (SIZE_MAX guards). - Reclaim orphaned tiles in weight_cache_sim_access when find_locked self-evicts an oversized entry (object leak). - Fix byte accounting: evict/detach/find now credit weight_cache_bytes for ext2 bytes only and decrement outlier_cache_bytes separately. - Deallocate macOS mach host port in the MemAvailable probe. - Guard ob_gemm_emitter op640 mask shift for n_c32 >= 64 (UBSan hit). - Add openbuenos_adversarial_test (env extremes, churn/shrink, SIZE_MAX, oversize, concurrent stats/cap churn); wire into CMake.
Collaborator
Author
Adversarial Hardening & Public-Roads Audit Receipt (
|
…ds, and host coverage
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.
Refs #40 (host implementation,
MemAvailable-guarded dynamic auto-sizing, explicitOPENBUENOS_CACHE_CAP/OPENBUENOS_WEIGHT_CACHE_MB>= 1.5 GiB support, weight-cache stats API, and outlier/overflow/concurrency hardening; live Pixel 10 solo + DSpark silicon benchmark proof remains open on#40).Summary
libopenbuenos/include/openbuenos.h,libopenbuenos/src/ob_device.cpp,llama-cpp-edgetpu/openbuenos_shim.c): keepsob_config_t(48 B on LP64) andob_profile_stats_t(216 B on LP64,swiglu_callsat offset 192) identical tomain, exposing the dedicatedob_weight_cache_stats_t,ob_context_set_weight_cache_cap, andob_context_get_weight_cache_statsAPIs guarded cleanly withOB_HAS_WEIGHT_CACHE_STATSsoopenbuenos_shim.ccompiles and links cleanly against bothmainand this branch.libopenbuenos/src/ob_gemm.cpp,libopenbuenos/src/ob_internal.h): centralizes tile untracking (weight_cache_untrack_locked) across ordinary LRU eviction, hit-triggered self-eviction, and async timeout buffer detachment soext2_bytes + outlier_cols_bytesare subtracted together without leaving phantom resident bytes.libopenbuenos/src/ob_gemm.cpp,llama-cpp-edgetpu/ggml-edgetpu.cpp):/proc/meminfo: distinguishesMemAvailable: 0 kBfrom missing/unreadable lines, skips overlong lines safely, excludes pageable outlier columns from DMA add-back, and passes pending DMA allocation bytes consistently across both prepack and ordinary insertion.vm_statistics64: sumsfree_count + inactive_countwithout double-countingspeculative_countorpurgeable_count.size_toverflow-safe subtraction (weight_cache_would_exceed_locked), non-evicting prepack budget checks that avoid accruingweight_pack_nson precheck skips, and validated unsigned env parsing preserving leading+compatibility.libopenbuenos/tests/openbuenos_host_test.cpp,libopenbuenos/tests/openbuenos_adversarial_test.cpp,libopenbuenos/tests/openbuenos_selftest.cpp): adds LP64 ABIstatic_asserts, Linux0 kB/proc/meminfoparsing checks, realob_gemm_matmul_f32_quant_batchpack/eviction thrash tests, end-to-end production outlier column admission + eviction/self-eviction/detach tests returning resident bytes cleanly to0, TSan concurrent shrink/churn tests, and CMake/Make integration.Verification (HEAD
2f69e176feaf00970aca99d3b99d2391ec0f9648)make -C libopenbuenos verify(-Wall -Wextra -Wpedantic -Werror, host 28/28 suites +ob_quant_unpack_test+ Android arm64 NDK ELF check): PASSctest:libopenbuenos(5/5),freetile(5/5),llama-cpp-cloudtpu(2/2): PASSlibopenbuenos5/5ctest) & TSan (openbuenos_adversarial_test): PASSmake -C libopentpu verify-header-host host test(16/16host tests + mock VFIO/matmul proof): PASSarmv7a-linux-androideabi34-clang++ -Wall -Wextra -Wpedantic -Werror) syntax checks &llama-cpp-edgetpu/openbuenos_shim.ccompatibility against bothmainand HEAD headers: PASSverify_*corpus scripts skipped without externalFREETPU_CORPUS_DIR)#40(out of host PR scope): live Pixel 10 solo + DSpark silicon benchmark comparison.