Skip to content

[Bug]: 310P 布尔掩码 index_put_ 导致设备上下文崩溃(aicpu 错误 507018) #153

Description

@ash934141435

环境信息

  • 硬件:Atlas 310P(单卡,驱动 固件 24.1.t35 )

  • CANN:9.1.0-beta.1(镜像 quay.io/ascend/vllm-ascend:v0.23.0rc1-310p 内置)

  • torch:2.10.0+cpu

  • torch_npu:2.10.0.post2

  • 操作系统/架构:ubuntu22.04 上述容器镜像内

问题描述

Ascend 310P 上,布尔掩码 index_put_(即 x[bool_mask] = values)会使

NPU 设备上下文崩溃,报 aicpu 错误 507018

出错的是底层 aicpu IndexPut内核;一旦触发,设备上下文被污染,后续所有算子都会失败。这一问题导致 vLLM推理服务中所有多模态(图像)请

求崩溃(vllm-ascend issue #12086)vllm-project/vllm-ascend#12086

因为视觉embedding 合并用的正是布尔掩码赋值。

最小复现

import torch, torch_npu



x = torch.zeros(171, 2048, dtype=torch.float16).npu()

mask = torch.zeros(171, dtype=torch.bool).npu()

mask[10:30] = True

vals = torch.randn(20, 2048, dtype=torch.float16).npu()

x[mask] = vals            # NPU 上的布尔掩码 index_put_

torch.npu.synchronize()

实际报错:


RuntimeError: npuSynchronizeDevice:.../torch_npu/csrc/core/npu/NPUStream.cpp:576

NPU function error: AclrtSynchronizeDeviceWithTimeout, error code is 507018

[Error]: The aicpu execution is abnormal.

测试矩阵

每个用例均在独立子进程中执行。

用例 结果
掩码在 NPU:x[mask] = vals 失败(错误码 507018
掩码在 CPU:x[mask] = vals 失败(错误码 507018
整数索引:x.index_copy_(0, idx, vals) 正常,可作为临时绕过方案

期望行为

布尔掩码 index_put_ 应当与 x.index_copy_(0, mask.nonzero()[0], vals) 结果一致,

且不应使设备上下文崩溃——在 CUDA 上(以及推测在 A2/A3 上)行为是正常的。

补充说明

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions