Skip to content

[ROCm] Fix flaky forward-tolerance in backward adagrad ROCm test - #165

Open
avbokovoy wants to merge 1 commit into
mainfrom
abokovoi/relax-fp16-tolerances-in-bwd-test
Open

[ROCm] Fix flaky forward-tolerance in backward adagrad ROCm test#165
avbokovoy wants to merge 1 commit into
mainfrom
abokovoi/relax-fp16-tolerances-in-bwd-test

Conversation

@avbokovoy

Copy link
Copy Markdown

Problem

test_backward_adagrad_rocm_fallback_kernel flakily failed with a forward output mismatch (e.g. fp32 weights + bf16 output, [127, 960]). The forward-check tolerance derived rtol/atol from weights_precision only, so fp32 weights forced the tight rtol=1e-4, tol=1e-2 even when the output was bf16 — below one bf16 ULP at the output magnitudes (~16–22). A correct kernel that bounded a single element the other way (exactly 1 ULP) tripped the assertion.

Fix

In backward_adagrad_common.py, only use the tight fp32 tolerance when both weights and output are fp32; otherwise use the relaxed 1e-2. Repro loop goes 16/40 -> 0/40 failures; the fp32/fp32 tight path is unchanged.

@avbokovoy avbokovoy self-assigned this Aug 18, 2026

@aryaman-gupta aryaman-gupta left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants