[ROCm][DSv4.1] Keep the Engram tables in host memory on ROCm (#57491)

This commit is contained in:
JohnQinAMD
2026-09-21 10:17:11 +08:00
committed by GitHub
parent 3e67044972
commit 6dfd87f596
5 changed files with 20 additions and 10 deletions
+6 -2
View File
@@ -599,7 +599,9 @@ def test_engram_rejects_empty_head_shards(tp_size, dp_size, n_heads, monkeypatch
ParallelEngramEmbedding(n_heads * 17, 64, (17,) * n_heads)
@pytest.mark.skipif(not current_platform.is_cuda(), reason="CUDA required")
@pytest.mark.skipif(
not current_platform.is_cuda_alike(), reason="CUDA or ROCm required"
)
@pytest.mark.parametrize("cpu_offload", [False, True])
@pytest.mark.parametrize("tp_size", [1, 2, 4, 8])
def test_engram_head_shards_reconstruct_checkpoint(cpu_offload, tp_size, monkeypatch):
@@ -701,7 +703,9 @@ def test_engram_lookup_reuses_jit_across_token_shapes():
assert cache_sizes == [1] * len(cache_sizes)
@pytest.mark.skipif(not current_platform.is_cuda(), reason="CUDA required")
@pytest.mark.skipif(
not current_platform.is_cuda_alike(), reason="CUDA or ROCm required"
)
@pytest.mark.parametrize("cpu_offload", [False, True])
@pytest.mark.parametrize("background", [False, True])
@pytest.mark.parametrize("num_tokens", [1, 7, 256])
+7 -5
View File
@@ -1299,7 +1299,7 @@ def test_engram_dp_shared_memory_config_validation(
monkeypatch, dp_size, load_format, multithread, error
):
"""Reject invalid shared configs before distributed init; allow threaded loads."""
monkeypatch.setattr(current_platform, "is_cuda", lambda: True)
monkeypatch.setattr(current_platform, "is_cuda_alike", lambda: True)
config = cast(
VllmConfig,
SimpleNamespace(
@@ -1324,7 +1324,7 @@ def test_engram_dp_shared_memory_config_validation(
@pytest.mark.parametrize(
"architecture, ple_layers, cuda, supported",
"architecture, ple_layers, accelerator, supported",
[
("DeepseekV41ForCausalLM", [1], True, True),
("DeepseekV41ForCausalLM", [], True, False),
@@ -1339,9 +1339,11 @@ def test_engram_dp_shared_memory_config_validation(
(None, None, True, False),
],
)
def test_engram_model_support(monkeypatch, architecture, ple_layers, cuda, supported):
def test_engram_model_support(
monkeypatch, architecture, ple_layers, accelerator, supported
):
"""A similarly named HF field must not enable unsupported implementations."""
monkeypatch.setattr(current_platform, "is_cuda", lambda: cuda)
monkeypatch.setattr(current_platform, "is_cuda_alike", lambda: accelerator)
model = (
cast(
ModelConfig,
@@ -1430,7 +1432,7 @@ def test_engram_explicit_config_requires_supported_model():
@pytest.mark.parametrize("explicit", [False, True])
def test_engram_draft_config_validates_target(monkeypatch, target_has_ple, explicit):
"""MTP may inherit cross-DP sharding without having its own PLE layers."""
monkeypatch.setattr(current_platform, "is_cuda", lambda: True)
monkeypatch.setattr(current_platform, "is_cuda_alike", lambda: True)
target = SimpleNamespace(
architecture="Qwen4ExpForCausalLM",
hf_text_config=SimpleNamespace(ple_layer_ids=[1] if target_has_ple else []),