Skip to content

Commit

Permalink
Increase multiplier to 3 for Inductor AMP FP16 benchmark correctness …
Browse files Browse the repository at this point in the history
…check (#135932)

Summary:
Fix pytorch/pytorch#135657.
Aligned with AMP BF16, using multiplier 3 for Inductor AMP FP16 benchmark correctness check

X-link: pytorch/pytorch#135932
Approved by: https://github.com/CaoE, https://github.com/jgong5, https://github.com/jansel

Reviewed By: jeanschmidt

Differential Revision: D62980154

fbshipit-source-id: e7fb9cd8faea933ff85fb1173620bf0d54ebf9f1
  • Loading branch information
jiayisunx authored and facebook-github-bot committed Sep 18, 2024
1 parent c97859e commit c1755f5
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion userbenchmark/dynamo/dynamobench/_dynamo/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -1787,7 +1787,9 @@ def to_tensor(t):
# accuracy when comparing AMP with FP32 is within a difference of less than 0.1%.
# Thus, it's possible that the correctness check failures for these models are
# false alarms. We use multiplier of 3 instead of 2 to avoid these false alarms.
multiplier = 3.0 if res.dtype == torch.bfloat16 else 2.0
multiplier = (
3.0 if res.dtype in (torch.float16, torch.bfloat16) else 2.0
)

if use_larger_multiplier_for_smaller_tensor and (
fp64_ref.numel() <= 10 and tol >= 4 * 1e-2
Expand Down

0 comments on commit c1755f5

Please sign in to comment.