Skip to content

test(decomp): allow PrivateUse1 backends to override dtype tolerances#42

Open
AbigailFernandes wants to merge 1 commit into
mainfrom
fix/aten_decomp
Open

test(decomp): allow PrivateUse1 backends to override dtype tolerances#42
AbigailFernandes wants to merge 1 commit into
mainfrom
fix/aten_decomp

Conversation

@AbigailFernandes
Copy link
Copy Markdown
Collaborator

@AbigailFernandes AbigailFernandes commented Apr 24, 2026

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.

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).
@AbigailFernandes AbigailFernandes marked this pull request as ready for review April 24, 2026 04:39
Comment thread test/test_decomp.py
_r0, _a0 = dtype_precisions[_dt]
_r1, _a1 = _cmp._DTYPE_PRECISIONS[_dt]
dtype_precisions[_dt] = (max(_r0, _r1), max(_a0, _a1))
except RuntimeError:
Comment thread test/test_decomp.py
for _dt in dtype_precisions:
if _dt in _cmp._DTYPE_PRECISIONS:
_r0, _a0 = dtype_precisions[_dt]
_r1, _a1 = _cmp._DTYPE_PRECISIONS[_dt]
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

If we have entries for backend, can we apply to set them directly? instead of checking max between them

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