Phase 70-0: Infrastructure prep for refill tuning (Observability + WarmPool Sizing)
- Observability Fix: Enabled unified cache hit/miss stats in release builds when HAKMEM_UNIFIED_CACHE_STATS_COMPILED is set. - WarmPool Sizing: Decoupled hardcoded '12' from prefill logic; now uses TINY_WARM_POOL_DEFAULT_PER_CLASS macro and respects ENV overrides. - Increased TINY_WARM_POOL_MAX_PER_CLASS to 32 to support wider ENV sweeps. - Added unified_cache_auto_stats destructor to dump metrics at exit (replacing debug print hack).
This commit is contained in:
@ -97,7 +97,7 @@ __thread TinyWarmPool g_tiny_warm_pool[TINY_NUM_CLASSES] = {0};
|
||||
// Metrics (Phase 23, optional for debugging)
|
||||
// ============================================================================
|
||||
|
||||
#if !HAKMEM_BUILD_RELEASE
|
||||
#if !HAKMEM_BUILD_RELEASE || HAKMEM_UNIFIED_CACHE_STATS_COMPILED
|
||||
__thread uint64_t g_unified_cache_hit[TINY_NUM_CLASSES] = {0};
|
||||
__thread uint64_t g_unified_cache_miss[TINY_NUM_CLASSES] = {0};
|
||||
__thread uint64_t g_unified_cache_push[TINY_NUM_CLASSES] = {0};
|
||||
@ -262,7 +262,7 @@ void unified_cache_shutdown(void) {
|
||||
void unified_cache_print_stats(void) {
|
||||
if (!unified_cache_enabled()) return;
|
||||
|
||||
#if !HAKMEM_BUILD_RELEASE
|
||||
#if !HAKMEM_BUILD_RELEASE || HAKMEM_UNIFIED_CACHE_STATS_COMPILED
|
||||
fprintf(stderr, "\n[Unified-STATS] Unified Cache Metrics:\n");
|
||||
|
||||
for (int cls = 0; cls < TINY_NUM_CLASSES; cls++) {
|
||||
@ -296,6 +296,11 @@ void unified_cache_print_stats(void) {
|
||||
#endif
|
||||
}
|
||||
|
||||
__attribute__((destructor))
|
||||
static void unified_cache_auto_stats(void) {
|
||||
unified_cache_print_stats();
|
||||
}
|
||||
|
||||
// ============================================================================
|
||||
// Warm Pool Stats (always compiled, ENV-gated at runtime)
|
||||
// ============================================================================
|
||||
|
||||
Reference in New Issue
Block a user