Skip to content

[BugFix] fix for new verision of cann - #11445

Merged
zzzzwwjj merged 3 commits into
vllm-project:mainfrom
ZT-AIA:build0704
Jul 5, 2026
Merged

zzzzwwjj merged 3 commits into
vllm-project:mainfrom
ZT-AIA:build0704

Conversation

@ZT-AIA

@ZT-AIA ZT-AIA commented Jul 4, 2026 •

Copy link
Copy Markdown
Collaborator

What this PR does / why we need it?

The changes to log.h in the new version of cann caused compilation errors, so compatibility with the new version of cann was added.

Does this PR introduce any user-facing change?

No

How was this patch tested?

pip install

Signed-off-by: ZT-AIA <1028681969@qq.com>
@gemini-code-assist

Copy link
Copy Markdown
Contributor

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request addresses compatibility issues arising from updates to the CANN toolkit. By introducing a dedicated compatibility header and updating the build system, the changes ensure that logging and module ID definitions remain consistent across different CANN versions, preventing compilation errors.

Highlights

  • CANN Compatibility: Introduced a new compatibility header to resolve logging and module ID definition changes in newer CANN versions.
  • Build System Update: Updated CMake configuration to force the inclusion of the new compatibility header during the compilation process.
  • Repository Cleanup: Removed obsolete build and tool-specific patterns from the .gitignore file.
New Features

🧠 You can now enable Memory (public preview) to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize the Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counterproductive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution. ↩

@github-actions

github-actions Bot commented Jul 4, 2026

Copy link
Copy Markdown
Contributor

👋 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.


Tip

💡 Consider Linking a Related Issue or RFC

Your PR title contains the [BugFix] tag, indicating a bug fix or new feature.

Linking a related issue or RFC in the PR description is strongly encouraged — it gives reviewers helpful context and speeds up the review. You can use any of these keywords:

  • Fixes #<issue_number>
  • Closes #<issue_number>
  • Resolves #<issue_number>
  • Refs #<rfc_or_issue_number> (for RFCs)

🙏 Thanks for helping us keep the project well-organized!

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

Copy link
Copy Markdown
Contributor

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 compatibility header cann_compat.h to resolve compilation issues with newer versions of CANN (specifically B080+), where op_common/log/log.h no longer exposes the unqualified OP module ID. It also cleans up .gitignore entries. The review feedback suggests adhering to the repository style guide for the PR title and summary format, separating the -include flag and its argument in CMake to robustly handle paths containing spaces, and adding a printf format attribute to the variadic DlogRecord function declaration to prevent format string vulnerabilities.

Comment thread csrc/CMakeLists.txt
)

# Suppress warnings from catlass/tla third-party headers for CANN kernel compilation
set(VLLM_ASCEND_CANN_COMPAT_HEADER "${OPS_TRANSFORMER_DIR}/common/include/cann_compat.h")

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

high

According to the Repository Style Guide, the PR Title and PR Summary should follow a specific format, especially when the PR description is empty.

Here are the suggested PR Title and PR Summary for this pull request:

Suggested PR Title:

[Ops][BugFix] Fix for new version of CANN

Suggested PR Summary:

### What this PR does / why we need it?

This PR introduces a compatibility header `cann_compat.h` to fix compilation issues with newer versions of CANN (specifically B080 and above). It addresses the issue where `op_common/log/log.h` stopped exposing the unqualified `OP` module ID and provides fallback definitions for logging functions (`CheckLogLevel` and `DlogRecord`) when `LOG_CPP` is defined.

### Does this PR introduce _any_ user-facing change?

No.

### How was this patch tested?

Tested by compiling the `csrc` module with the new CANN version.
References
  1. The PR Title and PR Summary must follow the specified format when the PR description is empty or needs updating. (link)

Comment thread csrc/CMakeLists.txt
Comment on lines +104 to +107
list(APPEND OPS_COMPILE_OPTIONS -include${VLLM_ASCEND_CANN_COMPAT_HEADER})
add_compile_options(
$<$<COMPILE_LANGUAGE:CXX>:-include${VLLM_ASCEND_CANN_COMPAT_HEADER}>
)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

high

Passing -include${VLLM_ASCEND_CANN_COMPAT_HEADER} as a single concatenated argument can cause compilation failures if the path contains spaces. It is much more robust to pass -include and the file path as separate arguments using CMake's list structure and generator expressions.

list(APPEND OPS_COMPILE_OPTIONS "-include" "${VLLM_ASCEND_CANN_COMPAT_HEADER}")
add_compile_options(
    $<$<COMPILE_LANGUAGE:CXX>:-include>
    $<$<COMPILE_LANGUAGE:CXX>:${VLLM_ASCEND_CANN_COMPAT_HEADER}>
)

extern "C" {
#endif
int32_t CheckLogLevel(int32_t moduleId, int32_t logLevel);
void DlogRecord(int32_t moduleId, int32_t level, const char *fmt, ...);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

security-high high

To prevent format string vulnerabilities and ensure compile-time type safety of arguments, it is highly recommended to add the printf format attribute to the variadic DlogRecord function declaration.

Suggested change
void DlogRecord(int32_t moduleId, int32_t level, const char *fmt, ...);
void DlogRecord(int32_t moduleId, int32_t level, const char *fmt, ...) __attribute__((format(printf, 3, 4)));

ZT-AIA added 2 commits July 4, 2026 23:35
Signed-off-by: ZT-AIA <1028681969@qq.com>
Signed-off-by: ZT-AIA <1028681969@qq.com>
@zzzzwwjj

zzzzwwjj commented Jul 5, 2026

Copy link
Copy Markdown
Collaborator

This PR looks like an AI's work. This is a temporary bug fix, please confirm the correct way to call the CANN interface.

@zzzzwwjj
zzzzwwjj merged commit c8b4020 into vllm-project:main Jul 5, 2026
78 of 79 checks passed
wangyichao1999 pushed a commit to wangyichao1999/vllm-ascend that referenced this pull request Jul 9, 2026
### What this PR does / why we need it?
The changes to log.h in the new version of cann caused compilation
errors, so compatibility with the new version of cann was added.
### Does this PR introduce _any_ user-facing change?
No
### How was this patch tested?
pip install 

- vLLM version: v0.23.0
- vLLM main:
vllm-project/vllm@b9a7cd4

---------

Signed-off-by: ZT-AIA <1028681969@qq.com>
Alex-stack-hub pushed a commit to 0moyi0-2024/vllm-ascend_tp that referenced this pull request Jul 27, 2026
### What this PR does / why we need it?
The changes to log.h in the new version of cann caused compilation
errors, so compatibility with the new version of cann was added.
### Does this PR introduce _any_ user-facing change?
No
### How was this patch tested?
pip install 

- vLLM version: v0.23.0
- vLLM main:
vllm-project/vllm@b9a7cd4

---------

Signed-off-by: ZT-AIA <1028681969@qq.com>
MmMmaru pushed a commit to jiaqi-lee/vllm-ascend that referenced this pull request Aug 19, 2026
### What this PR does / why we need it?
The changes to log.h in the new version of cann caused compilation
errors, so compatibility with the new version of cann was added.
### Does this PR introduce _any_ user-facing change?
No
### How was this patch tested?
pip install 

- vLLM version: v0.23.0
- vLLM main:
vllm-project/vllm@b9a7cd4

---------

Signed-off-by: ZT-AIA <1028681969@qq.com>
shiqiangA pushed a commit to shiqiangA/vllm-ascend that referenced this pull request Aug 20, 2026
### What this PR does / why we need it?
The changes to log.h in the new version of cann caused compilation
errors, so compatibility with the new version of cann was added.
### Does this PR introduce _any_ user-facing change?
No
### How was this patch tested?
pip install 

- vLLM version: v0.23.0
- vLLM main:
vllm-project/vllm@b9a7cd4

---------

Signed-off-by: ZT-AIA <1028681969@qq.com>
Leetrytry pushed a commit to Leetrytry/vllm-ascend that referenced this pull request Sep 11, 2026
### What this PR does / why we need it?
The changes to log.h in the new version of cann caused compilation
errors, so compatibility with the new version of cann was added.
### Does this PR introduce _any_ user-facing change?
No
### How was this patch tested?
pip install 

- vLLM version: v0.23.0
- vLLM main:
vllm-project/vllm@b9a7cd4

---------

Signed-off-by: ZT-AIA <1028681969@qq.com>
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.

2 participants