Repository navigation
Refactor _print_memory_consume to report real per-tier value bytes - #408
Conversation
- Add StorageLayout enum set explicitly by _create_cache_storage so the printed layout matches the code path that ran (no inference from buffer state, which only reflects options[0].local_hbm_for_values). - Read per-tier value bytes from the constructed ExtendableBuffer (init, post bucket-alignment) and options.max_capacity (peak); this fixes caching mode where the HBM cache duplicates the host backing — the old code reported HBM+DRAM=total_memory and missed the cache copy entirely. Also captures hybrid cap_scale + bucket-alignment rounding. - Switch to long-format tier-major output: one row per (tier, table), per-tier TOTAL rows. Full top/bottom/inter-tier borders; a blanked-tier-column rule frames each TOTAL row inside its block. - Extract _build_tier_block / _render_tier_table helpers so the print function only does dispatch + layout footnote. - Bytes formatter renders MB/KB as float with up to 3 decimals, trimming trailing zeros. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
|
/build |
|
✅ Pipeline #53012873 -- success
Result: 13/14 jobs passed |
Greptile SummaryThis PR refactors
Confidence Score: 5/5Safe to merge; the refactored reporter is diagnostic-only and cannot affect training correctness or data integrity. All storage-construction paths explicitly set No files require special attention; changes are confined to the diagnostic print path and do not touch forward/backward pass logic. Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
A["_create_cache_storage()"] --> B{total_memory > local_hbm?}
B -- No --> C[DynamicEmbStorage HBM_ONLY]
B -- Yes --> D{caching?}
D -- Yes --> E{PS?}
E -- Yes --> F[PS + DynamicEmbCache CACHING_PS]
E -- No --> G[DynamicEmbStorage + DynamicEmbCache CACHING]
D -- No --> H{local_hbm <= 0?}
H -- Yes --> I{PS?}
I -- Yes --> J[PS storage HOST_PS]
I -- No --> K[DynamicEmbStorage HOST_ONLY]
H -- No --> L[HybridStorage HYBRID]
C & F & G & J & K & L --> M["_print_memory_consume(storage, cache, layout, ...)"]
M --> N{layout?}
N -- HBM_ONLY --> O["_tier_bytes_from_state(storage._state)"]
N -- HOST_ONLY --> P["_tier_bytes_from_state(storage._state)"]
N -- HYBRID --> Q["_tier_bytes_from_state(_hbm) + _tier_bytes_from_state(_host)"]
N -- CACHING --> R["_tier_bytes_from_state(cache._state) + _tier_bytes_from_state(storage._state)"]
N -- CACHING_PS --> S["_tier_bytes_from_state(cache._state) + _tier_bytes_from_options(...)"]
N -- HOST_PS --> T["_tier_bytes_from_options(...)"]
N -- else --> U["raise ValueError"]
O & P & Q & R & S & T --> V["_build_tier_block() _render_tier_table() print output"]
Reviews (2): Last reviewed commit: "Make StorageLayout dispatch in _print_me..." | Re-trigger Greptile |
Replace the fallthrough `else: # HOST_PS` with an explicit elif and a trailing `else: raise ValueError(...)`. Future StorageLayout variants that forget to add a matching branch now fail loudly instead of being silently misreported as external PS. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>


Description
Checklist