Fix: rename BLK local var to avoid CANN 8.5.1 macro collision#527
Merged
ChaoWao merged 1 commit intoApr 13, 2026
Merged
Conversation
There was a problem hiding this comment.
Code Review
This pull request renames the BLK constant to kBlkSize in tensor.h to prevent potential macro collisions. The review feedback suggests propagating this change to other runtime versions for consistency and identifies a pre-existing logic bug where an out-of-bounds write could occur if the buffer size is not a multiple of the element size.
2ab24a1 to
58f9998
Compare
CANN 8.5.1 defines `#define BLK BLK_Type()` in __clang_cce_vector_intrinsics.h, which causes the device compiler to expand the local `constexpr uint64_t BLK = 64` declaration into invalid code. Rename to `blk_size` in both a2a3 and a5 tensor.h. Fixes hw-native-sys#517
58f9998 to
34be680
Compare
ChaoWao
approved these changes
Apr 13, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
constexpr uint64_t BLK = 64toblk_sizeinfill_initial_value()for botha2a3anda5tensor.h#define BLK BLK_Type()in__clang_cce_vector_intrinsics.h:555, causing the device compiler to expand the local variable declaration into invalid codeTesting
Fixes #517