问题背景
硬件约束已经确认发生变化:TROWSUM 等 row-reduction 接口的输出 descriptor 必须设置:
physical Columns = 1
ValidColumns = 1
physical Rows = tile capacity / (Columns * element bytes)
同一 reduction vector 经过 TMULS/TADDS/TRECIP 等操作并作为 TROWEXPANDMUL 的 broadcast source 时,也需要保持 physical/valid Columns=1。
当前 TileOP API 无法表达这个合法 descriptor。对 float row-reduction vector 使用 Cols=1 会被普通 RowMajor 每行 32-byte 对齐的静态断言拒绝。
版本
- Linx-TileOP-API:
a795b973020de012fa2a8e2c29b26adfc83d5d29
- SuperNPUBench:
ops-20260823 / 244d088fdc56dc0b41cc77b60e03dc974b67ea93
- 用例:one-level
normalization/rms_norm/rms_norm_static
- 配置:
DType=__half G_A=16 G_R=512 TILE_A=2 TILE_R=512 PE_NUM=1
最小复现
创建 /tmp/repro_rowsum_col1.cpp:
#include <common/pto_tileop.hpp>
using namespace pto;
// TROWSUM result: two valid rows, one physical/valid column.
using row_reduce_t =
Tile<Location::Vec, float, 2, 1, BLayout::RowMajor, 2, 1>;
void instantiate_row_reduce_tile() {
row_reduce_t value;
(void)value;
}
使用包含当前 TileOP API 的 linx toolchain 编译:
export COMPILER_DIR=/path/to/linx_blockisa_llvm_musl/bin
export TILEOP=/path/to/Linx-TileOP-API
"$COMPILER_DIR/clang++" -c -mlxbc -fenable-matrix -std=c++20 \
-D__linx -DENABLE_TENSOR_INSTR \
-I"$TILEOP/include" \
/tmp/repro_rowsum_col1.cpp -o /tmp/repro_rowsum_col1.o
实际结果
编译失败,首个错误为:
include/common/pto_tile.hpp:721:3: error: static assertion failed due to requirement
'BLayout::RowMajor ... Cols * type_traits<float>::bits % (32 * 8) == 0 ...'
in instantiation of template class
'pto::Tile<pto::Location::Vec, float, 2, 1,
pto::BLayout::RowMajor, 2, 1, ...>'
Cols=1、dtype=float 时一行只有 4 bytes,因此当前检查:
Cols * type_traits<DType>::bits % (32 * 8) == 0
必然失败。随后出现的 GetValidCol()、GetValidRow()、data() 不存在以及 TADDS substitution failure 都是 Tile 类实例化失败产生的连锁错误,不是独立根因。
SuperNPUBench 端到端复现
将 RMSNorm 的 reduction vector 改为:
using tile_v =
Tile<Location::Vec, float, tA, 1, BLayout::RowMajor, tA, 1>;
然后从 SuperNPUBench/benchmark/one-level-arch/test/kernel/normalization/rms_norm 执行:
make TESTCASE=rms_norm_static DType=__half \
G_A=16 G_R=512 TILE_A=2 TILE_R=512 PE_NUM=1 \
COMPILER_DIR=/path/to/linx_blockisa_llvm_musl/bin \
res_check=on all
会在实例化:
Tile<Location::Vec, float, 2, 1, RowMajor, 2, 1>
时得到同一个 pto_tile.hpp:721 静态断言。
预期行为
TileOP API 应提供符合新 row-reduction contract 的表示和 lowering:
- descriptor 发布
physical Columns=1、ValidColumns=1;
- physical Rows 根据 tile capacity/TSize 和 element size 推导,而不是要求一行本身达到 32-byte;
TROWSUM -> TMULS/TADDS/TRECIP -> TROWEXPANDMUL 全链路保持同一个合法 reduction-vector shape;
- 普通 matrix tile 的 RowMajor 对齐检查不应误拒绝 row-reduction vector;如果需要新的 layout、carrier type 或显式 API,请在接口中提供并说明用法。
建议验收测试
- 增加 float/fp16、
ValidRows=1/2/4、physical/valid Columns=1 的 Tile 构造编译测试。
- 增加
TROWSUM -> TMULS/TADDS/TRECIP -> TROWEXPANDMUL 编译测试,并检查生成 descriptor 的 physical Columns 确实为 1。
- 使用 SuperNPUBench static RMSNorm
TILE_A=2 做端到端编译回归。
问题背景
硬件约束已经确认发生变化:
TROWSUM等 row-reduction 接口的输出 descriptor 必须设置:同一 reduction vector 经过
TMULS/TADDS/TRECIP等操作并作为TROWEXPANDMUL的 broadcast source 时,也需要保持 physical/valid Columns=1。当前 TileOP API 无法表达这个合法 descriptor。对
floatrow-reduction vector 使用Cols=1会被普通 RowMajor 每行 32-byte 对齐的静态断言拒绝。版本
a795b973020de012fa2a8e2c29b26adfc83d5d29ops-20260823/244d088fdc56dc0b41cc77b60e03dc974b67ea93normalization/rms_norm/rms_norm_staticDType=__half G_A=16 G_R=512 TILE_A=2 TILE_R=512 PE_NUM=1最小复现
创建
/tmp/repro_rowsum_col1.cpp:使用包含当前 TileOP API 的 linx toolchain 编译:
实际结果
编译失败,首个错误为:
Cols=1、dtype=float 时一行只有 4 bytes,因此当前检查:必然失败。随后出现的
GetValidCol()、GetValidRow()、data()不存在以及TADDSsubstitution failure 都是 Tile 类实例化失败产生的连锁错误,不是独立根因。SuperNPUBench 端到端复现
将 RMSNorm 的 reduction vector 改为:
然后从
SuperNPUBench/benchmark/one-level-arch/test/kernel/normalization/rms_norm执行:会在实例化:
时得到同一个
pto_tile.hpp:721静态断言。预期行为
TileOP API 应提供符合新 row-reduction contract 的表示和 lowering:
physical Columns=1、ValidColumns=1;TROWSUM -> TMULS/TADDS/TRECIP -> TROWEXPANDMUL全链路保持同一个合法 reduction-vector shape;建议验收测试
ValidRows=1/2/4、physical/valid Columns=1 的 Tile 构造编译测试。TROWSUM -> TMULS/TADDS/TRECIP -> TROWEXPANDMUL编译测试,并检查生成 descriptor 的 physical Columns 确实为 1。TILE_A=2做端到端编译回归。