[Model][Engram] Share host tables across co-located DP replicas by default (#57651)
Signed-off-by: Juntian Liu <Juntianl777@gmail.com> Signed-off-by: zjy0516 <riverclouds.zhu@qq.com> Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com> Co-authored-by: zjy0516 <riverclouds.zhu@qq.com>
This commit is contained in:
co-authored by
Claude Fable 5.1
zjy0516
parent
0ff0477ff9
commit
76ffb0d374
@@ -685,6 +685,13 @@ def test_engram_dp_shared_memory_runtime_requirements(
|
||||
)
|
||||
|
||||
|
||||
def test_engram_tables_too_large_for_shm_are_not_shared(monkeypatch):
|
||||
"""A /dev/shm smaller than the tables must fall back instead of failing startup."""
|
||||
monkeypatch.setattr(engram_ops, "get_engram_dp_size", lambda: 2)
|
||||
layout = SimpleNamespace(num_embeddings=(1 << 50,), head_dim=DIM)
|
||||
assert not engram_ops.can_share_engram_tables(layout)
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"node_ids,dp_size,replica_size,expected",
|
||||
[
|
||||
|
||||
@@ -114,7 +114,7 @@ def test_engram_config_cli(options):
|
||||
"options,provided,dp_shared_memory",
|
||||
[
|
||||
([], False, False),
|
||||
(["--engram-config", "{}"], True, False),
|
||||
(["--engram-config", "{}"], True, None),
|
||||
(
|
||||
["--engram-config", '{"dp_shared_memory": true}'],
|
||||
True,
|
||||
|
||||
+15
-3
@@ -1284,15 +1284,27 @@ def test_engram_dp_shared_memory_requires_cpu_offload():
|
||||
EngramConfig(cpu_offload=False, dp_shared_memory=True)
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"cpu_offload,dp_size,elastic_ep,expected",
|
||||
[(True, 2, False, True), (False, 2, False, False), (True, 1, False, False)],
|
||||
)
|
||||
def test_engram_dp_shared_memory_defaults_when_supported(
|
||||
cpu_offload, dp_size, elastic_ep, expected
|
||||
):
|
||||
"""Unset dp_shared_memory enables sharing only for offloaded, non-elastic DP."""
|
||||
parallel = ParallelConfig(data_parallel_size=dp_size)
|
||||
parallel.enable_elastic_ep = elastic_ep
|
||||
config = EngramConfig(cpu_offload=cpu_offload)
|
||||
config.resolve_dp_shared_memory(parallel)
|
||||
assert config.dp_shared_memory is expected
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"dp_size,load_format,multithread,error",
|
||||
[
|
||||
(1, "auto", False, "requires data_parallel_size > 1"),
|
||||
(2, "dummy", False, "requires load_format"),
|
||||
(2, "sharded_state", False, "requires load_format"),
|
||||
(2, "auto", False, None),
|
||||
(2, "safetensors", True, None),
|
||||
(2, "pt", True, None),
|
||||
],
|
||||
)
|
||||
def test_engram_dp_shared_memory_config_validation(
|
||||
|
||||
Reference in New Issue
Block a user