FP16 Dot Product
2026/3/9小于 1 分钟
FP16 Dot Product
题面
计算两个 FP16 向量的点积,乘加过程中使用 FP32 累加,最终结果转回 FP16 存入输出。
Implementation Requirements
- External libraries are not permitted
- The solve function signature must remain unchanged
- FP32 累加后写回 half
Examples
同 FP32 点积示例:A=[1,2,3,4], B=[5,6,7,8] → 70.0;A=[0.5,1.5,2.5], B=[2,3,4] → 15.5
Constraints
- A 与 B 等长
- 1 ≤ N ≤ 100,000,000
- Performance: N = 100,000,000