Skip to content

Enable eager tests for inductor-unittest - - Enabel more tests in test_ops.py on Intel GPU - #178849

Closed
daisyden wants to merge 103 commits into
mainfrom
gh/daisyden/13/head
Closed

daisyden wants to merge 103 commits into
mainfrom
gh/daisyden/13/head

Conversation

@daisyden

@daisyden daisyden commented Mar 31, 2026 •

Copy link
Copy Markdown
Collaborator

daisyden added 22 commits March 6, 2026 07:22
disable torch.half and torch.complex32 on XPU for some fft ops before they are implemented
update dot and vdot dtypes according to latest implementation.

[ghstack-poisoned]
…_fwd_gradients.py and test_ops_gradients.py on Intel GPU"

[ghstack-poisoned]
… enable test_ops_fwd_gradients.py and test_ops_gradients.py on Intel GPU"

[ghstack-poisoned]
…_fwd_gradients.py and test_ops_gradients.py on Intel GPU"

[ghstack-poisoned]
…test - enable test_ops_fwd_gradients.py and test_ops_gradients.py on Intel GPU"

[ghstack-poisoned]
…st_ops_fwd_gradients.py and test_ops_gradients.py on Intel GPU"

[ghstack-poisoned]
…test - enable test_ops_fwd_gradients.py and test_ops_gradients.py on Intel GPU"

[ghstack-poisoned]
…st_ops_fwd_gradients.py and test_ops_gradients.py on Intel GPU"

[ghstack-poisoned]
…test - enable test_ops_fwd_gradients.py and test_ops_gradients.py on Intel GPU"

[ghstack-poisoned]
…st_ops_fwd_gradients.py and test_ops_gradients.py on Intel GPU"

[ghstack-poisoned]
…test - enable test_ops_fwd_gradients.py and test_ops_gradients.py on Intel GPU"

1. Enable xpu with instantiate_device_type_tests() allow_xpu=True augument
2. Added backward_failure_skips and _skip_backward_failures() to skip cases failed on xpu due to known limitations, avoid too much updates in op_db. 





[ghstack-poisoned]
…st_ops_fwd_gradients.py and test_ops_gradients.py on Intel GPU"

1. Enable xpu with instantiate_device_type_tests() allow_xpu=True augument
2. Added backward_failure_skips and _skip_backward_failures() to skip cases failed on xpu due to known limitations, avoid too much updates in op_db. 





[ghstack-poisoned]
…test - enable test_ops_fwd_gradients.py and test_ops_gradients.py on Intel GPU"

1. Enable xpu with instantiate_device_type_tests() allow_xpu=True augument
2. Added backward_failure_skips and _skip_backward_failures() to skip cases failed on xpu due to known limitations, avoid too much updates in op_db. 





[ghstack-poisoned]
…st_ops_fwd_gradients.py and test_ops_gradients.py on Intel GPU"

1. Enable xpu with instantiate_device_type_tests() allow_xpu=True augument
2. Added backward_failure_skips and _skip_backward_failures() to skip cases failed on xpu due to known limitations, avoid too much updates in op_db. 





[ghstack-poisoned]
…test - enable test_ops_fwd_gradients.py and test_ops_gradients.py on Intel GPU"

1. Enable xpu with instantiate_device_type_tests() allow_xpu=True augument
2. Added backward_failure_skips and _skip_backward_failures() to skip cases failed on xpu due to known limitations, avoid too much updates in op_db. 





[ghstack-poisoned]
…st_ops_fwd_gradients.py and test_ops_gradients.py on Intel GPU"

1. Enable xpu with instantiate_device_type_tests() allow_xpu=True augument
2. Added backward_failure_skips and _skip_backward_failures() to skip cases failed on xpu due to known limitations, avoid too much updates in op_db. 





[ghstack-poisoned]
…test - enable test_ops_fwd_gradients.py and test_ops_gradients.py on Intel GPU"

1. Enable xpu with instantiate_device_type_tests() allow_xpu=True augument
2. Added backward_failure_skips and _skip_backward_failures() to skip cases failed on xpu due to known limitations, avoid too much updates in op_db. 





[ghstack-poisoned]
…st_ops_fwd_gradients.py and test_ops_gradients.py on Intel GPU"

1. Enable xpu with instantiate_device_type_tests() allow_xpu=True augument
2. Added backward_failure_skips and _skip_backward_failures() to skip cases failed on xpu due to known limitations, avoid too much updates in op_db. 





[ghstack-poisoned]
…test - enable test_ops_fwd_gradients.py and test_ops_gradients.py on Intel GPU"

1. Enable xpu with instantiate_device_type_tests() allow_xpu=True augument
2. Added backward_failure_skips and _skip_backward_failures() to skip cases failed on xpu due to known limitations, avoid too much updates in op_db. 





[ghstack-poisoned]
…st_ops_fwd_gradients.py and test_ops_gradients.py on Intel GPU"

1. Enable xpu with instantiate_device_type_tests() allow_xpu=True augument
2. Added backward_failure_skips and _skip_backward_failures() to skip cases failed on xpu due to known limitations, avoid too much updates in op_db. 





[ghstack-poisoned]
…s they are the same xfail as 'cuda' or other devices, use device list like ('cuda', 'xpu') in DecorateInfo device_type.

[ghstack-poisoned]
@pytorch-bot

pytorch-bot Bot commented Mar 31, 2026 •

Copy link
Copy Markdown

🔗 Helpful Links

🧪 See artifacts and rendered test results at hud.pytorch.org/pr/178849

Note: Links to docs will display an error until the docs builds have been completed.

✅ You can merge normally! (126 Unrelated Failures)

As of commit 7fbe230 with merge base 323af40 (image):

CRCR (non-blocking) - The following CRCR downstream CI jobs failed but are non-blocking:

This comment was automatically generated by Dr. CI and updates every 15 minutes.

[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
@daisyden

Copy link
Copy Markdown
Collaborator Author

@pytorchbot merge

@pytorch-bot pytorch-bot Bot added the ciflow/trunk Trigger trunk jobs on your pull request label Aug 19, 2026
@pytorchmergebot

Copy link
Copy Markdown
Collaborator

Merge failed

Reason: PR 178849 is out of sync with the corresponding revision 4a3b320 on branch gh/daisyden/13/orig that would be merged into main. This usually happens because there is a non ghstack change in the PR. Please sync them and try again (ex. make the changes on origin/gh/daisyden/13/orig and run ghstack).

Details for Dev Infra team Raised by workflow job

@daisyden

Copy link
Copy Markdown
Collaborator Author

@pytorchbot merge

@pytorchmergebot

Copy link
Copy Markdown
Collaborator

Merge failed

Reason: PR 178849 is out of sync with the corresponding revision 4a3b320 on branch gh/daisyden/13/orig that would be merged into main. This usually happens because there is a non ghstack change in the PR. Please sync them and try again (ex. make the changes on origin/gh/daisyden/13/orig and run ghstack).

Details for Dev Infra team Raised by workflow job

[ghstack-poisoned]
[ghstack-poisoned]
@daisyden

Copy link
Copy Markdown
Collaborator Author

@pytorchbot merge

@pytorchmergebot

Copy link
Copy Markdown
Collaborator

Merge started

Your 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

Advanced Debugging
Check the merge workflow status
here

cyyever pushed a commit to cyyever/pytorch that referenced this pull request Aug 22, 2026
…t_ops.py on Intel GPU (pytorch#178849)

Add more cases in test_ops.py
    1. Generalize TestCommon, TestCompositeCompliance, TestMathBits, TestFakeTensor, TestForwardADWithScalars with onlyAccelerator
    2. Enable xpu test with instantiate_device_type_tests() allow_xpu=True augment
    3. skip cases or ops with limitations in xpu.
    4. remove skipIfXpu according to current status.

Pull Request resolved: pytorch#178849
Approved by: https://github.com/jansel, https://github.com/guangyey

(cherry picked from commit 02dbce8)
orrangetabby17 pushed a commit to orrangetabby17/pytorch that referenced this pull request Sep 2, 2026
…t_ops.py on Intel GPU (pytorch#178849)

Add more cases in test_ops.py
    1. Generalize TestCommon, TestCompositeCompliance, TestMathBits, TestFakeTensor, TestForwardADWithScalars with onlyAccelerator
    2. Enable xpu test with instantiate_device_type_tests() allow_xpu=True augment
    3. skip cases or ops with limitations in xpu.
    4. remove skipIfXpu according to current status.

Pull Request resolved: pytorch#178849
Approved by: https://github.com/jansel, https://github.com/guangyey
astachowiczhabana added a commit to astachowiczhabana/pytorch that referenced this pull request Sep 11, 2026
oneMKL provides no half-precision DFT, so torch-xpu-ops emulates one: it
upcasts Half to Float, runs both the transform and the normalization in
float32, and rounds to complex32 once at the end. Separately, pytorch#171231 added
"xpu" to maybe_support_half in torch/_refs/fft.py, which tells the reference
implementation that XPU supports half natively. The ref consequently stays in
float16 and rounds at every prim boundary, while the eager path it is compared
against quietly computed in float32.

test_python_ref, test_python_ref_torch_fallback and test_python_ref_executor
assert ref_distance <= torch_distance against a float64 baseline with no
tolerance, so the ref loses that comparison: 1.18x worse for ihfftn and 1.02x
for ihfft2, on 1 of 10 OpInfo samples. The XPU kernel is not wrong here; it is
more accurate than true float16 would be. No user-visible path is affected,
because inductor promotes float16 FFT to float32 (pytorch#180766) rather than lowering
through these refs, and compiled output is bit-identical to eager.

This adds five xpu-scoped, float16-only skips beside the existing cuda ones for
_refs.fft.ihfft2 and _refs.fft.ihfftn. It is a pure addition and leaves CUDA
behaviour untouched.

Three routes were available. Widening the existing decorators to
device_type=("cuda", "xpu") is terser, but it would attach comments describing
CUDA's native-float16 rounding to a structurally different XPU cause, so the
skips are added as separate entries carrying their own reason - which also
matches the pattern established by pytorch#176688 and pytorch#178849. Adding a tolerance to
the assertion itself would treat the cause and let CUDA, ROCm and XPU all drop
skips, but that single assertion guards every test_python_ref case on every
backend and dtype, so it needs primTorch ownership rather than an XPU change.
Making the refs compute in float32 and cast back to complex32 is the only route
that preserves coverage, but it puts device-conditional numerics inside a
deliberately device-agnostic reference library; that is left for discussion on
the linked issue.

These three tests are currently unreachable on XPU because of the @skipXPU
decorators on them in test/test_ops.py, which are being removed incrementally
(pytorch#159944 introduced them, pytorch#176688 and pytorch#178849 have removed most). Declaring the
skips here is the prerequisite for removing the remaining ones without turning
XPU CI red.

Test Plan

Verified on Intel Arc B570 Graphics (Battlemage). With both skip sources
disabled, exactly five cases fail; with this change they are skipped and the
rest of the selection still passes.

```
cd third_party/torch-xpu-ops
python -m pytest test/xpu/test_ops_xpu.py \
  -k "python_ref and (ihfft2 or ihfftn)" -v --timeout=600
```

```
before (both skip sources disabled):  5 failed, 11 passed
after  (this change):                 0 failed, 68 passed, 14 skipped
```

The skip set was additionally cross-checked by evaluating
DecorateInfo.is_active over both ops, all three tests and all ten instantiated
dtypes for device_type in (cuda, xpu): it matches the five measured failures
exactly, and CUDA's set is unchanged.

```
lintrunner -a torch/testing/_internal/opinfo/definitions/fft.py
ok No lint issues.
```

Authored with the assistance of an AI coding agent; the change and the test
output above come from a run on Intel GPU hardware and were reviewed by a human
before submission.

AI-Assisted: Claude Code (xpu-workspace ai_assisted agent, issue pytorch#174)
Co-Authored-By: Claude Opus 5 <[email protected]>
@github-actions
github-actions Bot deleted the gh/daisyden/13/head branch November 7, 2026 01:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ciflow/trunk Trigger trunk jobs on your pull request ciflow/xpu Run XPU CI tasks Merged open source release notes: python_frontend python frontend release notes category triaged This issue has been looked at a team member, and triaged and prioritized into an appropriate module

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

6 participants