[ROCm] Stage large pageable H2D copies instead of registering them (#56343)

Signed-off-by: JohnQinAMD <yanyuan.qin@amd.com>
Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
Co-authored-by: Shanshan Shen <467638484@qq.com>
This commit is contained in:
JohnQinAMD
2026-09-17 07:14:43 +00:00
committed by GitHub
co-authored by Claude Opus 5 Shanshan Shen
parent b3079e6e46
commit 528fa835fd
+14
View File
@@ -21,6 +21,7 @@ from .interface import DeviceCapability, Platform, PlatformEnum, in_wsl
if TYPE_CHECKING:
from vllm.config import VllmConfig
from vllm.config.kernel import IrOpPriorityConfig
from vllm.utils.argparse_utils import FlexibleArgumentParser
from vllm.v1.attention.selector import AttentionSelectorConfig
logger = init_logger(__name__)
@@ -493,6 +494,9 @@ class RocmPlatform(Platform):
dist_backend: str = "nccl"
# rocm shares the same device control env var as CUDA
device_control_env_var: str = "CUDA_VISIBLE_DEVICES"
# Set in pre_register_and_update, so it exists only on the driver; Ray
# workers are separate processes and copy env vars by allowlist.
additional_env_vars: list[str] = ["GPU_PINNED_MIN_XFER_SIZE"]
ray_noset_device_env_vars: list[str] = [
"RAY_EXPERIMENTAL_NOSET_HIP_VISIBLE_DEVICES",
"RAY_EXPERIMENTAL_NOSET_CUDA_VISIBLE_DEVICES",
@@ -862,6 +866,16 @@ class RocmPlatform(Platform):
)
return torch.cuda.get_device_properties(device_id).total_memory
@classmethod
def pre_register_and_update(
cls, parser: "FlexibleArgumentParser | None" = None
) -> None:
# Keep mmap'd weight pages on the HIP staging path: above this
# threshold the runtime registers the pageable source instead, and each
# registration's MMU notifier makes KFD suspend our queues. In KB, so
# 4 GiB.
os.environ.setdefault("GPU_PINNED_MIN_XFER_SIZE", str(4 * 1024 * 1024))
@classmethod
def apply_config_platform_defaults(cls, vllm_config: "VllmConfig") -> None:
from vllm._aiter_ops import rocm_aiter_ops