Skip to content

Conversation

@wangqiankun13
Copy link

@wangqiankun13 wangqiankun13 commented Nov 27, 2025

What this PR does / why we need it?

Does this PR introduce any user-facing change?

How was this patch tested?

@github-actions
Copy link

👋 Hi! Thank you for contributing to the vLLM Ascend project. The following points will speed up your PR merge:‌‌

  • A PR should do only one thing, smaller PRs enable faster reviews.
  • Every PR should include unit tests and end-to-end tests ‌to ensure it works and is not broken by other future PRs.
  • Write the commit message by fulfilling the PR description to help reviewer and future developers understand.

If CI fails, you can run linting and testing checks locally according Contributing and Testing.

@github-actions github-actions bot added documentation Improvements or additions to documentation ci/build module:tests module:core labels Nov 27, 2025
Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a significant amount of code to support custom ACLNN operators for Ascend NPUs. This includes a new CMake-based build system under csrc/, build scripts, and the source code for two custom operators: dispatch_gmm_combine_decode and grouped_matmul_swiglu_quant_weight_nz_tensor_list. The changes also integrate these custom operators into the Python package by updating setup.py and binding them in torch_binding.cpp. My review has identified a critical issue in the path construction for loading custom ops, which would prevent them from being found at runtime. I've also found a couple of high-severity issues in the build scripts that could lead to build failures or unexpected behavior. Additionally, linting has been disabled for the new csrc directory, which should be addressed before merging.

Comment on lines 42 to 45
CUSTOM_OPP_PATH = os.path.join(CUR_DIR, "vllm_ascend", "_cann_ops_custom",
"vendors", "customize")
CUSTOM_LIB_PATH = os.path.join(CUSTOM_OPP_PATH, "op_api", "lib")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

critical

The path to custom operators seems to be constructed incorrectly. CUR_DIR is .../vllm_ascend, so os.path.join(CUR_DIR, "vllm_ascend", "_cann_ops_custom", ...) will result in a wrong path .../vllm_ascend/vllm_ascend/_cann_ops_custom/.... It should probably be os.path.join(CUR_DIR, "_cann_ops_custom", ...) since _cann_ops_custom is installed inside the vllm_ascend package directory.

Suggested change
CUSTOM_OPP_PATH = os.path.join(CUR_DIR, "vllm_ascend", "_cann_ops_custom",
"vendors", "customize")
CUSTOM_LIB_PATH = os.path.join(CUSTOM_OPP_PATH, "op_api", "lib")
CUSTOM_OPP_PATH = os.path.join(CUR_DIR, "_cann_ops_custom",
"vendors", "customize")
CUSTOM_LIB_PATH = os.path.join(CUSTOM_OPP_PATH, "op_api", "lib")

args: [
--toml, pyproject.toml,
'--skip', 'tests/e2e/multicard/test_torchair_graph_mode.py,csrc/mla_preprocess/**,tests/prompts/**,./benchmarks/sonnet.txt,*tests/lora/data/**,build/**,./vllm_ascend.egg-info/**,.github/**,typos.toml',
'--skip', 'tests/e2e/multicard/test_torchair_graph_mode.py,csrc/**,tests/prompts/**,./benchmarks/sonnet.txt,*tests/lora/data/**,build/**,./vllm_ascend.egg-info/**,.github/**,typos.toml',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

Disabling codespell for the entire csrc/** directory is not recommended. This will prevent spell checking on all C++ source files, which can lead to typos in code and comments, affecting maintainability. Please fix the codespell issues in the csrc directory and revert this change.

args: [
"--force-exclude",
"--exclude", "csrc/mla_preprocess/**"
"--exclude", "csrc/**"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

Excluding the entire csrc/** directory from typos check is not recommended. This tool helps catch common misspellings in source code. Please fix the typos in the csrc directory and revert this change.

Comment on lines 129 to 148
while [[ $# -gt 0 ]]; do
case $1 in
-h|--help)
help_info
exit
;;
-n|--op-name)
ascend_op_name="$2"
shift 2
;;
-c|--compute-unit)
ascend_compute_unit="$2"
shift 2
;;
*)
help_info
exit 1
;;
esac
done
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

The script's help message mentions --cov and --verbose options, but they are not handled in the argument parsing loop. The variables COV and VERBOSE are initialized to false but never updated. This is a bug that makes these options non-functional.

while [[ $# -gt 0 ]]; do
    case $1 in
    -h|--help)
        help_info
        exit
        ;;
    -n|--op-name)
        ascend_op_name="$2"
        shift 2
        ;;
    -c|--compute-unit)
        ascend_compute_unit="$2"
        shift 2
        ;;
    --cov)
        COV="true"
        shift
        ;;
    --verbose)
        VERBOSE="true"
        shift
        ;;
    *)
        help_info
        exit 1
        ;;
    esac
done

-DOP_DEBUG_CONFIG=${OP_DEBUG_CONFIG} \
-DASCEND_OP_NAME=${ASCEND_OP_NAME}

make ${JOB_NUM} prepare_build
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

The script uses make directly to build the prepare_build target. This is not generator-agnostic and will fail if a user configures CMake with a different generator, such as Ninja. It's better to use cmake --build . which works with any generator.

Suggested change
make ${JOB_NUM} prepare_build
cmake --build . --target prepare_build -- ${JOB_NUM}

@github-actions
Copy link

This pull request has conflicts, please resolve those before we can evaluate the pull request.

@github-actions
Copy link

This pull request has conflicts, please resolve those before we can evaluate the pull request.

@github-actions github-actions bot removed documentation Improvements or additions to documentation ci/build module:core merge-conflicts labels Nov 28, 2025
@wangqiankun13 wangqiankun13 force-pushed the dev_wangqk branch 5 times, most recently from 565f254 to 8011f0e Compare November 29, 2025 07:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant