Skip to content

Commit 6e9fabb

Browse files
authored
[BugFix] Fix duplicate symbol for custom QuantLightningIndexer operator (vllm-project#10744)
### What this PR does / why we need it? This PR fixes a duplicate symbol conflict between the custom AscendC operator and the torch-level ACLNN operator for `AclNNQuantLightningIndexer`. **Problem:** The custom operator defined in `csrc/attention/quant_lightning_indexer/` shared the same symbol name `AclNNQuantLightningIndexer` with the ACLNN operator invoked via `EXEC_NPU_CMD` in `csrc/torch_binding.cpp`. This caused a symbol duplication conflict during linking/compilation, preventing the custom operator from being registered and loaded correctly. **Solution:** Rename all custom operator symbols from `AclNNQuantLightningIndexer` → `AclNNQuantLightningIndexerCustom` to disambiguate from the torch-layer `aclnnQuantLightningIndexer`. The changes include: - **OpDef class**: `QuantLightningIndexer` → `QuantLightningIndexerCustom` - **Tiling class**: `QuantLightningIndexerTiling` → `QuantLightningIndexerCustomTiling` - **Kernel function**: `quant_lightning_indexer` → `quant_lightning_indexer_custom` - **CMake registration**: `OP_NAME` and `OPTYPE` updated to `QuantLightningIndexerCustom` / `quant_lightning_indexer_custom` - **File rename**: `quant_lightning_indexer_def.cpp` → `quant_lightning_indexer_custom_def.cpp` - **Template tiling key**: `ASCENDC_TPL_ARGS_DECL(QuantLightningIndexer` → `ASCENDC_TPL_ARGS_DECL(QuantLightningIndexerCustom` - **Torch binding**: `aclnnQuantLightningIndexer` → `aclnnQuantLightningIndexerCustom` All `OP_LOGD`/`OP_LOGE` log tags are also updated accordingly for consistent debugging. ### Does this PR introduce _any_ user-facing change? No. This is a purely internal renaming of operator symbols. The external API and behavior remain unchanged. ### How was this patch tested? - vLLM version: v0.22.1 - vLLM main: vllm-project/vllm@967c5c3 Signed-off-by: Li Jiahang <216526138+lijiahang226@users.noreply.github.com>
1 parent 07aedaa commit 6e9fabb

28 files changed

Lines changed: 43 additions & 43 deletions

csrc/attention/quant_lightning_indexer/CMakeLists.txt renamed to csrc/attention/quant_lightning_indexer_custom/CMakeLists.txt

File renamed without changes.
File renamed without changes.

csrc/attention/quant_lightning_indexer/op_host/CMakeLists.txt renamed to csrc/attention/quant_lightning_indexer_custom/op_host/CMakeLists.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,12 @@ add_op_to_compiled_list()
1111

1212
if (BUILD_OPEN_PROJECT)
1313
target_sources(op_host_aclnn PRIVATE
14-
quant_lightning_indexer_def.cpp
14+
quant_lightning_indexer_custom_def.cpp
1515
)
1616
endif()
1717

1818
add_ops_compile_options(
19-
OP_NAME QuantLightningIndexer
19+
OP_NAME QuantLightningIndexerCustom
2020
OPTIONS --cce-auto-sync=off
2121
-Wno-deprecated-declarations
2222
-Werror
@@ -25,5 +25,5 @@ add_ops_compile_options(
2525
)
2626

2727
if (NOT BUILD_OPS_RTY_KERNEL)
28-
add_modules_sources(OPTYPE quant_lightning_indexer ACLNNTYPE aclnn)
28+
add_modules_sources(OPTYPE quant_lightning_indexer_custom ACLNNTYPE aclnn)
2929
endif()

csrc/attention/quant_lightning_indexer/op_host/quant_lightning_indexer_def.cpp renamed to csrc/attention/quant_lightning_indexer_custom/op_host/quant_lightning_indexer_custom_def.cpp

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,24 @@
11
/**
2-
 * Copyright (c) 2026 Huawei Technologies Co., Ltd.
3-
 * This program is free software, you can redistribute it and/or modify it under the terms and conditions of
4-
 * CANN Open Software License Agreement Version 2.0 (the "License").
5-
 * Please refer to the License for details. You may not use this file except in compliance with the License.
6-
 * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED,
7-
 * INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE.
8-
 * See LICENSE in the root of the software repository for the full text of the License.
9-
 */
2+
* Copyright (c) 2026 Huawei Technologies Co., Ltd.
3+
* This program is free software, you can redistribute it and/or modify it under the terms and conditions of
4+
* CANN Open Software License Agreement Version 2.0 (the "License").
5+
* Please refer to the License for details. You may not use this file except in compliance with the License.
6+
* THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED,
7+
* INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE.
8+
* See LICENSE in the root of the software repository for the full text of the License.
9+
*/
1010

1111
/*!
12-
* \file quant_lightning_indexer_def.cpp
12+
* \file quant_lightning_indexer_custom_def.cpp
1313
* \brief
1414
*/
1515

1616
#include "register/op_def_registry.h"
1717

1818
namespace ops {
19-
class QuantLightningIndexer : public OpDef {
19+
class QuantLightningIndexerCustom : public OpDef {
2020
public:
21-
explicit QuantLightningIndexer(const char *name) : OpDef(name)
21+
explicit QuantLightningIndexerCustom(const char *name) : OpDef(name)
2222
{
2323
this->Input("query")
2424
.ParamType(REQUIRED)
@@ -149,5 +149,5 @@ class QuantLightningIndexer : public OpDef {
149149
this->AICore().AddConfig("ascend950", aicore_config_950);
150150
}
151151
};
152-
OP_ADD(QuantLightningIndexer);
152+
OP_ADD(QuantLightningIndexerCustom);
153153
} // namespace ops

csrc/attention/quant_lightning_indexer/op_host/quant_lightning_indexer_infershape.cpp renamed to csrc/attention/quant_lightning_indexer_custom/op_host/quant_lightning_indexer_infershape.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ constexpr uint32_t DIM_NUM_4 = 4;
3333
static ge::graphStatus InferShapeQuantLightningIndexer(gert::InferShapeContext *context)
3434
{
3535
if (context == nullptr) {
36-
OP_LOGE("QuantLightningIndexer", "context is nullptr!");
36+
OP_LOGE("QuantLightningIndexerCustom", "context is nullptr!");
3737
return ge::GRAPH_FAILED;
3838
}
3939
const gert::Shape *queryShape = context->GetInputShape(QUERY_INDEX);
@@ -82,25 +82,25 @@ static ge::graphStatus InferShapeQuantLightningIndexer(gert::InferShapeContext *
8282
sparseValuesShape->SetDim(0, 0);
8383
}
8484

85-
OP_LOGD(context->GetNodeName(), "QuantLightningIndexer InferShape end.");
85+
OP_LOGD(context->GetNodeName(), "QuantLightningIndexerCustom InferShape end.");
8686
return ge::GRAPH_SUCCESS;
8787
}
8888

8989
static ge::graphStatus InferDataTypeQuantLightningIndexer(gert::InferDataTypeContext *context)
9090
{
9191
if (context == nullptr) {
92-
OP_LOGE("QuantLightningIndexer", "InferDataTypeContext context is nullptr!");
92+
OP_LOGE("QuantLightningIndexerCustom", "InferDataTypeContext context is nullptr!");
9393
return ge::GRAPH_FAILED;
9494
}
95-
OP_LOGD(context->GetNodeName(), "Enter QuantLightningIndexer InferDataType impl.");
95+
OP_LOGD(context->GetNodeName(), "Enter QuantLightningIndexerCustom InferDataType impl.");
9696
// default index data type is int32
9797
ge::DataType outputType = ge::DT_INT32;
9898
context->SetOutputDataType(0, outputType);
99-
OP_LOGD(context->GetNodeName(), "QuantLightningIndexer InferDataType end.");
99+
OP_LOGD(context->GetNodeName(), "QuantLightningIndexerCustom InferDataType end.");
100100
return GRAPH_SUCCESS;
101101
}
102102

103-
IMPL_OP_INFERSHAPE(QuantLightningIndexer)
103+
IMPL_OP_INFERSHAPE(QuantLightningIndexerCustom)
104104
.InferShape(InferShapeQuantLightningIndexer)
105105
.InferDataType(InferDataTypeQuantLightningIndexer);
106106
} // namespace ops

csrc/attention/quant_lightning_indexer/op_host/quant_lightning_indexer_tiling.cpp renamed to csrc/attention/quant_lightning_indexer_custom/op_host/quant_lightning_indexer_tiling.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ ge::graphStatus QLIInfoParser::CheckRequiredParaExistence() const
8585
ge::graphStatus QLIInfoParser::GetOpName()
8686
{
8787
if (context_->GetNodeName() == nullptr) {
88-
OP_LOGE("QuantLightningIndexer", "opName got from TilingContext is nullptr");
88+
OP_LOGE("QuantLightningIndexerCustom", "opName got from TilingContext is nullptr");
8989
return ge::GRAPH_FAILED;
9090
}
9191
opName_ = context_->GetNodeName();
@@ -849,8 +849,8 @@ static ge::graphStatus TilingPrepareForQuantLightningIndexer(gert::TilingParseCo
849849
return ge::GRAPH_SUCCESS;
850850
}
851851

852-
// --------------------------QuantLightningIndexerTiling类成员函数定义-----------------------
853-
ge::graphStatus QuantLightningIndexerTiling::DoTiling(QLITilingInfo *tilingInfo)
852+
// --------------------------QuantLightningIndexerCustomTiling类成员函数定义-----------------------
853+
ge::graphStatus QuantLightningIndexerCustomTiling::DoTiling(QLITilingInfo *tilingInfo)
854854
{
855855
// -------------set blockdim-----------------
856856
auto ascendcPlatform = platform_ascendc::PlatformAscendC(tilingInfo->platformInfo);
@@ -929,19 +929,19 @@ ge::graphStatus QuantLightningIndexerTiling::DoTiling(QLITilingInfo *tilingInfo)
929929
// --------------------------Tiling函数定义---------------------------
930930
ge::graphStatus TilingForQuantLightningIndexer(gert::TilingContext *context)
931931
{
932-
OP_CHECK_IF(context == nullptr, OP_LOGE("QuantLightningIndexer", "Tiling context is null."),
932+
OP_CHECK_IF(context == nullptr, OP_LOGE("QuantLightningIndexerCustom", "Tiling context is null."),
933933
return ge::GRAPH_FAILED);
934934
QLITilingInfo QLIInfo;
935935
QLIInfoParser QLIInfoParser(context);
936936
if (QLIInfoParser.ParseAndCheck(QLIInfo) != ge::GRAPH_SUCCESS) {
937937
return ge::GRAPH_FAILED;
938938
}
939-
QuantLightningIndexerTiling QLITiling(context);
939+
QuantLightningIndexerCustomTiling QLITiling(context);
940940
return QLITiling.DoTiling(&QLIInfo);
941941
}
942942

943943
// --------------------------Tiling及函数TilingPrepare函数注册--------
944-
IMPL_OP_OPTILING(QuantLightningIndexer)
944+
IMPL_OP_OPTILING(QuantLightningIndexerCustom)
945945
.Tiling(TilingForQuantLightningIndexer)
946946
.TilingParse<QLICompileInfo>(TilingPrepareForQuantLightningIndexer);
947947

csrc/attention/quant_lightning_indexer/op_host/quant_lightning_indexer_tiling.h renamed to csrc/attention/quant_lightning_indexer_custom/op_host/quant_lightning_indexer_tiling.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ TILING_DATA_FIELD_DEF(uint32_t, returnValues)
103103
TILING_DATA_FIELD_DEF(int64_t, stride)
104104
TILING_DATA_FIELD_DEF(int64_t, scaleStride)
105105
END_TILING_DATA_DEF
106-
REGISTER_TILING_DATA_CLASS(QuantLightningIndexer, QLITilingData)
106+
REGISTER_TILING_DATA_CLASS(QuantLightningIndexerCustom, QLITilingData)
107107

108108
// -----------算子CompileInfo定义-------------------
109109
struct QLICompileInfo {};
@@ -249,9 +249,9 @@ class QLIInfoParser {
249249
};
250250

251251
// ---------------算子Tiling类---------------
252-
class QuantLightningIndexerTiling {
252+
class QuantLightningIndexerCustomTiling {
253253
public:
254-
explicit QuantLightningIndexerTiling(gert::TilingContext *context) : context_(context) {};
254+
explicit QuantLightningIndexerCustomTiling(gert::TilingContext *context) : context_(context) {};
255255
ge::graphStatus DoTiling(QLITilingInfo *tilingInfo);
256256

257257
private:

csrc/attention/quant_lightning_indexer/op_kernel/arch32/quant_lightning_indexer_common.h renamed to csrc/attention/quant_lightning_indexer_custom/op_kernel/arch32/quant_lightning_indexer_common.h

File renamed without changes.

csrc/attention/quant_lightning_indexer/op_kernel/arch32/quant_lightning_indexer_kernel.h renamed to csrc/attention/quant_lightning_indexer_custom/op_kernel/arch32/quant_lightning_indexer_kernel.h

File renamed without changes.

csrc/attention/quant_lightning_indexer/op_kernel/arch32/quant_lightning_indexer_service_cube.h renamed to csrc/attention/quant_lightning_indexer_custom/op_kernel/arch32/quant_lightning_indexer_service_cube.h

File renamed without changes.

0 commit comments

Comments
 (0)