Commit 3b85437
zhangyue
fix(pr66-review): address review findings 1-3
- `tests/test_add_rms_norm.py`: extend `implementation_index` parametrize
to `(0, 1, 2)`; add `_clear_add_rms_norm_cache` autouse fixture to
avoid cross-test state pollution in the custom AscendC kernel (impl 2)
whose cached fp32 weight buffer collides across tests with matching
shape/dtype keys. Coverage: +54 test cases (108 total, all green).
- `src/base/rotary_embedding.h`: assert `key.has_value()` with a TODO
noting MLA is not yet implemented on any Ascend backend. All three
impls already assert `has_key_` individually; hoisting the check to
base turns a silent crash (if a caller passes `key=None`) into a clean
assert. Keeps `std::optional<Tensor> key` in the signature for future
MLA support without breaking vLLM API compatibility.
- `src/ascend/causal_softmax/kernel.h`: add justification for the
3-primitive decomposition (no single CANN 8.5 API covers causal-mask
+ softmax; `aclnnSoftmaxV2` lacks the mask argument, and
`aclnnScaledMaskedSoftmax` requires a pre-scaled attention score), per
CLAUDE.md Ascend rule "never decompose when a fused API exists".
Verified: `pytest tests/test_{silu_and_mul,add_rms_norm,rotary_embedding,linear,causal_softmax}.py --devices ascend` → 349 passed, 4 skipped.1 parent 7210408 commit 3b85437
3 files changed
Lines changed: 31 additions & 7 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
20 | | - | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
21 | 26 | | |
22 | 27 | | |
23 | 28 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
47 | 47 | | |
48 | 48 | | |
49 | 49 | | |
50 | | - | |
51 | | - | |
52 | | - | |
53 | | - | |
54 | | - | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
55 | 60 | | |
56 | 61 | | |
57 | 62 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
8 | 22 | | |
9 | 23 | | |
10 | 24 | | |
| |||
18 | 32 | | |
19 | 33 | | |
20 | 34 | | |
21 | | - | |
| 35 | + | |
22 | 36 | | |
23 | 37 | | |
24 | 38 | | |
| |||
0 commit comments