Skip to content

Commit 5cbc277

Browse files
emlinfacebook-github-bot
authored andcommitted
fix eviction policy configuration (#3182)
Summary: Pull Request resolved: #3182 l2 cache size should be used for eviction memory threshold also, as optimizer offloading is landed, we need to enable it by default. Reviewed By: kathyxuyy Differential Revision: D78142858 fbshipit-source-id: 42f6c95e88e9497cdacb951dd8753b9018ccde44
1 parent 5574def commit 5cbc277

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

torchrec/distributed/batched_embedding_kernel.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -232,6 +232,7 @@ def _populate_zero_collision_tbe_params(
232232
l2_weight_thresholds = [0.0] * len(config.embedding_tables)
233233
eviction_strategy = -1
234234
table_names = [table.name for table in config.embedding_tables]
235+
l2_cache_size = tbe_params["l2_cache_size"]
235236
for i, table in enumerate(config.embedding_tables):
236237
policy_t = table.virtual_table_eviction_policy
237238
if policy_t is not None:
@@ -276,6 +277,7 @@ def _populate_zero_collision_tbe_params(
276277
)
277278
eviction_policy = EvictionPolicy(
278279
eviction_trigger_mode=2, # 2 means mem_util based eviction
280+
eviction_mem_threshold_gb=l2_cache_size,
279281
eviction_strategy=eviction_strategy,
280282
counter_thresholds=counter_thresholds,
281283
ttls_in_mins=ttls_in_mins,
@@ -288,7 +290,7 @@ def _populate_zero_collision_tbe_params(
288290
tbe_params["kv_zch_params"] = KVZCHParams(
289291
bucket_offsets=bucket_offsets,
290292
bucket_sizes=bucket_sizes,
291-
enable_optimizer_offloading=False,
293+
enable_optimizer_offloading=True,
292294
eviction_policy=eviction_policy,
293295
)
294296

0 commit comments

Comments
 (0)