Skip to content

Commit 0ef1b34

Browse files
authored
[webgpu] Add 2% tolerance to MatMulNBits.Float32_8b_AccuracyLevel4 (microsoft#25249)
### Description Add 2% more tolerance to `MatMulNBits` accuracy level int8 compared with f32/f16, to fix microsoft#25231. ### Motivation and Context See above.
1 parent e80cd8a commit 0ef1b34

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

onnxruntime/test/contrib_ops/matmul_8bits_test.cc

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -305,7 +305,11 @@ TEST(MatMulNBits, Float32_8b_AccuracyLevel4) {
305305
TestMatMul8BitsTyped<float, 100, 288, 93, 32, 4>();
306306
TestMatMul8BitsTyped<float, 100, 288, 93, 128, 4>();
307307
TestMatMul8BitsTyped<float, 100, 288, 1234, 16, 4>();
308-
TestMatMul8BitsTyped<float, 2, 5120, 3072, 32, 4>();
308+
309+
// Using a 2% larger tolerance for accuracy level int8 compared to the accuracy level f32/f16.
310+
constexpr float abs_error = 0.1f * 1.02f;
311+
constexpr float rel_error = 0.02f * 1.02f;
312+
TestMatMul8BitsTyped<float, 2, 5120, 3072, 32, 4>(abs_error, rel_error);
309313
}
310314

311315
TEST(MatMulNBits, Float32_8b_AccuracyLevel1) {

0 commit comments

Comments
 (0)