Skip to content

[Test] Replace wrong-device patterns with torch.accelerator for test_linalg - #183588

Closed
RiyaP2508 wants to merge 10 commits into
gh/RiyaP2508/12/basefrom
gh/RiyaP2508/12/head
Closed

RiyaP2508 wants to merge 10 commits into
gh/RiyaP2508/12/basefrom
gh/RiyaP2508/12/head

Conversation

@RiyaP2508

@RiyaP2508 RiyaP2508 commented May 13, 2026 •

Copy link
Copy Markdown
Collaborator

Stack from ghstack (oldest at bottom):

Summary

Add _get_other_device() helper to TestLinalg and replace 16 hardcoded torch.cuda.is_available() + 'cuda' wrong-device error-path blocks with device-agnostic equivalents using torch.accelerator. Also replace complement_device helper and convert 6 device_type == 'cuda' tolerance branches to device_type != 'cpu'.

Test plan

  • TEST_CONFIG=cuda python3 test/run_test.py -i test_linalg - all passed
  • Syntax check passes

cC: @fffrog @albanD

@pytorch-bot

pytorch-bot Bot commented May 13, 2026 •

Copy link
Copy Markdown

🔗 Helpful Links

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

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

❌ 3 New Failures

As of commit 7230b9d with merge base 12b535b (image):

NEW FAILURES - The following jobs have failed:

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

…linalg

Add _get_other_device() helper and replace 16 hardcoded
torch.cuda.is_available() + 'cuda' wrong-device blocks. Also replace
complement_device helper and convert 6 device_type == 'cuda' tolerance
branches to device_type != 'cpu'.

[ghstack-poisoned]
@fffrog

fffrog commented May 18, 2026

Copy link
Copy Markdown
Collaborator

@pytorchbot merge -f

@pytorch-bot

pytorch-bot Bot commented May 18, 2026

Copy link
Copy Markdown

❌ 🤖 pytorchbot command failed:

@pytorchbot merge: error: argument -f/--force: expected one argument

usage: @pytorchbot merge [-f MESSAGE | -i] [-ic] [-r [{viable/strict,main}]]

Try @pytorchbot --help for more info.

@fffrog

fffrog commented May 18, 2026

Copy link
Copy Markdown
Collaborator

@pytorchbot merge -i

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

Copy link
Copy Markdown
Collaborator

Merge started

Your change will be merged while ignoring the following 1 checks: pull / linux-jammy-py3.10-gcc11 / test (backwards_compat, 1, 1, linux.c7i.2xlarge)

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

RiyaP2508 added a commit that referenced this pull request May 18, 2026
…linalg

Add _get_other_device() helper and replace 16 hardcoded
torch.cuda.is_available() + 'cuda' wrong-device blocks. Also replace
complement_device helper and convert 6 device_type == 'cuda' tolerance
branches to device_type != 'cpu'.

ghstack-source-id: b92f455
Pull Request resolved: #183588
…r for test_linalg"


## Summary

Add `_get_other_device()` helper to `TestLinalg` and replace 16 hardcoded `torch.cuda.is_available()` + `'cuda'` wrong-device error-path blocks with device-agnostic equivalents using `torch.accelerator`. Also replace `complement_device` helper and convert 6 `device_type == 'cuda'` tolerance branches to `device_type != 'cpu'`.

## Test plan
- [x] `TEST_CONFIG=cuda python3 test/run_test.py -i test_linalg` - all passed
- [x] Syntax check passes

cC: fffrog albanD 

[ghstack-poisoned]
@pytorchmergebot

Copy link
Copy Markdown
Collaborator

Merge failed

Reason: New commits were pushed while merging. Please rerun the merge command.

Details for Dev Infra team Raised by workflow job

@fffrog fffrog moved this from Backlog to Ready for Merge in PyTorch Test Refactoring May 19, 2026
RiyaP2508 added a commit that referenced this pull request May 21, 2026
…linalg

Add _get_other_device() helper with dtype capability check and replace
16 hardcoded torch.cuda.is_available() + 'cuda' wrong-device blocks.
Also replace complement_device helper and convert 6 device_type == 'cuda'
tolerance branches to device_type != 'cpu'.

ghstack-source-id: 14f6b3f
Pull Request resolved: #183588
…r for test_linalg"


## Summary

Add `_get_other_device()` helper to `TestLinalg` and replace 16 hardcoded `torch.cuda.is_available()` + `'cuda'` wrong-device error-path blocks with device-agnostic equivalents using `torch.accelerator`. Also replace `complement_device` helper and convert 6 `device_type == 'cuda'` tolerance branches to `device_type != 'cpu'`.

## Test plan
- [x] `TEST_CONFIG=cuda python3 test/run_test.py -i test_linalg` - all passed
- [x] Syntax check passes

cC: fffrog albanD 

[ghstack-poisoned]
RiyaP2508 added a commit that referenced this pull request May 22, 2026
…linalg

Add _get_other_device() helper with dtype capability check and replace
16 hardcoded torch.cuda.is_available() + 'cuda' wrong-device blocks.
Also replace complement_device helper and convert 6 device_type == 'cuda'
tolerance branches to device_type != 'cpu'.
ghstack-source-id: 6977377
Pull Request resolved: #183588
…r for test_linalg"


## Summary

Add `_get_other_device()` helper to `TestLinalg` and replace 16 hardcoded `torch.cuda.is_available()` + `'cuda'` wrong-device error-path blocks with device-agnostic equivalents using `torch.accelerator`. Also replace `complement_device` helper and convert 6 `device_type == 'cuda'` tolerance branches to `device_type != 'cpu'`.

## Test plan
- [x] `TEST_CONFIG=cuda python3 test/run_test.py -i test_linalg` - all passed
- [x] Syntax check passes

cC: fffrog albanD 

[ghstack-poisoned]
RiyaP2508 added a commit that referenced this pull request May 30, 2026
…linalg

Add _get_other_device() helper with dtype capability check and replace
16 hardcoded torch.cuda.is_available() + 'cuda' wrong-device blocks.
Also replace complement_device helper and convert 6 device_type == 'cuda'
tolerance branches to device_type != 'cpu'.
ghstack-source-id: 4b54975
Pull Request resolved: #183588
…r for test_linalg"


## Summary

Add `_get_other_device()` helper to `TestLinalg` and replace 16 hardcoded `torch.cuda.is_available()` + `'cuda'` wrong-device error-path blocks with device-agnostic equivalents using `torch.accelerator`. Also replace `complement_device` helper and convert 6 `device_type == 'cuda'` tolerance branches to `device_type != 'cpu'`.

## Test plan
- [x] `TEST_CONFIG=cuda python3 test/run_test.py -i test_linalg` - all passed
- [x] Syntax check passes

cC: fffrog albanD 

[ghstack-poisoned]
RiyaP2508 added a commit that referenced this pull request May 31, 2026
…linalg

Add _get_other_device() helper with dtype capability check and replace
16 hardcoded torch.cuda.is_available() + 'cuda' wrong-device blocks.
Also replace complement_device helper and convert 6 device_type == 'cuda'
tolerance branches to device_type != 'cpu'.
ghstack-source-id: b789246
Pull Request resolved: #183588
…r for test_linalg"


## Summary

Add `_get_other_device()` helper to `TestLinalg` and replace 16 hardcoded `torch.cuda.is_available()` + `'cuda'` wrong-device error-path blocks with device-agnostic equivalents using `torch.accelerator`. Also replace `complement_device` helper and convert 6 `device_type == 'cuda'` tolerance branches to `device_type != 'cpu'`.

## Test plan
- [x] `TEST_CONFIG=cuda python3 test/run_test.py -i test_linalg` - all passed
- [x] Syntax check passes

cC: fffrog albanD 

[ghstack-poisoned]
RiyaP2508 added a commit that referenced this pull request May 31, 2026
…linalg

Add _get_other_device() helper with dtype capability check and replace
16 hardcoded torch.cuda.is_available() + 'cuda' wrong-device blocks.
Also replace complement_device helper and convert 6 device_type == 'cuda'
tolerance branches to device_type != 'cpu'.
ghstack-source-id: e1efbaf
Pull Request resolved: #183588
…r for test_linalg"


## Summary

Add `_get_other_device()` helper to `TestLinalg` and replace 16 hardcoded `torch.cuda.is_available()` + `'cuda'` wrong-device error-path blocks with device-agnostic equivalents using `torch.accelerator`. Also replace `complement_device` helper and convert 6 `device_type == 'cuda'` tolerance branches to `device_type != 'cpu'`.

## Test plan
- [x] `TEST_CONFIG=cuda python3 test/run_test.py -i test_linalg` - all passed
- [x] Syntax check passes

cC: fffrog albanD 

[ghstack-poisoned]
RiyaP2508 added a commit that referenced this pull request May 31, 2026
…linalg

Add _get_other_device() helper with dtype capability check and replace
16 hardcoded torch.cuda.is_available() + 'cuda' wrong-device blocks.
Also replace complement_device helper and convert 6 device_type == 'cuda'
tolerance branches to device_type != 'cpu'.
ghstack-source-id: c2bbf71
Pull Request resolved: #183588
…r for test_linalg"


## Summary

Add `_get_other_device()` helper to `TestLinalg` and replace 16 hardcoded `torch.cuda.is_available()` + `'cuda'` wrong-device error-path blocks with device-agnostic equivalents using `torch.accelerator`. Also replace `complement_device` helper and convert 6 `device_type == 'cuda'` tolerance branches to `device_type != 'cpu'`.

## Test plan
- [x] `TEST_CONFIG=cuda python3 test/run_test.py -i test_linalg` - all passed
- [x] Syntax check passes

cC: fffrog albanD 

[ghstack-poisoned]
RiyaP2508 added a commit that referenced this pull request Jun 1, 2026
…linalg

Add _get_other_device() helper with dtype capability check and replace
16 hardcoded torch.cuda.is_available() + 'cuda' wrong-device blocks.
Also replace complement_device helper and convert 6 device_type == 'cuda'
tolerance branches to device_type != 'cpu'.
ghstack-source-id: c4b0f48
Pull Request resolved: #183588
…r for test_linalg"


## Summary

Add `_get_other_device()` helper to `TestLinalg` and replace 16 hardcoded `torch.cuda.is_available()` + `'cuda'` wrong-device error-path blocks with device-agnostic equivalents using `torch.accelerator`. Also replace `complement_device` helper and convert 6 `device_type == 'cuda'` tolerance branches to `device_type != 'cpu'`.

## Test plan
- [x] `TEST_CONFIG=cuda python3 test/run_test.py -i test_linalg` - all passed
- [x] Syntax check passes

cC: fffrog albanD 

[ghstack-poisoned]
RiyaP2508 added a commit that referenced this pull request Jun 1, 2026
…linalg

Add _get_other_device() helper with dtype capability check and replace
16 hardcoded torch.cuda.is_available() + 'cuda' wrong-device blocks.
Also replace complement_device helper and convert 6 device_type == 'cuda'
tolerance branches to device_type != 'cpu'.
ghstack-source-id: 2915325
Pull Request resolved: #183588
…r for test_linalg"


## Summary

Add `_get_other_device()` helper to `TestLinalg` and replace 16 hardcoded `torch.cuda.is_available()` + `'cuda'` wrong-device error-path blocks with device-agnostic equivalents using `torch.accelerator`. Also replace `complement_device` helper and convert 6 `device_type == 'cuda'` tolerance branches to `device_type != 'cpu'`.

## Test plan
- [x] `TEST_CONFIG=cuda python3 test/run_test.py -i test_linalg` - all passed
- [x] Syntax check passes

cC: fffrog albanD 

[ghstack-poisoned]
@RiyaP2508

Copy link
Copy Markdown
Collaborator Author

@pytorchbot merge -i

@pytorchmergebot

Copy link
Copy Markdown
Collaborator

Merge started

Your change will be merged while ignoring the following 3 checks: pull / linux-docs / build-docs-cpp-false, pull / linux-docs / build-docs-python-false, trunk / linux-jammy-cuda13.0-py3.10-gcc11 / test-osdc (pr_time_benchmarks, 1, 1, mt-l-bx86iavx512-94-344-t4-8)

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

@pytorchmergebot

Copy link
Copy Markdown
Collaborator

Merge failed

Reason: Merge rule check failed for stacked PR #183586:

2 mandatory check(s) failed. The first few are:

Dig deeper by viewing the failures on hud

Details for Dev Infra team Raised by workflow job

Failing merge rule: Core Maintainers

@RiyaP2508

Copy link
Copy Markdown
Collaborator Author

@pytorchbot merge -f "linux-docs failures are infra issues (aws CLI missing), not related to PR changes"

@pytorchmergebot

Copy link
Copy Markdown
Collaborator

Merge started

Your change will be merged immediately since you used the force (-f) flag, bypassing any CI checks (ETA: 1-5 minutes). Please use -f as last resort and instead consider -i/--ignore-current to continue the merge ignoring current failures. This will allow currently pending tests to finish and report signal before the merge.

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

@github-project-automation github-project-automation Bot moved this from Ready for Merge to Done in PyTorch Test Refactoring Jun 2, 2026
@github-actions
github-actions Bot deleted the gh/RiyaP2508/12/head branch July 2, 2026 02:29
gplutop7 pushed a commit to gplutop7/pytorch that referenced this pull request Jul 15, 2026
…linalg (pytorch#183588)

## Summary

Add `_get_other_device()` helper to `TestLinalg` and replace 16 hardcoded `torch.cuda.is_available()` + `'cuda'` wrong-device error-path blocks with device-agnostic equivalents using `torch.accelerator`. Also replace `complement_device` helper and convert 6 `device_type == 'cuda'` tolerance branches to `device_type != 'cpu'`.

## Test plan
- [x] `TEST_CONFIG=cuda python3 test/run_test.py -i test_linalg` - all passed
- [x] Syntax check passes

cC: @fffrog @albanD
Pull Request resolved: pytorch#183588
Approved by: https://github.com/Skylion007, https://github.com/fffrog
ghstack dependencies: pytorch#183586, pytorch#183587
aws-kingrj pushed a commit to amazon-contributing/upstream-to-pytorch that referenced this pull request Jul 29, 2026
…linalg (pytorch#183588)

## Summary

Add `_get_other_device()` helper to `TestLinalg` and replace 16 hardcoded `torch.cuda.is_available()` + `'cuda'` wrong-device error-path blocks with device-agnostic equivalents using `torch.accelerator`. Also replace `complement_device` helper and convert 6 `device_type == 'cuda'` tolerance branches to `device_type != 'cpu'`.

## Test plan
- [x] `TEST_CONFIG=cuda python3 test/run_test.py -i test_linalg` - all passed
- [x] Syntax check passes

cC: @fffrog @albanD
Pull Request resolved: pytorch#183588
Approved by: https://github.com/Skylion007, https://github.com/fffrog
ghstack dependencies: pytorch#183586, pytorch#183587
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 Merged open source topic: not user facing topic category

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

5 participants