Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 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: 4 additions & 0 deletions .buildkite/amd/scripts/aiter_mha_cache.py
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,10 @@ def dynamic_library_paths() -> list[Path]:
try:
torch_distribution = importlib.metadata.distribution("torch")
candidates.append(Path(torch_distribution.locate_file("torch/lib")))
torch_site_packages = Path(torch_distribution.locate_file(""))
candidates.extend(
library.parent for library in torch_site_packages.glob("_rocm_sdk_*/lib/*/lib/librocm-openblas.so.*")
)
Comment thread
andyluo7 marked this conversation as resolved.
Resolved
except importlib.metadata.PackageNotFoundError:
pass
candidates.extend((Path("/opt/rocm/lib"), Path("/opt/rocm/lib64")))
Expand Down
23 changes: 23 additions & 0 deletions tests/buildkite/test_aiter_mha_cache.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,29 @@ def missing_runner(command: list[str], **_kwargs) -> subprocess.CompletedProcess
assert not cache.ldd_resolves(module, runner=missing_runner, library_paths=[])


def test_dynamic_library_paths_include_therock_openblas_directory(
tmp_path: Path, monkeypatch: pytest.MonkeyPatch
) -> None:
site_packages = tmp_path / "site-packages"
torch_lib = site_packages / "torch/lib"
therock_lib = site_packages / "_rocm_sdk_libraries/lib/rocm_sysdeps/lib"
torch_lib.mkdir(parents=True)
therock_lib.mkdir(parents=True)
(therock_lib / "librocm-openblas.so.0").touch()

class TorchDistribution:
def locate_file(self, path: str) -> Path:
return site_packages / path

def distribution(name: str) -> TorchDistribution:
assert name == "torch"
return TorchDistribution()

monkeypatch.setattr(cache.importlib.metadata, "distribution", distribution)

assert cache.dynamic_library_paths()[:2] == [torch_lib, therock_lib]


def test_image_dependency_identity_tracks_the_rocm_image_inputs(tmp_path: Path) -> None:
root = tmp_path / "repo"
for relative in cache._IMAGE_DEPENDENCY_PATHS:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -974,8 +974,8 @@ def test_fused_gate_up_matches_separate(self, loaded_target_classes) -> None:

ref_g, ref_u = g(x), u(x)
out_g, out_u = fused(x).split([intermediate, intermediate], dim=-1)
assert torch.equal(ref_g, out_g)
assert torch.equal(ref_u, out_u)
torch.testing.assert_close(ref_g, out_g)
torch.testing.assert_close(ref_u, out_u)

def test_load_weights_repacks_hf_shards(self, mocker: MockerFixture, loaded_target_classes) -> None:
"""``load_weights`` must transparently re-pack HF q/k/v and gate/up
Expand Down
36 changes: 36 additions & 0 deletions tests/tools/test_tools_package.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# SPDX-License-Identifier: Apache-2.0
# SPDX-FileCopyrightText: Copyright contributors to the vLLM-Omni project

from __future__ import annotations

import os
import subprocess
import sys
from pathlib import Path

import pytest

pytestmark = [pytest.mark.core_model, pytest.mark.cpu]


def test_local_tools_package_wins_over_later_regular_package(tmp_path: Path) -> None:
repo_root = Path(__file__).resolve().parents[2]
competing_root = tmp_path / "dependency"
competing_package = competing_root / "tools"
competing_package.mkdir(parents=True)
(competing_package / "__init__.py").write_text("SOURCE = 'dependency'\n", encoding="utf-8")

environment = os.environ.copy()
environment["PYTHONPATH"] = os.pathsep.join((str(repo_root), str(competing_root)))
program = "from pathlib import Path; import tools; print(Path(tools.__file__).resolve())"
completed = subprocess.run(
[sys.executable, "-c", program],
cwd=tmp_path,
env=environment,
check=True,
capture_output=True,
text=True,
timeout=10,
)

assert Path(completed.stdout.strip()) == (repo_root / "tools/__init__.py").resolve()
9 changes: 9 additions & 0 deletions tools/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# SPDX-License-Identifier: Apache-2.0
# SPDX-FileCopyrightText: Copyright contributors to the vLLM-Omni project

"""Repository-local developer and CI tools.

Making this directory a regular package prevents a dependency's top-level
``tools`` package from shadowing these modules when the repository root appears
first on ``sys.path``.
"""
4 changes: 2 additions & 2 deletions vllm_omni/model_executor/models/moss_tts/local_kernels.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@
import numpy as np
import torch
from vllm.platforms import current_platform
from vllm.triton_utils import tl, triton
from vllm.triton_utils import tl, tldevice, triton

from .triton_launch import cuda_pdl_launch_kwargs

_gdc_launch = tl.extra.cuda.gdc_launch_dependents
_gdc_wait = tl.extra.cuda.gdc_wait
libdevice = tl.extra.cuda.libdevice
libdevice = tldevice

# Hopper+ supports programmatic dependent launch. The kernel waits for its
# predecessor before any global access and lets its successor launch at once; results are unchanged.
Expand Down
Loading