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
56 changes: 23 additions & 33 deletions docs_roll/docs/User Guides/Hardware Support/ascend_usage.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# ROLL x Ascend

Last updated: 09/28/2025.
Last updated: 11/25/2025.

We have added support for Huawei Ascend devices in ROLL.

## Hardware Support
## Hardware Support

Atlas 900 A2 PODc

Expand All @@ -14,15 +14,15 @@ Atlas 900 A2 PODc

| Software | Version |
| -------- | ------- |
| Python | 3.10 |
| CANN | 8.1.RC1 |
| Python | 3.11 |
| CANN | 8.3.RC1 |

### Create Conda Environment

Use the following commands to create a new conda environment in Miniconda:

```
conda create --name roll python=3.10
conda create --name roll python=3.11
conda activate roll
```

Expand All @@ -31,11 +31,11 @@ conda activate roll
To use torch and torch_npu in ROLL, install them using the commands below:

```
# Install CPU version of torch
pip install torch==2.5.1 torchvision==0.20.1 torchaudio==2.5.1 --index-url https://download.pytorch.org/whl/cpu
# Use CPU only torch
pip install torch==2.7.1 torchvision==0.22.1 torchaudio==2.7.1 --index-url https://download.pytorch.org/whl/cpu

# Install torch_npu
pip install torch_npu==2.5.1
# Install torch_npu 2.7.1
pip install torch_npu==2.7.1
```

### Install vllm & vllm-ascend
Expand All @@ -44,37 +44,28 @@ To use vllm in ROLL, compile and install vllm and vllm-ascend as follows:

```
# vllm
git clone -b v0.8.4 --depth 1 https://github.com/vllm-project/vllm.git
git clone -b v0.11.0 --depth 1 https://github.com/vllm-project/vllm.git
cd vllm
pip install -r requirements/build.txt

VLLM_TARGET_DEVICE=empty pip install -v -e .
cd ..

# vllm-ascend
git clone -b v0.8.4rc2 --depth 1 https://github.com/vllm-project/vllm-ascend.git
git clone -b v0.11.0rc1 --depth 1 https://github.com/vllm-project/vllm-ascend.git
cd vllm-ascend

export COMPILE_CUSTOM_KERNELS=1
pip install -e .
cd ..
```

If you encounter an error like this during the vllm-ascend installation:

```
RuntimeError: CMake configuration failed: Command '['/pathto/miniconda3/envs/roll/bin/python3.10', '-m', 'pybind11', '--cmake']' returned non-zero exit status 2.
Or you could install `vllm` and `vllm-ascend` from pre-built wheel:
```
# Install vllm-project/vllm. The newest supported version is v0.11.0.
pip install vllm==0.11.0

Try modifying lines 151–158 in `setup.py` under the vllm-ascend directory as follows, then recompile:

```
try:
# if pybind11 is installed via pip
pybind11_cmake_path = (subprocess.check_output(
[python_executable, "-m", "pybind11",
"--cmakedir"]).decode().strip())
except subprocess.CalledProcessError as e:
# else specify pybind11 path installed from source code on CI container
raise RuntimeError(f"CMake configuration failed: {e}")
# Install vllm-project/vllm-ascend from pypi.
pip install vllm-ascend==0.11.0rc1
```

### Install ROLL
Expand All @@ -83,24 +74,24 @@ except subprocess.CalledProcessError as e:
git clone https://github.com/alibaba/ROLL.git
cd ROLL
pip install -r requirements_common.txt
pip install deepspeed==0.16.0
pip install deepspeed==0.16.4
cd ..
```

### Additional Third-Party Libraries

| Software | Description |
| --------------------------- | ------------- |
| transformers | v4.52.4 |
| transformers | >= v4.57.1 |
| flash_attn | not supported |
| transformer-engine[pytorch] | not supported |

1. `transformers` v4.52.4 supports enabling `--flash_attention_2`.
2. `flash_attn` acceleration is not supported.
1. `transformers` v4.57.1 supports enabling `--flash_attention_2`.
2. `flash_attn` acceleration is not supported currently.
3. `transformer-engine[pytorch]` is currently not supported.

```
pip install transformers==4.52.4
pip install transformers==4.57.1
```

## Quick Start: Single-Node Deployment
Expand All @@ -118,7 +109,6 @@ bash examples/agentic_demo/run_agentic_pipeline_frozen_lake_single_node_demo.sh

```
# Make sure you are in the root directory of the ROLL project
# export PYTHONPATH=$(pwd):$PYTHONPATH

python examples/start_agentic_pipeline.py \
--config_path qwen2.5-0.5B-agentic \
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# ROLL x Ascend

Last updated: 09/28/2025.
Last updated: 11/25/2025.

我们在 ROLL 上增加对华为昇腾设备的支持。

Expand All @@ -16,16 +16,16 @@ Atlas 900 A2 PODc

| software | version |
|-----------|-------------|
| Python | 3.10 |
| CANN | 8.1.RC1 |
| Python | 3.11 |
| CANN | 8.3.RC1 |

### 创建 conda 环境


使用以下命令在 Miniconda 中创建新的 conda 环境:

```
conda create --name roll python=3.10
conda create --name roll python=3.11
conda activate roll
```

Expand All @@ -36,10 +36,10 @@ conda activate roll

```
# 安装 torch 的 CPU 版本
pip install torch==2.5.1 torchvision==0.20.1 torchaudio==2.5.1 --index-url https://download.pytorch.org/whl/cpu
pip install torch==2.7.1 torchvision==0.22.1 torchaudio==2.7.1 --index-url https://download.pytorch.org/whl/cpu

# 安装 torch_npu
pip install torch_npu==2.5.1
pip install torch_npu==2.7.1
```


Expand All @@ -49,40 +49,28 @@ pip install torch_npu==2.5.1

```
# vllm
git clone -b v0.8.4 --depth 1 https://github.com/vllm-project/vllm.git
git clone -b v0.11.0 --depth 1 https://github.com/vllm-project/vllm.git
cd vllm
pip install -r requirements/build.txt

VLLM_TARGET_DEVICE=empty pip install -v -e .
cd ..
```

```
# vllm-ascend
git clone -b v0.8.4rc2 --depth 1 https://github.com/vllm-project/vllm-ascend.git
git clone -b v0.11.0rc1 --depth 1 https://github.com/vllm-project/vllm-ascend.git
cd vllm-ascend

export COMPILE_CUSTOM_KERNELS=1
pip install -e .
cd ..
```

如果在安装 vllm-ascend 时遇到类似以下问题:

```
RuntimeError: CMake configuration failed: Command '['/pathto/miniconda3/envs/roll/bin/python3.10', '-m', 'pybind11', '--cmake']' returned non-zero exit status 2.
或者可以从预编译的 wheel 包安装 `vllm` 和 `vllm-ascend`:
```
# Install vllm-project/vllm. The newest supported version is v0.11.0.
pip install vllm==0.11.0

可尝试在 vllm-ascend 目录下 setup.py 文件 151-158 行进行如下修改并重新进行编译:

```
try:
# if pybind11 is installed via pip
pybind11_cmake_path = (subprocess.check_output(
[python_executable, "-m", "pybind11",
"--cmakedir"]).decode().strip())
except subprocess.CalledProcessError as e:
# else specify pybind11 path installed from source code on CI container
raise RuntimeError(f"CMake configuration failed: {e}")
# Install vllm-project/vllm-ascend from pypi.
pip install vllm-ascend==0.11.0rc1
```

### 安装 ROLL
Expand All @@ -91,24 +79,24 @@ except subprocess.CalledProcessError as e:
git clone https://github.com/alibaba/ROLL.git
cd ROLL
pip install -r requirements_common.txt
pip install deepspeed==0.16.0
pip install deepspeed==0.16.4
cd ..
```

### 其他三方库说明

| software | description |
| software | description |
|-------------------------------|---------------|
| transformers | v4.52.4 |
| transformers | >= v4.57.1 |
| flash_attn | not supported |
| transformer-engine[pytorch] | not supported |

1. 支持通过 transformers 使能 --flash_attention_2, transformers 需等于 4.52.4版本
1. 支持通过 transformers 使能 --flash_attention_2, transformers 需大于等于 4.57.1 版本
2. 不支持通过 flash_attn 使能 flash attention 加速。
3. 暂不支持 transformer-engine[pytorch]

```
pip install transformers==4.52.4
pip install transformers==4.57.1
```

## 快速开始,单节点部署指引
Expand All @@ -127,7 +115,6 @@ bash examples/agentic_demo/run_agentic_pipeline_frozen_lake_single_node_demo.sh

```
# 确保当前位于ROLL项目目录的根目录下
# export PYTHONPATH=$(pwd):$PYTHONPATH

python examples/start_agentic_pipeline.py \
--config_path qwen2.5-0.5B-agentic \
Expand Down
28 changes: 20 additions & 8 deletions roll/third_party/vllm/vllm_0_11_0/ray_distributed_executor.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,14 +112,26 @@ def _init_workers_ray(self, placement_group: "PlacementGroup",
runtime_env = RuntimeEnv(env_vars=env_vars)
assert current_platform.ray_device_key == "GPU"
# NV+AMD GPUs, and Intel XPUs
worker = ray.remote(
num_cpus=0,
num_gpus=0.01,
runtime_env=runtime_env,
scheduling_strategy=PlacementGroupSchedulingStrategy(placement_group=pg, ),
**ray_remote_kwargs,
)(RayWorkerWrapper).remote(vllm_config=self.vllm_config,
rpc_rank=rank)
if current_platform.ray_device_key == "GPU":
worker = ray.remote(
num_cpus=0,
num_gpus=0.01,
runtime_env=runtime_env,
scheduling_strategy=PlacementGroupSchedulingStrategy(placement_group=pg, ),
**ray_remote_kwargs,
)(RayWorkerWrapper).remote(vllm_config=self.vllm_config,
rpc_rank=rank)
else:
worker = ray.remote(
num_cpus=0,
num_gpus=0,
runtime_env=runtime_env,
resources={current_platform.ray_device_key: 0.01},
scheduling_strategy=PlacementGroupSchedulingStrategy(placement_group=pg, ),
**ray_remote_kwargs,
)(RayWorkerWrapper).remote(vllm_config=self.vllm_config,
rpc_rank=rank)

worker_metadata.append(
RayWorkerMetaData(worker=worker, created_rank=rank))

Expand Down
4 changes: 3 additions & 1 deletion roll/third_party/vllm/vllm_0_11_0/v1/worker.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
from collections import OrderedDict

import torch
from vllm.v1.worker.gpu_worker import Worker

from roll.platforms import current_platform
from roll.third_party.vllm.vllm_utils import TensorLoRARequest, patch_vllm_lora_manager
from roll.third_party.vllm.worker_helper import WorkerHelper
from roll.utils.logging import get_logger
Expand All @@ -13,6 +13,8 @@

logger = get_logger()

Worker = current_platform.get_vllm_worker_class()


class Worker0110(WorkerHelper, Worker):
def __init__(self, *args, **kwargs):
Expand Down
2 changes: 1 addition & 1 deletion roll/utils/context_parallel/monkey_patch.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from roll.utils.packages import is_transformers_version_greater_than


logger = get_logger(__name__)
logger = get_logger()
Comment thread
lowdy1 marked this conversation as resolved.


old_flash_attention_forward = ALL_ATTENTION_FUNCTIONS["flash_attention_2"]
Expand Down