Skip to content

Commit 524325d

Browse files
Lizhe Jifacebook-github-bot
authored andcommitted
Add eviction writeback callback to FeatureEvict (pytorch#5832)
Summary: X-link: facebookresearch/FBGEMM#2754 Add EvictionWritebackCallback type and wire it through FeatureEvict eviction loops. When a dirty block is evicted from DRAM, its data is serialized and passed to the callback for writeback to SSD. The callback is invoked after releasing the DRAM shard lock to avoid holding locks during SSD I/O. Differential Revision: D107491725
1 parent 7941ff8 commit 524325d

5 files changed

Lines changed: 535 additions & 48 deletions

File tree

fbgemm_gpu/fbgemm_gpu/tbe/ssd/ssd_config.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,9 @@ class EvictionPolicy(NamedTuple):
8383
enable_eviction_for_feature_score_eviction_policy: list[bool] | None = (
8484
None # enable eviction if eviction policy is feature score, false means no eviction
8585
)
86+
enable_ssd_writeback: bool = (
87+
False # when True, evicted dirty blocks are written back to SSD via callback; when False, eviction deletes blocks directly
88+
)
8689

8790
def validate(self) -> None:
8891
assert self.eviction_trigger_mode in [0, 1, 2, 3, 4, 5], (

fbgemm_gpu/fbgemm_gpu/tbe/ssd/training.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -956,6 +956,7 @@ def __init__(
956956
eviction_policy.interval_for_insufficient_eviction_s,
957957
eviction_policy.interval_for_sufficient_eviction_s,
958958
eviction_policy.interval_for_feature_statistics_decay_s,
959+
eviction_policy.enable_ssd_writeback,
959960
)
960961
enrichment_config = None
961962
if (

0 commit comments

Comments
 (0)