Repository navigation
Conversation
|
Thanks for the fix and the detailed validation! Tracking floating-point shape inputs is the right direction, and the repeated-length cases pass locally. There is one remaining concern in Could you please obtain a suitable host view before caching these inputs, or conservatively force resize for backend-native/device-backed inputs instead of reading their raw storage? Please keep ordinary floating-point data inputs skipped as they are now. A small focused validation is sufficient; no additional standalone test file is needed. Thanks! |
|
@wangzhaode 感谢指出这个问题,已按建议采用保守 resize 方案,补充提交:9372a30b75fee7b6d3aab5dd9a1fa8d7af5f9336。 修改过程:
测试结果:
麻烦再帮忙看一下,谢谢! |
|
@wangzhaode 大佬,有空再看下这里 |
9372a30 to
7a47eaf
Compare
Description
修复参与形状推导的浮点输入内容变化后,Module 仍复用旧输出形状的问题。
根因
StaticModule::_resize()通过缓存输入内容避免重复 resize,但原实现跳过所有浮点输入。Range的起点、上限和步长允许为浮点值;当标量上限改变、输入张量形状不变时,可能错误复用上一次输出形状。例如,连续输入上限 3、13,实际输出长度却为 3、3。Paraformer 导出的 decoder mask 也会触发此问题:整数序列长度经过 ReduceMax 和 Cast 转成浮点数后传给
Range,因此外部长度输入为整数并不能避免该错误。修复
依据已有的
mInputNeedCPU标记,将参与形状推导的浮点输入纳入原有的限长字节比较。普通浮点数据输入仍被跳过,避免大 embedding 引起不必要的 resize。保留主机缓冲区缺失或过大时的回退行为,以及已有的强制 resize 开关。新增
expr/ModuleRangeContent回归测试,覆盖浮点上限、整数转浮点上限、整数 Range,以及长度重复、增长和缩短的连续调用。验证
expr/Module测试及op/range均通过。git diff --check通过。Module
Core / Express
Type
Checklist
[Module:Type] Description格式