Files
hakmem/core/hakmem_tiny_config.c
Moe Charm (CI) 47797a3ba0 Tiny: enable class7 (1024B) fast_cap by default (64); add 1T A/B switch for Remote Side (HAKMEM_TINY_ASSUME_1T)
Changes
- core/hakmem_tiny_config.c: set g_fast_cap_defaults[7]=64 (was 0) to reduce SuperSlab path frequency for 1024B.
- core/tiny_remote.c: add env HAKMEM_TINY_ASSUME_1T=1 to disable Remote Side table in single‑thread runs (A/B friendly).

A/B (1T, cpu2 pinned, 500k iters)
- 256B: cycles ↓ ~119.7M → ~60.0M, time 95.4ms → 83.2ms (~12% faster), IPC ~0.92→0.88, branch‑miss ~11%.
- 1024B: cycles ↓ ~74.4M → ~27.3M, time 83.3ms → 73.5ms (~12% faster), IPC ~0.82→0.75, branch‑miss ~11%.

Notes
- Branch‑miss率は依然高め。今後: adopt境界の分岐整理、超シンプルrefill(class7特例)/fast path優先度の再調整で詰める。
- A/B: export HAKMEM_TINY_ASSUME_1T=1 で1T時にRemote SideをOFF。HAKMEM_TINY_REMOTE_SIDEで明示的制御も可。
2025-11-09 17:00:37 +09:00

71 lines
2.1 KiB
C
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/**
* hakmem_tiny_config.c
*
* Implementation of centralized Tiny configuration constants
*/
#include "hakmem_tiny_config.h"
// ============================================================================
// Fast Cache Configuration
// ============================================================================
// Factory defaults (“balanced”) mutable at runtime
static const uint16_t k_fast_cap_defaults_factory[TINY_NUM_CLASSES] = {
128, // Class 0: 8B
128, // Class 1: 16B
128, // Class 2: 32B
128, // Class 3: 64B (reduced from 512 to limit RSS)
128, // Class 4: 128B (trimmed via ACE/TLS caps)
128, // Class 5: 256B
128, // Class 6: 512B
64 // Class 7: 1KB (enable small fast cache to reduce Superslab path)
};
uint16_t g_fast_cap_defaults[TINY_NUM_CLASSES] = {
128, 128, 128, 128, 128, 128, 128, 64
};
void tiny_config_reset_defaults(void) {
for (int i = 0; i < TINY_NUM_CLASSES; i++) {
g_fast_cap_defaults[i] = k_fast_cap_defaults_factory[i];
}
}
// ============================================================================
// TLS Magazine Configuration
// ============================================================================
// Default TLS magazine capacities per class
int tiny_default_cap(int class_idx) {
switch (class_idx) {
case 0: return 128; // 8B
case 1: return 128; // 16B
case 2: return 128; // 32B
case 3: return 128; // 64B (reduced from 512 to limit RSS)
case 4: return 96; // 128B (aggressively trimmed to limit RSS)
case 5: return 128; // 256B
case 6: return 128; // 512B
default: return 64; // 1KB
}
}
// Alias for tiny_default_cap
int tiny_mag_default_cap(int class_idx) {
return tiny_default_cap(class_idx);
}
// Maximum allowed TLS magazine capacities per class
int tiny_cap_max_for_class(int class_idx) {
switch (class_idx) {
case 0: return 2048;
case 1: return 1024;
case 2: return 768;
case 3: return 512;
case 4: return 160;
case 5: return 256;
case 6: return 128;
default: return 64;
}
}