Skip to content

Commit 57a42a4

Browse files
committed
Relax benchmark tolerances and use causal SDPA reference
1 parent 4838f40 commit 57a42a4

1 file changed

Lines changed: 6 additions & 4 deletions

File tree

tests/test_benchmarks.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ def make_inputs(b, m, n, k):
8989
x_names=["m", "n", "k"],
9090
x_vals=[2**i for i in range(3, 13)],
9191
benchmark_args={"b": 4},
92-
tolerances={"triton": {"atol": 0, "rtol": 0}},
92+
tolerances={"triton": {"atol": 0.01, "rtol": 0.01}},
9393
name="bmm",
9494
)
9595

@@ -171,7 +171,7 @@ def make_inputs(m, n):
171171
benchmark_args={"m": 4096},
172172
tolerances={
173173
"torch": {"atol": 0.001},
174-
"triton": {"atol": 0, "rtol": 0},
174+
"triton": {"atol": 0.001, "rtol": 0.001},
175175
},
176176
name="softmax",
177177
)
@@ -196,7 +196,7 @@ def make_inputs(m, n):
196196
benchmark_args={"m": 4096},
197197
tolerances={
198198
"torch": {"atol": 0.001, "rtol": 0.005},
199-
"triton": {"atol": 0, "rtol": 0},
199+
"triton": {"atol": 0.001, "rtol": 0.005},
200200
},
201201
name="rms-norm",
202202
)
@@ -316,7 +316,9 @@ class TestScaledDotProductAttentionBenchmark:
316316
def test_benchmark(self):
317317
impls = {
318318
"ninetoothed": ops.ninetoothed.torch.scaled_dot_product_attention,
319-
"torch": F.scaled_dot_product_attention,
319+
"torch": lambda q, k, v: F.scaled_dot_product_attention(
320+
q, k, v, is_causal=True
321+
),
320322
"triton": ops.triton.torch.scaled_dot_product_attention,
321323
}
322324

0 commit comments

Comments
 (0)