Skip to content

Commit bdc1523

Browse files
vladimirevmenoffVladimir EvmenovTflowers-0129
authored
[Ops][Feature] Add Ascend 310P support for chunk_gated_delta_rule_fwd_h and chunk_fwd_o (vllm-project#9458)
## Summary - Ports chunk_gated_delta_rule_fwd_h (gated delta rule forward for DeltaNet/Qwen3) from 910B to 310P - Ports chunk_fwd_o to 310p - All 310P changes gated by #ifdef CATLASS_UNIFIED_CORE — 910B code unchanged - Unified-core execution path (sequential cube→vector, no AIC/AIV split) - L0C→UB→GM bridge: BLOCK_MODE_MATRIX + fractal-by-fractal strided DataCopy (no Fixpipe on 310P) - CAST_RINT→CAST_NONE for float→half (CAST_RINT silently produces zeros on 310P) - DataCopyPad→DataCopy (DataCopyPad unsupported on 310P) - compat_310p.h: dummy bfloat16_t (310P only), PIPE_FIX→PIPE_MTE3, LoadDataWithSparse shim - Preserves original 8 dtype combos (bf16+fp16) for 910B/910C compatibility ## Test plan - [x] Precision test via ctypes (test_aclnn_ctypes.py): all outputs cos>=0.999998 on 310P3 - [x] Python API test (test_npu_chunk_gdr.py): 4 shapes PASS - [x] ruff check: PASS - [x] format.sh ci: PASS <img width="1463" height="541" alt="Screenshot 2026-05-25 at 11 52 28" src="https://github.com/user-attachments/assets/d56838c7-e81b-4123-afcb-861599c08dae" /> - vLLM version: v0.22.1 - vLLM main: vllm-project/vllm@967c5c3 --------- Signed-off-by: Vladimir Evmenov <evmenoff@Vladimirs-MacBook-Air.local> Signed-off-by: Vladimir Evmenov <vladimir.evmenov.jr@gmail.com> Signed-off-by: Tflowers-0129 <2906339855@qq.com> Co-authored-by: Vladimir Evmenov <evmenoff@Vladimirs-MacBook-Air.local> Co-authored-by: Tflowers-0129 <2906339855@qq.com>
1 parent c45b4ac commit bdc1523

46 files changed

Lines changed: 3851 additions & 37 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/_e2e_nightly_single_node.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,7 @@ jobs:
124124
ref: ${{ inputs.vllm_ascend_ref }}
125125
path: ./temp-vllm-ascend
126126
fetch-depth: 1
127+
submodules: recursive
127128

128129
- name: Move code to /vllm-workspace
129130
if: ${{ inputs.request_id != '' }}

.github/workflows/_e2e_nightly_single_node_models.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,7 @@ jobs:
112112
ref: ${{ inputs.vllm_ascend_ref }}
113113
path: ./temp-vllm-ascend
114114
fetch-depth: 1
115+
submodules: recursive
115116

116117
- name: Move vllm-ascend code to /vllm-workspace
117118
if: ${{ inputs.request_id != '' }}

.github/workflows/_schedule_image_build.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,20 +140,23 @@ jobs:
140140
- uses: actions/checkout@v7
141141
if: ${{ github.event_name != 'workflow_dispatch' }}
142142
with:
143+
submodules: recursive
143144
fetch-depth: 0
144145
persist-credentials: false
145146
ref: ${{ inputs.branch_ref }}
146147

147148
- uses: actions/checkout@v7
148149
if: ${{ github.event_name == 'workflow_dispatch' && inputs.workflow_dispatch_tag != '' }}
149150
with:
151+
submodules: recursive
150152
fetch-depth: 0
151153
persist-credentials: false
152154
ref: ${{ inputs.workflow_dispatch_tag }}
153155

154156
- uses: actions/checkout@v7
155157
if: ${{ github.event_name == 'workflow_dispatch' && inputs.workflow_dispatch_tag == '' && inputs.vllm_ascend_commit == '' }}
156158
with:
159+
submodules: recursive
157160
fetch-depth: 0
158161
persist-credentials: false
159162
ref: ${{ inputs.branch_ref }}
@@ -299,12 +302,14 @@ jobs:
299302
uses: actions/checkout@v7
300303
if: ${{ github.event_name != 'workflow_dispatch' || (github.event_name == 'workflow_dispatch' && inputs.workflow_dispatch_tag == '') }}
301304
with:
305+
submodules: recursive
302306
ref: ${{ inputs.branch_ref }}
303307

304308
- name: Checkout tag
305309
uses: actions/checkout@v7
306310
if: ${{ github.event_name == 'workflow_dispatch' && inputs.workflow_dispatch_tag != '' }}
307311
with:
312+
submodules: recursive
308313
ref: ${{ inputs.workflow_dispatch_tag }}
309314

310315
- name: Download arm64 digests

.github/workflows/_selected_tests.yaml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,7 @@ jobs:
110110
with:
111111
ref: ${{ inputs.ref || github.ref }}
112112
fetch-depth: 0
113+
submodules: recursive
113114

114115
- name: Rebase on latest main
115116
run: |
@@ -203,6 +204,22 @@ jobs:
203204
vllm_ascend/include
204205
key: vllm-ascend-build-v1-${{ steps.get_arch.outputs.arch }}-${{ matrix.group.image_tag }}-${{ steps.get_csrc_hash.outputs.CSRC_HASH }}
205206

207+
- name: Verify required AscendC custom ops are registered (310p)
208+
if: ${{ matrix.group.npu_type == '310p' }}
209+
run: |
210+
python - <<'PY'
211+
import sys, torch
212+
import vllm_ascend.vllm_ascend_C # noqa: F401
213+
ops = torch.ops._C_ascend
214+
missing = [n for n in ("chunk_gated_delta_rule_fwd_h", "chunk_fwd_o") if not hasattr(ops, n)]
215+
if missing:
216+
print(f"::error::Missing AscendC ops after install: {missing}. "
217+
f"Cache contents are stale or build skipped registration.", file=sys.stderr)
218+
sys.exit(1)
219+
print("AscendC chunk-gdr ops registered:",
220+
[n for n in ("chunk_gated_delta_rule_fwd_h", "chunk_fwd_o") if hasattr(ops, n)])
221+
PY
222+
206223
- name: Install vllm-project/vllm-ascend no device
207224
if: ${{ matrix.group.npu_type == 'cpu' }}
208225
env:

.github/workflows/push_build_csrc_cache.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,8 @@ jobs:
102102
steps:
103103
- name: Checkout repo
104104
uses: actions/checkout@v7
105+
with:
106+
submodules: recursive
105107

106108
- name: Config mirrors (ubuntu)
107109
if: matrix.os == 'ubuntu'

.github/workflows/schedule_release_code_and_wheel.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,11 +49,14 @@ jobs:
4949
- name: checkout vllm-ascend
5050
if: ${{ github.event_name != 'workflow_dispatch' }}
5151
uses: actions/checkout@v7
52+
with:
53+
submodules: recursive
5254

5355
- name: checkout vllm-ascend ${{ inputs.tag }}
5456
if: ${{ github.event_name == 'workflow_dispatch' }}
5557
uses: actions/checkout@v7
5658
with:
59+
submodules: recursive
5760
ref: ${{ inputs.tag }}
5861

5962
- name: Print
@@ -99,11 +102,14 @@ jobs:
99102
- name: checkout vllm-ascend
100103
if: ${{ github.event_name != 'workflow_dispatch' }}
101104
uses: actions/checkout@v7
105+
with:
106+
submodules: recursive
102107

103108
- name: checkout vllm-ascend ${{ inputs.tag }}
104109
if: ${{ github.event_name == 'workflow_dispatch' }}
105110
uses: actions/checkout@v7
106111
with:
112+
submodules: recursive
107113
ref: ${{ inputs.tag }}
108114

109115
- name: Free up disk space
@@ -183,11 +189,14 @@ jobs:
183189
- name: checkout vllm-ascend
184190
if: ${{ github.event_name != 'workflow_dispatch' }}
185191
uses: actions/checkout@v7
192+
with:
193+
submodules: recursive
186194

187195
- name: checkout vllm-ascend ${{ inputs.tag }}
188196
if: ${{ github.event_name == 'workflow_dispatch' }}
189197
uses: actions/checkout@v7
190198
with:
199+
submodules: recursive
191200
ref: ${{ inputs.tag }}
192201

193202
- name: Free up disk space
@@ -261,11 +270,14 @@ jobs:
261270
- name: checkout vllm-ascend
262271
if: ${{ github.event_name != 'workflow_dispatch' }}
263272
uses: actions/checkout@v7
273+
with:
274+
submodules: recursive
264275

265276
- name: checkout vllm-ascend ${{ inputs.tag }}
266277
if: ${{ github.event_name == 'workflow_dispatch' }}
267278
uses: actions/checkout@v7
268279
with:
280+
submodules: recursive
269281
ref: ${{ inputs.tag }}
270282

271283
- name: Free up disk space

csrc/build_aclnn.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,8 @@ if [[ "$SOC_VERSION" =~ ^ascend310 ]]; then
5757
CUSTOM_OPS_ARRAY=(
5858
"causal_conv1d_v310"
5959
"recurrent_gated_delta_rule_v310"
60+
"chunk_fwd_o"
61+
"chunk_gated_delta_rule_fwd_h"
6062
)
6163
CUSTOM_OPS=$(IFS=';'; echo "${CUSTOM_OPS_ARRAY[*]}")
6264
SOC_ARG="ascend310p"

csrc/moe/chunk_fwd_o/op_host/chunk_fwd_o_def.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@ class ChunkFwdO : public OpDef {
9696
this->AICore().AddConfig("ascend910b", aicore_config);
9797
this->AICore().AddConfig("ascend910_93", aicore_config);
9898
this->AICore().AddConfig("ascend950", aicore_config);
99+
this->AICore().AddConfig("ascend310p", aicore_config);
99100
}
100101
};
101102

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
#ifndef COMPAT_310P_H
2+
#define COMPAT_310P_H
3+
4+
#ifndef __CCE_KT_TEST__
5+
#include "kernel_operator.h"
6+
#endif
7+
8+
// Dummy bfloat16_t only needed on 310P (dav_m200) where the compiler
9+
// doesn't provide a native bf16 type. On 910B/910C the compiler's
10+
// __clang_cce_types.h already typedefs bfloat16_t from __bf16.
11+
#if defined(__CCE_AICORE__) && (__CCE_AICORE__ == 200) && !defined(__bfloat16_t_defined)
12+
#define __bfloat16_t_defined
13+
#define __COMPAT_310P_ACTIVE__
14+
struct bfloat16_t {
15+
uint16_t val;
16+
bfloat16_t() = default;
17+
bfloat16_t(float v) : val(0) { (void)v; }
18+
operator float() const { return 0.f; }
19+
};
20+
#endif
21+
22+
// 310P has no fixpipe unit; post-matmul stores go through MTE3
23+
#ifndef PIPE_FIX
24+
#define PIPE_FIX PIPE_MTE3
25+
#endif
26+
27+
// 310P renames LoadDataWithSparse → LoadDataWithSparseCal
28+
#ifdef __COMPAT_310P_ACTIVE__
29+
#define LoadDataWithSparse LoadDataWithSparseCal
30+
#endif
31+
32+
// 310P has no AscendC::ToFloat — dummy bfloat16_t already has operator float()
33+
#ifdef __COMPAT_310P_ACTIVE__
34+
namespace AscendC {
35+
inline float ToFloat(bfloat16_t v) { return (float)v; }
36+
}
37+
#endif
38+
39+
#endif

0 commit comments

Comments
 (0)