Thanks for sending an requirement! Please fill in the following template to help quickly solve your problem.
QuantBatchMatmulV3 arch35 tiling 中直接使用 alignas(8) 和 return 0.5;。本次反馈这两处触发了 Code Check 的难以理解的字面量常量告警,需要通过具名常量表达字节对齐要求和每个 4 bit 元素的字节数。
alignas(8)
return 0.5;
涉及位置:
matmul/quant_batch_matmul_v3/op_kernel/arch35/quant_batch_matmul_v3_tiling_data.h
QuantBatchMatmulV3TensorAPIWithoutBatchTilingData
matmul/quant_batch_matmul_v3/op_host/op_tiling/arch35/base_block_calculator.cpp
GetDtypeBytes
来源于本次用户反馈的 Code Check 告警;未提供具体部门或团队信息。
让维护者能从常量名理解 8 和 0.5 的业务含义,避免在结构体对齐声明和类型字节数计算中直接使用魔法数字。
8
0.5
DequantBmm
constexpr uint32_t TILING_DATA_ALIGNMENT = 8U
alignas(TILING_DATA_ALIGNMENT)
constexpr double FOUR_BIT_DTYPE_BYTES = 0.5
git diff --check upstream/master...origin/backup 已通过。具名常量变更在本会话提交时通过 pre-commit 检查,包括 clang-format、codespell 和 OAT。未执行完整工程编译、算子 UT 或 Code Check 复扫。
git diff --check upstream/master...origin/backup
关联 PR:https://gitcode.com/cann/ops-nn/merge_requests/11511
Thanks for sending an requirement! Please fill in the following template to help quickly solve your problem.
Backgroud(背景信息)
QuantBatchMatmulV3 arch35 tiling 中直接使用
alignas(8)和return 0.5;。本次反馈这两处触发了 Code Check 的难以理解的字面量常量告警,需要通过具名常量表达字节对齐要求和每个 4 bit 元素的字节数。涉及位置:
matmul/quant_batch_matmul_v3/op_kernel/arch35/quant_batch_matmul_v3_tiling_data.h:QuantBatchMatmulV3TensorAPIWithoutBatchTilingData的对齐声明。matmul/quant_batch_matmul_v3/op_host/op_tiling/arch35/base_block_calculator.cpp:GetDtypeBytes对 INT4、FLOAT4_E2M1 和 FLOAT4_E1M2 的返回值。Origin(信息来源)
来源于本次用户反馈的 Code Check 告警;未提供具体部门或团队信息。
Benefit / Necessity (价值/作用)
让维护者能从常量名理解
8和0.5的业务含义,避免在结构体对齐声明和类型字节数计算中直接使用魔法数字。Design(设计方案)
DequantBmm命名空间定义constexpr uint32_t TILING_DATA_ALIGNMENT = 8U,并使用alignas(TILING_DATA_ALIGNMENT)。constexpr double FOUR_BIT_DTYPE_BYTES = 0.5,并在GetDtypeBytes的 4 bit 类型分支返回该常量。git diff --check upstream/master...origin/backup已通过。具名常量变更在本会话提交时通过 pre-commit 检查,包括 clang-format、codespell 和 OAT。未执行完整工程编译、算子 UT 或 Code Check 复扫。关联 PR:https://gitcode.com/cann/ops-nn/merge_requests/11511