Skip to content

[AscendNPU-IR] Support CANN-9.0.0#843

Draft
happyhappyhappy-arch wants to merge 4 commits intotile-ai:npuirfrom
happyhappyhappy-arch:npuir-9.0.0
Draft

[AscendNPU-IR] Support CANN-9.0.0#843
happyhappyhappy-arch wants to merge 4 commits intotile-ai:npuirfrom
happyhappyhappy-arch:npuir-9.0.0

Conversation

@happyhappyhappy-arch
Copy link
Copy Markdown
Collaborator

@happyhappyhappy-arch happyhappyhappy-arch commented Apr 16, 2026

This MR will be suspended until CANN releases version 9.0.0.

@github-actions
Copy link
Copy Markdown

👋 Hi! Thank you for contributing to the TileLang project.

Please remember to run bash format.sh in the root directory of the project to ensure your changes are properly linted and formatted. This will help ensure your contribution passes the format check.

We appreciate you taking this step! Our team will review your contribution, and we look forward to your awesome work!

🚀

Copy link
Copy Markdown
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 support for CANN 9.0.0.beta2 alongside the existing 8.5.0 version. Key changes include automated CANN version detection in CMake and shell scripts, version-specific MLIR codegen for the Fixpipe operation, and updated documentation for installation and environment variables. Feedback focuses on improving the robustness of version detection regex in CMake, ensuring absolute paths are used in build configurations to avoid path resolution issues, and properly initializing MLIR attributes in the C++ codegen to prevent potential verification failures or crashes.

Comment thread CMakeLists.txt
if(DEFINED _tilelang_ascend_home)
if(_tilelang_ascend_home MATCHES "cann-8\\.5\\.0(/|$)")
set(_tilelang_ascend_cann_version "8.5.0")
elseif(_tilelang_ascend_home MATCHES "cann-9\\.0\\.0-beta\\.2(/|$)")
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.

medium

The regex for detecting CANN 9.0.0-beta.2 is quite restrictive and might fail if the directory name differs slightly (e.g., cann-9.0.0-beta2 without the dot before 2). The Python utility and shell script use more flexible matching. Consider using a more inclusive regex to improve auto-detection robustness.

    elseif(_tilelang_ascend_home MATCHES "cann-9\\.0\\.0.*beta.*2(/|$)")

Comment thread install_npuir.sh
@@ -155,6 +245,7 @@ cd build

echo "set(USE_NPUIR ON)" >> config.cmake
echo "set(BISHENGIR_ROOT_PATH $BISHENGIR_PATH)" >> config.cmake
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.

medium

The BISHENGIR_ROOT_PATH is written to config.cmake as a relative path and without quotes. This can cause issues if the path contains spaces or when CMake is run from the build directory, as it will look for the path relative to build/. It is recommended to use an absolute path and wrap it in quotes to ensure CMake can correctly locate the headers and libraries.

Suggested change
echo "set(BISHENGIR_ROOT_PATH $BISHENGIR_PATH)" >> config.cmake
BISHENGIR_PATH_ABS="$(cd "$BISHENGIR_PATH" 2>/dev/null && pwd || echo "$BISHENGIR_PATH")"
echo "set(BISHENGIR_ROOT_PATH \"$BISHENGIR_PATH_ABS\")" >> config.cmake

Comment thread src/target/codegen_npuir_api.cc Outdated
Comment thread src/target/codegen_npuir_api.cc Outdated
Comment thread src/target/codegen_npuir_dev.cc Outdated
@happyhappyhappy-arch happyhappyhappy-arch added the AscendNPU-IR Want to merge into the npuir branch label Apr 16, 2026
@happyhappyhappy-arch happyhappyhappy-arch changed the title [AscendNPU-IR] Support CANN-9.0.0 [wip][AscendNPU-IR] Support CANN-9.0.0 Apr 16, 2026
@happyhappyhappy-arch happyhappyhappy-arch changed the title [wip][AscendNPU-IR] Support CANN-9.0.0 [AscendNPU-IR] Support CANN-9.0.0 Apr 16, 2026
Comment thread install_npuir.sh Outdated
Comment on lines +47 to +48
if [ -z "$current_home" ]; then
echo "Error: neither --cann-version nor ASCEND_HOME_PATH is set." >&2
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Please use version 8.5.0 by default, as it is the version currently recommended by the community.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Checked

Comment thread pyproject.toml

[tool.codespell]
ignore-words-list = "nd, te, ist, LOD, offen, NotIn, HSA, cann"
ignore-words-list = "nd, te, ist, LOD, offen, NotIn, HSA, cann, VOr"
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

What VOr mean?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

The Vector Or opration, which in README.md as VOr.
In format CI, that op considered as a misspelling of "for".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

AscendNPU-IR Want to merge into the npuir branch

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants