Skip to content

[Bug] Build fails with CANN 8.5.1: BLK macro collision in tensor.h #517

@Hzfengsy

Description

@Hzfengsy

Platform

a2a3 (Ascend 910B/C hardware)

Runtime Variant

tensormap_and_ringbuffer

Description

pip install -v . fails when building with CANN 8.5.1's device compiler (ccec). CANN 8.5.1 introduces a preprocessor macro #define BLK BLK_Type() in __clang_cce_vector_intrinsics.h:555, which collides with the local variable constexpr uint64_t BLK = 64 in tensor.h:300.

The macro expands the variable declaration into invalid code, causing:

src/a5/runtime/tensormap_and_ringbuffer/runtime/tensor.h:300:28: error: illegal initializer (only variables can be initialized)

CI passes because it uses CANN 8.5.0, which does not define the BLK macro.

Steps to Reproduce

  1. Install CANN 8.5.1 and ensure ccec resolves to the 8.5.1 binary
  2. Clone simpler on stable branch (commit d62341b)
  3. Run CC=/usr/bin/gcc CXX=/usr/bin/g++ pip install -v .
  4. Build fails on all a5 aicore compilation units that include tensor.h

Expected Behavior

Build completes successfully regardless of CANN 8.5.0 or 8.5.1.

Actual Behavior

All aicore compilation units fail with the same error:

FAILED: [code=1] common_aic.o
tensor.h:300:28: error: illegal initializer (only variables can be initialized)
  constexpr uint64_t BLK = 64;
                           ^
__clang_cce_vector_intrinsics.h:555:13: note: expanded from macro 'BLK'
#define BLK BLK_Type()
            ^

Affected targets: common_aic.o, common_aiv.o, aicore_executor_aic.o, aicore_executor_aiv.o

Git Commit ID

d62341b

CANN Version

8.5.1 (build 20251230_093648626)

Host Platform

Linux (aarch64)

Additional Context

The collision is between:

  • CANN 8.5.1 header: /path/to/cann-8.5.1/tools/bisheng_compiler/lib/clang/15.0.5/include/npu_arch_3101/__clang_cce_vector_intrinsics.h:555 defines #define BLK BLK_Type()
  • simpler source: src/a5/runtime/tensormap_and_ringbuffer/runtime/tensor.h:300 declares constexpr uint64_t BLK = 64

CANN 8.5.0 does not define this macro, which is why CI is unaffected.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    Status

    No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions