Repository navigation
[ROCm] Use ASSERT_NEAR for final LSTM states in BidirectionalLSTMReverseForward - #199922
pablo-garay wants to merge 1 commit into
Conversation
…rseForward The per-timestep output comparison already uses ASSERT_NEAR with a 1e-5 tolerance since the ROCm 6.3 upgrade, but the final hidden and cell state checks still used exact ASSERT_EQ. Now that C++ tests actually run on ROCm CI, the h_n check fails on MI210 by about 1.5e-8. Apply the same tolerance to h_n and c_n. Signed-off-by: pablo-garay <[email protected]>
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/199922
Note: Links to docs will display an error until the docs builds have been completed. ✅ No FailuresAs of commit 303d291 with merge base 3374f39 ( This comment was automatically generated by Dr. CI and updates every 15 minutes. |
|
@pytorchbot label ciflow/rocm-mi200 |
|
The ciflow label(s) ciflow/rocm-mi200 will be added, but CI won't be triggered until the workflows are approved (scroll to the bottom of this page). Please ping one of the reviewers if you do not have access to approve and run workflows. |
|
|
jeffdaily
left a comment
There was a problem hiding this comment.
LGTM. The per-step outputs already use ASSERT_NEAR with this tolerance, so the final h_n/c_n checks now match; the observed ~1.5e-8 difference is float32 rounding, which this test only started seeing on ROCm once test_api actually ran there (#199440).
|
@pytorchbot merge |
Merge startedYour change will be merged once all checks pass (ETA 0-4 Hours). Learn more about merging in the wiki. Questions? Feedback? Please reach out to the PyTorch DevX Team |
Merge failedReason: 1 mandatory check(s) failed. The first few are: Dig deeper by viewing the failures on hud |
|
@pytorchbot merge |
Merge startedYour change will be merged once all checks pass (ETA 0-4 Hours). Learn more about merging in the wiki. Questions? Feedback? Please reach out to the PyTorch DevX Team |
…rseForward (pytorch#199922) `RNNTest.BidirectionalLSTMReverseForward_CUDA` in `cpp/test_api` fails consistently on ROCm MI210 (`linux-jammy-rocm-py3.11-mi200`, original run plus 2 reruns), e.g. https://github.com/pytorch/pytorch/actions/runs/37407982276/job/112113883767: ``` test/cpp/api/rnn.cpp:544: Failure Expected equality of these values: std::get<0>(std::get<1>(bi_output))[1][0][0].item<float>() Which is: -0.240088522 std::get<0>(std::get<1>(reverse_output))[0][0][0].item<float>() Which is: -0.240088537 ``` **Root cause:** the ROCm 6.3 upgrade (pytorch#142152) switched the per-timestep output comparison in this test to `ASSERT_NEAR` with `tolerance = 1e-5`, but left the final hidden/cell state (`h_n`/`c_n`) checks as exact `ASSERT_EQ`. Those checks never actually ran on ROCm because `test_api` collected 0 tests there until pytorch#199440 ("Fix C++ tests silently not running on ROCm CI") landed. Now that it runs, `h_n` differs by ~1.5e-8 (float32 rounding). The reverse-direction `h_n` is the same value as the last reverse output the loop already compares with tolerance, so the exact check is inconsistent within the test itself. **Fix:** use `ASSERT_NEAR` with the test's existing `tolerance` for the `h_n` and `c_n` checks. No new tolerance is introduced; CPU and CUDA behavior is unaffected beyond allowing the same 1e-5 slack already used for outputs. **Testing:** the observed difference (1.5e-8) is well within the existing 1e-5 tolerance; relying on ROCm CI for the C++ test run. This PR was authored with the help of an AI assistant. Pull Request resolved: pytorch#199922 Approved by: https://github.com/jeffdaily
RNNTest.BidirectionalLSTMReverseForward_CUDAincpp/test_apifails consistently on ROCm MI210 (linux-jammy-rocm-py3.11-mi200, original run plus 2 reruns), e.g. https://github.com/pytorch/pytorch/actions/runs/37407982276/job/112113883767:Root cause: the ROCm 6.3 upgrade (#142152) switched the per-timestep output comparison in this test to
ASSERT_NEARwithtolerance = 1e-5, but left the final hidden/cell state (h_n/c_n) checks as exactASSERT_EQ. Those checks never actually ran on ROCm becausetest_apicollected 0 tests there until #199440 ("Fix C++ tests silently not running on ROCm CI") landed. Now that it runs,h_ndiffers by ~1.5e-8 (float32 rounding). The reverse-directionh_nis the same value as the last reverse output the loop already compares with tolerance, so the exact check is inconsistent within the test itself.Fix: use
ASSERT_NEARwith the test's existingtolerancefor theh_nandc_nchecks. No new tolerance is introduced; CPU and CUDA behavior is unaffected beyond allowing the same 1e-5 slack already used for outputs.Testing: the observed difference (1.5e-8) is well within the existing 1e-5 tolerance; relying on ROCm CI for the C++ test run.
This PR was authored with the help of an AI assistant.
cc @jeffdaily @sunway513 @jithunnair-amd @pruthvistony @ROCmSupport @jataylo @hongxiayang @naromero77amd @pragupta @jerrymannil @xinyazhang