feat(ptodsl): expose explicit L1 to L0 loads - #1140
Conversation
mouliangyu
left a comment
There was a problem hiding this comment.
这版已保留旧 API 兼容并补充基础 verifier,但仍有两个会影响生成代码正确性的边界需要处理:FP4 显式路径的 intrinsic 分流,以及硬件控制字段的静态范围校验。CI 当前全绿,但现有测试没有覆盖这两类情况。
| "mte_l1_l0a explicit controls require m_start, k_start, " | ||
| "m_step, k_step, src_stride, and dst_stride" | ||
| ) | ||
| _pto.LoadCbufToCaOp( |
There was a problem hiding this comment.
[P1] 这里无条件构造普通 LoadCbufToCaOp(下面的 L0B 分支同理),因此 FP4 指针也会进入普通 lowering。当前 emitter 会把 f4E1M2x2/f4E2M1x2 映射到 LOAD.L1.TO.L0*.2Dv2.s8;但已安装 A5 TExtract.hpp 对 FP4 明确调用 load_cbuf_to_*_s4,旧结构化 wrapper 也会分流到 LoadCbufToCaS4Op/LoadCbufToCbS4Op。这样合法的 FP4 显式调用会静默生成错误指令。请按源元素类型分流到 *_s4(并明确 K 控制字段的单位),或显式拒绝 FP4;同时增加 FP4 L0A/L0B lowering 测试,检查最终 intrinsic 为 .s4。
| return success(); | ||
| }; | ||
|
|
||
| if (failed(checkNonNegativeConst(op.getMStart(), "m_start")) || |
There was a problem hiding this comment.
[P2] 这里仅检查正负,未检查控制字段的硬件位宽。A5 契约中 m_start/k_start/src_stride/dst_stride 为 16 位,m_step/k_step 为 8 位;lowering 又直接移位 OR、没有掩码,所以例如 m_step = 256 会侵入 k_step 字段,m_start = 65536 会侵入 k_start,但 verifier 仍接受。请对静态常量增加上界检查(start/stride ≤ 65535,step ≤ 255),并在该 negative lit 测试中加入越界用例。
|
Warning: @and0d0, ci-sim exceeded its soft runtime budget.
This warning is advisory only and does not affect required checks. Please inspect the step timings for an unexpected regression. |
解决了原有 mte_l1_l0a/b 只能表达结构化 m/k/n + start_row/start_col 传输、无法直接指定分形块起点、步长和源/目的物理 stride 的问题。
现在同一 API 同时支持旧的结构化形式(保持现有调用和 IR 不变)与新的 8 参数显式控制形式(降为现有 LoadCbufToCa/CbOp);补充了文档、公开 API 约束和回归测试。