test(decomp): allow PrivateUse1 backends to override dtype tolerances#42
Open
AbigailFernandes wants to merge 1 commit into
Open
test(decomp): allow PrivateUse1 backends to override dtype tolerances#42AbigailFernandes wants to merge 1 commit into
AbigailFernandes wants to merge 1 commit into
Conversation
test_decomp.py maintains its own dtype_precisions table separate from torch.testing._comparison._DTYPE_PRECISIONS. When a PrivateUse1 backend is registered, merge the two tables taking the loosest tolerance per dtype. This allows backends that downcast float64→float32 to relax tolerances via the standard _DTYPE_PRECISIONS API without modifying this file. No behavior change for CPU/CUDA (values are identical, no override).
| _r0, _a0 = dtype_precisions[_dt] | ||
| _r1, _a1 = _cmp._DTYPE_PRECISIONS[_dt] | ||
| dtype_precisions[_dt] = (max(_r0, _r1), max(_a0, _a1)) | ||
| except RuntimeError: |
svskvar
reviewed
Apr 24, 2026
| for _dt in dtype_precisions: | ||
| if _dt in _cmp._DTYPE_PRECISIONS: | ||
| _r0, _a0 = dtype_precisions[_dt] | ||
| _r1, _a1 = _cmp._DTYPE_PRECISIONS[_dt] |
There was a problem hiding this comment.
If we have entries for backend, can we apply to set them directly? instead of checking max between them
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
test_decomp.py maintains its own dtype_precisions table separate from torch.testing._comparison._DTYPE_PRECISIONS. When a PrivateUse1 backend is registered, merge the two tables taking the loosest tolerance per dtype. This allows backends that downcast float64→float32 to relax tolerances via the standard _DTYPE_PRECISIONS API without modifying this file.
No behavior change for CPU/CUDA (values are identical, no override).
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.