版本
- InfiniCore commit: 46ca684
- Hardware: Huawei Ascend 910B3
- CANN: 8.1.RC1
- OS: Linux
- Python: Python 3.10 or later
- Build command:
python scripts/install.py --ascend-npu=y
问题描述
InfiniCore cannot compile the Ascend paged attention kernels because
block_idx is used as a local variable name.
Ascend C defines block_idx as a compiler built-in variable/macro.
As a result, the local variable declaration is expanded by the
preprocessor and rejected by the Ascend C compiler.
复现步骤
- git clone --recursive https://github.com/InfiniTensor/InfiniCore.git
- cd InfiniCore
- source scripts/set_env_linux.sh
- python scripts/install.py --ascend-npu=y
实际结果
The build fails with errors :
The errors occur in:
src/infiniop/ops/paged_attention/ascend/paged_attention_ascend_kernel.cpp
src/infiniop/ops/paged_attention_prefill/ascend/paged_attention_prefill_ascend_kernel.cpp
预期结果
The Ascend paged attention kernels should compile successfully.
根因分析
Ascend C reserves block_idx as a built-in variable.
The affected variables in these kernels represent logical paged
attention block indices, rather than Ascend hardware block IDs.
Therefore, they should not be replaced with AscendC::GetBlockIdx().
They should be renamed to a non-reserved identifier while preserving
the existing indexing logic.
建议修复
Rename the logical page-block variables from block_idx to
page_block_idx in the affected Ascend kernels.
This is a source-level naming fix and does not change the algorithm,
operator interface, memory layout, or output semantics.
版本
python scripts/install.py --ascend-npu=y问题描述
InfiniCore cannot compile the Ascend paged attention kernels because
block_idxis used as a local variable name.Ascend C defines
block_idxas a compiler built-in variable/macro.As a result, the local variable declaration is expanded by the
preprocessor and rejected by the Ascend C compiler.
复现步骤
实际结果
The build fails with errors :
The errors occur in:
src/infiniop/ops/paged_attention/ascend/paged_attention_ascend_kernel.cppsrc/infiniop/ops/paged_attention_prefill/ascend/paged_attention_prefill_ascend_kernel.cpp预期结果
The Ascend paged attention kernels should compile successfully.
根因分析
Ascend C reserves
block_idxas a built-in variable.The affected variables in these kernels represent logical paged
attention block indices, rather than Ascend hardware block IDs.
Therefore, they should not be replaced with
AscendC::GetBlockIdx().They should be renamed to a non-reserved identifier while preserving
the existing indexing logic.
建议修复
Rename the logical page-block variables from
block_idxtopage_block_idxin the affected Ascend kernels.This is a source-level naming fix and does not change the algorithm,
operator interface, memory layout, or output semantics.