v2.0.1 — Bug 修复
发布日期: 2026年4月16日
完整变更: v2.0.0 → v2.0.1
🔵 修复
严重: 尺度维度计算错误
严重程度: 严重
影响范围: 仅测试工具
文件: tests/test_integration.cu
createRandomWeight 函数中存在尺度张量维度计算错误:
class="highlight">
1
2
3
4
5
6
7
| // ❌ 错误 (rows 和 cols 互换)
int num_groups = (cols + group_size - 1) / group_size;
w.scales = randomDeviceFP16(rows * num_groups, ...);
// ✅ 正确
int num_groups = (rows + group_size - 1) / group_size;
w.scales = randomDeviceFP16(num_groups * cols, ...);
重要性: W8A16 矩阵乘使用 [rows/group_size, cols] 索引尺度,需要 ceil(rows/g) * cols 个元素。错误的计算可能导致: - 测试中反量化不正确
- 潜在的内存访问问题
- 特定张量大小的测试失败
代码清理 文件: kernels/attention.cu 移除了 attention_decode_kernel 中 12 行未使用的 q_reg 数组加载代码。这是没有副作用的死代码,但会使实现变得混乱。 ✅ 验证 修复后所有测试通过: class="highlight"> 1
2
3
4
5
6
7
8
9
10
11
12
13
14
| $ ctest --output-on-failure
Test project /tiny-llm/build
Start 1: test_w8a16_matmul
1/5 Test #1: test_w8a16_matmul ......... Passed 0.05 sec
Start 2: test_kv_cache
2/5 Test #2: test_kv_cache .............. Passed 0.02 sec
Start 3: test_attention
3/5 Test #3: test_attention ............. Passed 0.03 sec
Start 4: test_rmsnorm
4/5 Test #4: test_rmsnorm ............... Passed 0.01 sec
Start 5: test_integration
5/5 Test #5: test_integration ........... Passed 1.23 sec
100% tests passed, 0 tests failed
🔄 变更 修改的文件: tests/test_integration.cu — 修复尺度维度 kernels/attention.cu — 移除未使用代码 CHANGELOG.md — 文档更新 📦 附件 tiny-llm-v2.0.1.tar.gz — 源码压缩包 tiny-llm-v2.0.1.zip — 源码 zip ← 返回更新日志 |
|