Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions mcm/model_cache_manager/data/kernel_validator.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,15 @@
log = logging.getLogger(__name__)


class KernelTarget(BaseModel):
class KernelTarget(BaseModel): # pylint: disable=too-few-public-methods
"""Validation model for the 'target' field of kernel metadata."""

backend: str = ""
arch: int | str = 0
warp_size: int = 0


class KernelMetadata(BaseModel):
class KernelMetadata(BaseModel): # pylint: disable=too-few-public-methods
"""
Pydantic model for validating kernel metadata.

Expand Down
17 changes: 17 additions & 0 deletions mcm/model_cache_manager/tests/utils/test_cache_mode_detection.py
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,23 @@ def test_detect_vllm_structure_no_rank_dirs(self):
mode = detect_cache_mode(cache_dir)
self.assertEqual(mode, MODE_TRITON)

def test_detect_vllm_binary_cache_structure(self):
"""Test detection of new vLLM cache structure with binary artifacts."""
# Binary artifacts are files (not directories) named artifact_compile_range_*
vllm_dir = self.temp_dir / "vllm_binary"
torch_compile = vllm_dir / "torch_compile_cache"
hash_dir = torch_compile / "some_vllm_hash"
rank_dir = hash_dir / "rank_0_0"
backbone_dir = rank_dir / "backbone"
backbone_dir.mkdir(parents=True)

# Create a binary artifact file (not a directory)
binary_artifact = backbone_dir / "artifact_compile_range_0"
binary_artifact.write_bytes(b"\x00binary data")

mode = detect_cache_mode(vllm_dir)
self.assertEqual(mode, MODE_VLLM)

def test_detect_mixed_legacy_and_triton_vllm_takes_precedence(self):
"""Test detection when both vllm-legacy and triton structures exist."""
cache_dir = self.temp_dir / "mixed_cache"
Expand Down
6 changes: 5 additions & 1 deletion mcm/model_cache_manager/utils/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -198,8 +198,12 @@ def iter_artifact_compile_range_dirs(backbone_dir: Path):


def _has_artifact_compile_range_with_triton(backbone_dir: Path) -> bool:
"""Check if backbone directory has artifact_compile_range subdirectories with triton."""
"""Check if backbone directory has artifact_compile_range artifacts (unpacked or binary)."""
for artifact_dir in iter_artifact_compile_range_dirs(backbone_dir):
# Binary artifact (file) — contains packed triton data
if artifact_dir.is_file():
return True
# Unpacked artifact (directory) — check for triton subdirectory
triton_dir = artifact_dir / "triton"
if triton_dir.exists():
return True
Expand Down
5 changes: 4 additions & 1 deletion mcm/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,21 @@ authors = [{name = "Alessandro Sangiorgi", email = "asangior@redhat.com"
requires-python = ">=3.9"

dependencies = [
"triton",
"rich>=13.7",
"typer[all]",
"structlog",
"pydantic>=2",
"pydantic-settings>=2",
"sqlalchemy>=2.0.40",
"vllm==0.15.1",
]

[project.scripts]
mcm = "model_cache_manager.cli.main:run"

[tool.pylint."messages_control"]
disable = ["import-error"]

[tool.setuptools]
package-dir = {"" = "."}

Expand Down
6 changes: 3 additions & 3 deletions mcm/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
typer>=0.9.0
typer[all]
rich>=13.7
pydantic>=2.0.0
pydantic-settings>=2.0.0
structlog>=23.0.0
structlog
sqlalchemy>=2.0.40
pytest>=7.0.0
vllm
vllm==0.15.1
Loading