Adapt Frontier RoPE profiling to vLLM 0.20
This commit is contained in:
@@ -0,0 +1,59 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
|
"""Run Frontier's linear profiler against the vLLM 0.20 RoPE API.
|
||||||
|
|
||||||
|
Frontier passes the pre-v0.20 ``get_rope`` arguments separately, while vLLM
|
||||||
|
0.20 carries the same values in ``rope_parameters``. Keep both repositories
|
||||||
|
unchanged and adapt only that call boundary for the profiling experiment.
|
||||||
|
"""
|
||||||
|
|
||||||
|
from __future__ import annotations
|
||||||
|
|
||||||
|
import inspect
|
||||||
|
from typing import Any
|
||||||
|
|
||||||
|
import torch
|
||||||
|
from vllm.model_executor.layers.rotary_embedding import get_rope as vllm_get_rope
|
||||||
|
|
||||||
|
from frontier.profiling.common.layers import rotary_embedding as frontier_rope
|
||||||
|
|
||||||
|
|
||||||
|
def _vllm020_get_rope_adapter(
|
||||||
|
*,
|
||||||
|
head_size: int,
|
||||||
|
rotary_dim: int,
|
||||||
|
max_position: int,
|
||||||
|
base: int | float,
|
||||||
|
is_neox_style: bool,
|
||||||
|
rope_scaling: dict[str, Any] | None,
|
||||||
|
dtype: torch.dtype | None = None,
|
||||||
|
) -> Any:
|
||||||
|
rope_parameters = dict(rope_scaling or {})
|
||||||
|
rope_parameters["rope_theta"] = base
|
||||||
|
rope_parameters["rope_dim"] = rotary_dim
|
||||||
|
return vllm_get_rope(
|
||||||
|
head_size=head_size,
|
||||||
|
max_position=max_position,
|
||||||
|
is_neox_style=is_neox_style,
|
||||||
|
rope_parameters=rope_parameters,
|
||||||
|
dtype=dtype,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
def main() -> None:
|
||||||
|
parameters = inspect.signature(vllm_get_rope).parameters
|
||||||
|
if "rope_parameters" not in parameters or "rotary_dim" in parameters:
|
||||||
|
raise RuntimeError(
|
||||||
|
"Expected the vLLM 0.20 get_rope API with rope_parameters; "
|
||||||
|
f"found {inspect.signature(vllm_get_rope)}"
|
||||||
|
)
|
||||||
|
|
||||||
|
frontier_rope._VLLM_GET_ROPE = _vllm020_get_rope_adapter
|
||||||
|
frontier_rope._VLLM_GET_ROPE_IMPORT_ERROR = None
|
||||||
|
|
||||||
|
from frontier.profiling.linear_op.main import main as frontier_main
|
||||||
|
|
||||||
|
frontier_main()
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
main()
|
||||||
@@ -1,18 +1,18 @@
|
|||||||
version = 1
|
version = 1
|
||||||
|
|
||||||
[[jobs]]
|
[[jobs]]
|
||||||
name = "qwen30-vllm020-frontier-linear-smoke-20260716-v1"
|
name = "qwen30-vllm020-frontier-linear-smoke-20260716-v2-rope-api"
|
||||||
gpus = 1
|
gpus = 1
|
||||||
gpu_model = "H20"
|
gpu_model = "H20"
|
||||||
hosts = ["dash0"]
|
hosts = ["dash0"]
|
||||||
command = "cd /home/admin/cpfs/wjh/aituner/aituner-qwen30-vllm020-profile-v1/runs/frontier-qwen30-vllm020-profile-v1 && timeout --signal=TERM --kill-after=30s 1020 bash run_frontier_linear_smoke.sh"
|
command = "cd /home/admin/cpfs/wjh/aituner/aituner-qwen30-vllm020-profile-v1/runs/frontier-qwen30-vllm020-profile-v1 && timeout --signal=TERM --kill-after=30s 1020 bash run_frontier_linear_smoke.sh"
|
||||||
artifacts = ["artifacts/frontier-linear-smoke-v1"]
|
artifacts = ["artifacts/frontier-linear-smoke-v2"]
|
||||||
|
|
||||||
[jobs.env]
|
[jobs.env]
|
||||||
HOME = "/tmp/wjh"
|
HOME = "/tmp/wjh"
|
||||||
XDG_CACHE_HOME = "/tmp/wjh/.cache"
|
XDG_CACHE_HOME = "/tmp/wjh/.cache"
|
||||||
VLLM_CACHE_ROOT = "/tmp/wjh/.cache/vllm"
|
VLLM_CACHE_ROOT = "/tmp/wjh/.cache/vllm"
|
||||||
OUTPUT_ROOT = "/home/admin/cpfs/wjh/aituner/aituner-qwen30-vllm020-profile-fleet/artifacts/frontier-linear-smoke-v1"
|
OUTPUT_ROOT = "/home/admin/cpfs/wjh/aituner/aituner-qwen30-vllm020-profile-fleet/artifacts/frontier-linear-smoke-v2"
|
||||||
VENV_ROOT = "/tmp/wjh/venvs/vllm-0.20.0-cu129-profiler-v1"
|
VENV_ROOT = "/tmp/wjh/venvs/vllm-0.20.0-cu129-profiler-v1"
|
||||||
FRONTIER_ROOT = "/home/admin/cpfs/wjh/frontier-qwen30-vllm020-profile-v1/Frontier"
|
FRONTIER_ROOT = "/home/admin/cpfs/wjh/frontier-qwen30-vllm020-profile-v1/Frontier"
|
||||||
VLLM_SOURCE = "/home/admin/cpfs/wjh/agentic-kv/third_party/vllm_v20_build"
|
VLLM_SOURCE = "/home/admin/cpfs/wjh/agentic-kv/third_party/vllm_v20_build"
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ OUTPUT_ROOT="${OUTPUT_ROOT:?OUTPUT_ROOT must be set}"
|
|||||||
VENV_ROOT="${VENV_ROOT:-/tmp/wjh/venvs/vllm-0.20.0-cu129-profiler-v1}"
|
VENV_ROOT="${VENV_ROOT:-/tmp/wjh/venvs/vllm-0.20.0-cu129-profiler-v1}"
|
||||||
FRONTIER_ROOT="${FRONTIER_ROOT:-/home/admin/cpfs/wjh/frontier-qwen30-vllm020-profile-v1/Frontier}"
|
FRONTIER_ROOT="${FRONTIER_ROOT:-/home/admin/cpfs/wjh/frontier-qwen30-vllm020-profile-v1/Frontier}"
|
||||||
VLLM_SOURCE="${VLLM_SOURCE:-/home/admin/cpfs/wjh/agentic-kv/third_party/vllm_v20_build}"
|
VLLM_SOURCE="${VLLM_SOURCE:-/home/admin/cpfs/wjh/agentic-kv/third_party/vllm_v20_build}"
|
||||||
|
RUN_DIR="$(pwd -P)"
|
||||||
TOKENS=(1 8 16 32 64 128 256 512 1024 2048 4096 8192)
|
TOKENS=(1 8 16 32 64 128 256 512 1024 2048 4096 8192)
|
||||||
mkdir -p "${OUTPUT_ROOT}/logs" "${OUTPUT_ROOT}/provenance" "${OUTPUT_ROOT}/profiles"
|
mkdir -p "${OUTPUT_ROOT}/logs" "${OUTPUT_ROOT}/provenance" "${OUTPUT_ROOT}/profiles"
|
||||||
exec > >(tee -a "${OUTPUT_ROOT}/logs/full.log") 2>&1
|
exec > >(tee -a "${OUTPUT_ROOT}/logs/full.log") 2>&1
|
||||||
@@ -25,7 +26,7 @@ test "$(git -C "${VLLM_SOURCE}" rev-parse HEAD)" = "88d34c6409e9fb3c7b8ca0c04756
|
|||||||
git rev-parse HEAD > "${OUTPUT_ROOT}/provenance/aituner.commit"
|
git rev-parse HEAD > "${OUTPUT_ROOT}/provenance/aituner.commit"
|
||||||
git -C "${FRONTIER_ROOT}" rev-parse HEAD > "${OUTPUT_ROOT}/provenance/frontier.commit"
|
git -C "${FRONTIER_ROOT}" rev-parse HEAD > "${OUTPUT_ROOT}/provenance/frontier.commit"
|
||||||
git -C "${VLLM_SOURCE}" rev-parse HEAD > "${OUTPUT_ROOT}/provenance/vllm-source.commit"
|
git -C "${VLLM_SOURCE}" rev-parse HEAD > "${OUTPUT_ROOT}/provenance/vllm-source.commit"
|
||||||
sha256sum run_frontier_linear_full.sh \
|
sha256sum run_frontier_linear_full.sh frontier_vllm020_compat.py \
|
||||||
> "${OUTPUT_ROOT}/provenance/source.sha256"
|
> "${OUTPUT_ROOT}/provenance/source.sha256"
|
||||||
uv pip freeze --python "${VENV_ROOT}/bin/python" \
|
uv pip freeze --python "${VENV_ROOT}/bin/python" \
|
||||||
> "${OUTPUT_ROOT}/provenance/pip-freeze.txt"
|
> "${OUTPUT_ROOT}/provenance/pip-freeze.txt"
|
||||||
@@ -35,7 +36,7 @@ printf '%s\n' "${TOKENS[@]}" > "${OUTPUT_ROOT}/provenance/tokens.txt"
|
|||||||
|
|
||||||
cd "${FRONTIER_ROOT}"
|
cd "${FRONTIER_ROOT}"
|
||||||
timeout --signal=TERM --kill-after=30s 1380 \
|
timeout --signal=TERM --kill-after=30s 1380 \
|
||||||
"${VENV_ROOT}/bin/python" -m frontier.profiling.linear_op.main \
|
"${VENV_ROOT}/bin/python" "${RUN_DIR}/frontier_vllm020_compat.py" \
|
||||||
--disable_ray \
|
--disable_ray \
|
||||||
--num_gpus 1 \
|
--num_gpus 1 \
|
||||||
--output_dir "${OUTPUT_ROOT}/profiles" \
|
--output_dir "${OUTPUT_ROOT}/profiles" \
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ OUTPUT_ROOT="${OUTPUT_ROOT:?OUTPUT_ROOT must be set}"
|
|||||||
VENV_ROOT="${VENV_ROOT:-/tmp/wjh/venvs/vllm-0.20.0-cu129-profiler-v1}"
|
VENV_ROOT="${VENV_ROOT:-/tmp/wjh/venvs/vllm-0.20.0-cu129-profiler-v1}"
|
||||||
FRONTIER_ROOT="${FRONTIER_ROOT:-/home/admin/cpfs/wjh/frontier-qwen30-vllm020-profile-v1/Frontier}"
|
FRONTIER_ROOT="${FRONTIER_ROOT:-/home/admin/cpfs/wjh/frontier-qwen30-vllm020-profile-v1/Frontier}"
|
||||||
VLLM_SOURCE="${VLLM_SOURCE:-/home/admin/cpfs/wjh/agentic-kv/third_party/vllm_v20_build}"
|
VLLM_SOURCE="${VLLM_SOURCE:-/home/admin/cpfs/wjh/agentic-kv/third_party/vllm_v20_build}"
|
||||||
|
RUN_DIR="$(pwd -P)"
|
||||||
mkdir -p "${OUTPUT_ROOT}/logs" "${OUTPUT_ROOT}/provenance" "${OUTPUT_ROOT}/profiles"
|
mkdir -p "${OUTPUT_ROOT}/logs" "${OUTPUT_ROOT}/provenance" "${OUTPUT_ROOT}/profiles"
|
||||||
exec > >(tee -a "${OUTPUT_ROOT}/logs/smoke.log") 2>&1
|
exec > >(tee -a "${OUTPUT_ROOT}/logs/smoke.log") 2>&1
|
||||||
|
|
||||||
@@ -24,7 +25,7 @@ test "$(git -C "${VLLM_SOURCE}" rev-parse HEAD)" = "88d34c6409e9fb3c7b8ca0c04756
|
|||||||
git rev-parse HEAD > "${OUTPUT_ROOT}/provenance/aituner.commit"
|
git rev-parse HEAD > "${OUTPUT_ROOT}/provenance/aituner.commit"
|
||||||
git -C "${FRONTIER_ROOT}" rev-parse HEAD > "${OUTPUT_ROOT}/provenance/frontier.commit"
|
git -C "${FRONTIER_ROOT}" rev-parse HEAD > "${OUTPUT_ROOT}/provenance/frontier.commit"
|
||||||
git -C "${VLLM_SOURCE}" rev-parse HEAD > "${OUTPUT_ROOT}/provenance/vllm-source.commit"
|
git -C "${VLLM_SOURCE}" rev-parse HEAD > "${OUTPUT_ROOT}/provenance/vllm-source.commit"
|
||||||
sha256sum run_frontier_linear_smoke.sh \
|
sha256sum run_frontier_linear_smoke.sh frontier_vllm020_compat.py \
|
||||||
> "${OUTPUT_ROOT}/provenance/source.sha256"
|
> "${OUTPUT_ROOT}/provenance/source.sha256"
|
||||||
uv pip freeze --python "${VENV_ROOT}/bin/python" \
|
uv pip freeze --python "${VENV_ROOT}/bin/python" \
|
||||||
> "${OUTPUT_ROOT}/provenance/pip-freeze.txt"
|
> "${OUTPUT_ROOT}/provenance/pip-freeze.txt"
|
||||||
@@ -33,7 +34,7 @@ nvidia-smi --query-gpu=index,uuid,name,driver_version,memory.total \
|
|||||||
|
|
||||||
cd "${FRONTIER_ROOT}"
|
cd "${FRONTIER_ROOT}"
|
||||||
timeout --signal=TERM --kill-after=30s 780 \
|
timeout --signal=TERM --kill-after=30s 780 \
|
||||||
"${VENV_ROOT}/bin/python" -m frontier.profiling.linear_op.main \
|
"${VENV_ROOT}/bin/python" "${RUN_DIR}/frontier_vllm020_compat.py" \
|
||||||
--disable_ray \
|
--disable_ray \
|
||||||
--num_gpus 1 \
|
--num_gpus 1 \
|
||||||
--output_dir "${OUTPUT_ROOT}/profiles" \
|
--output_dir "${OUTPUT_ROOT}/profiles" \
|
||||||
|
|||||||
Reference in New Issue
Block a user