Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 14 additions & 1 deletion tests/test_div.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,20 @@ def test_div_tensor_mode_float(shape, rounding_mode, dtype):
with flag_gems.use_gems():
res_out = torch.div(inp1, inp2, rounding_mode=rounding_mode)

utils.gems_assert_close(res_out, ref_out, dtype, equal_nan=True)
# On mthreads with --ref cpu, trunc/floor rounding can amplify a 1-ULP
# difference in float32 division to ±1.0 at integer boundaries, since the
# GPU and CPU implementations may round the quotient differently before
# truncation. This is not an operator bug, so we relax atol for this case.
atol = (
1.0
if (
rounding_mode is not None
and utils.TO_CPU
and flag_gems.vendor_name == "mthreads"
)
else 1e-4
)
utils.gems_assert_close(res_out, ref_out, dtype, equal_nan=True, atol=atol)


@pytest.mark.div_tensor_mode
Expand Down