Skip to content

Conversation

@amathewc
Copy link
Contributor

@amathewc amathewc commented Jan 23, 2025

This PR is a continuation of #144387 . Adapted two more files with the approach described below.

#MOTIVATION

We recently integrated support for Intel Gaudi devices (identified as 'hpu') into the common_device_type framework via the pull request at #126970. This integration allows tests to be automatically instantiated for Gaudi devices upon loading the relevant library. Building on this development, the current pull request extends the utility of these hooks by adapting selected CUDA tests to operate on Gaudi devices. Additionally, we have confirmed that these modifications do not interfere with the existing tests on CUDA devices.

Other accelerators can also extend the functionality by adding the device in the devices list. ( For eg: xpu )

#CHANGES

Create a separate class for test functions running on CUDA devices
Extend the functionality of these tests to include HPUs
Use instantiate_device_type_tests with targeted attributes to generate device-specific test instances within the new classes
Apply skipIfHPU decorator to bypass tests that are not yet compatible with HPU devices

cc @voznesenskym @penguinwu @EikanWang @jgong5 @Guobing-Chen @XiaobingSuper @zhuhaozhe @blzheng @wenzhe-nrv @jiayisunx @chenyang78 @kadeng @chauhang @amjames

@pytorch-bot
Copy link

pytorch-bot bot commented Jan 23, 2025

🔗 Helpful Links

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

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

✅ No Failures

As of commit 8e48628 with merge base 53fc921 (image):
💚 Looks good so far! There are no failures yet. 💚

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

@amathewc
Copy link
Contributor Author

@ankurneog , @EikanWang : please review

@cpuhrsch cpuhrsch requested review from albanD and yanboliang January 24, 2025 03:47
@cpuhrsch cpuhrsch added the triaged This issue has been looked at a team member, and triaged and prioritized into an appropriate module label Jan 24, 2025
@amathewc
Copy link
Contributor Author

@cpuhrsch , @EikanWang : Could you review this ?

@amathewc
Copy link
Contributor Author

amathewc commented Feb 5, 2025

@cpuhrsch , @EikanWang : Please review

Copy link
Collaborator

@EikanWang EikanWang left a comment

Choose a reason for hiding this comment

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

LGTM

@EikanWang
Copy link
Collaborator

@yanboliang , may I know if you have any comments on this PR? cc @albanD

@yanboliang
Copy link
Contributor

Looks good to me, please fix the test failures.

@amathewc
Copy link
Contributor Author

@pytorchbot rebase

@pytorchmergebot
Copy link
Collaborator

@pytorchbot started a rebase job onto refs/remotes/origin/viable/strict. Check the current status here

@pytorchmergebot
Copy link
Collaborator

Rebase failed due to Command git -C /home/runner/work/pytorch/pytorch rebase refs/remotes/origin/viable/strict pull/145476/head returned non-zero exit code 1

Rebasing (1/2)
Auto-merging test/dynamo/test_functions.py
CONFLICT (content): Merge conflict in test/dynamo/test_functions.py
Auto-merging test/dynamo/test_misc.py
error: could not apply 0211d3bf590... Adapt Dynamo Tests to HPUs
hint: Resolve all conflicts manually, mark them as resolved with
hint: "git add/rm <conflicted_files>", then run "git rebase --continue".
hint: You can instead skip this commit: run "git rebase --skip".
hint: To abort and get back to the state before "git rebase", run "git rebase --abort".
hint: Disable this message with "git config set advice.mergeConflict false"
Could not apply 0211d3bf590... Adapt Dynamo Tests to HPUs

Raised by https://github.com/pytorch/pytorch/actions/runs/13299905929

Revert test/dynamo/test_functions.py to original due to CI issues.
Will be fixing them in another PR.
@amathewc
Copy link
Contributor Author

@pytorchbot rebase

@pytorchmergebot
Copy link
Collaborator

@pytorchbot started a rebase job onto refs/remotes/origin/viable/strict. Check the current status here

@pytorchmergebot
Copy link
Collaborator

Rebase failed due to Command git -C /home/runner/work/pytorch/pytorch rebase refs/remotes/origin/viable/strict pull/145476/head returned non-zero exit code 1

Rebasing (1/3)
Auto-merging test/dynamo/test_functions.py
CONFLICT (content): Merge conflict in test/dynamo/test_functions.py
Auto-merging test/dynamo/test_misc.py
error: could not apply 0211d3bf590... Adapt Dynamo Tests to HPUs
hint: Resolve all conflicts manually, mark them as resolved with
hint: "git add/rm <conflicted_files>", then run "git rebase --continue".
hint: You can instead skip this commit: run "git rebase --skip".
hint: To abort and get back to the state before "git rebase", run "git rebase --abort".
hint: Disable this message with "git config set advice.mergeConflict false"
Could not apply 0211d3bf590... Adapt Dynamo Tests to HPUs

Raised by https://github.com/pytorch/pytorch/actions/runs/13324267703

@amathewc
Copy link
Contributor Author

amathewc commented Feb 14, 2025

@EikanWang , @yanboliang : Since test_functions.py was causing CI issues, I have reverted that file to its current merged version. Will be raising a separate PR for test_functions.py later. Would be helpful if you could reinitiate the CI tests and merge

@albanD albanD requested review from anijain2305 and removed request for albanD February 14, 2025 21:53
@amathewc
Copy link
Contributor Author

@yanboliang , @guangyey : Could you help in the review and merge of this PR?

return operator.truth(x) and bool(y)

opt_fn = torch.compile(fullgraph=True, dynamic=False)(fn)
opt_fn = torch.compile(dynamic=False)(fn)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why fullgraph is removed?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@guangyey : Initially, we had two files in this PR . test_functions.py and test_misc.py. test_functions.py was causing CI issues - We have identified why and trying to fix that . In the meanwhile, decided to go ahead with just test_misc.py in this PR . Had reverted test_functions.py to the current merged version . So, this change ( removing fullgraph) might have come from some other PR.
If this is causing confusion, I can delete this PR and create a new one with just test_misc.py. Let me know , if you think that is a better approach.

opt_fn = torch.compile(fn, backend="eager", fullgraph=True)
self.assertEqual(fn(torch.ones(3, 3)), opt_fn(torch.ones(3, 3)))

@unittest.skip("https://github.com/pytorch/pytorch/pull/146527 exposed a bug")
Copy link
Collaborator

Choose a reason for hiding this comment

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

If this PR does not introduce this bug, we should not skip the UT in this PR.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@guangyey : Replied above in the previous comment .

@anijain2305
Copy link
Contributor

Does this PR need rebasing? There are many changes which are not related to this PR.


self.assertEqual(fn(inputs, x), opt_fn(inputs, x))

def test_udf_tuple(self):
Copy link
Contributor

Choose a reason for hiding this comment

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

Does this require a rebase?

@amathewc amathewc closed this Feb 21, 2025
@amathewc
Copy link
Contributor Author

Closing this PR. Will be creating a new one with test_misc.py.

@amathewc amathewc deleted the dynamo_changes1 branch February 21, 2025 09:01
pytorchmergebot pushed a commit that referenced this pull request Apr 4, 2025
This PR is related to #145476 . That PR had two files (test_functions.py and test_misc.py) . test_functions was causing CI/rebase/merge issues and hence removed for now. This PR contains only test_misc.py.

This is a continuation of #144387 .

## MOTIVATION
We recently integrated support for Intel Gaudi devices (identified as 'hpu') into the common_device_type framework via the pull request at #126970. This integration allows tests to be automatically instantiated for Gaudi devices upon loading the relevant library. Building on this development, the current pull request extends the utility of these hooks by adapting selected CUDA tests to operate on Gaudi devices. Additionally, we have confirmed that these modifications do not interfere with the existing tests on CUDA devices.

Other accelerators can also extend the functionality by adding the device in the devices list. ( For eg: xpu )

## CHANGES
Create a separate class for test functions running on CUDA devices
Extend the functionality of these tests to include HPUs
Use instantiate_device_type_tests with targeted attributes to generate device-specific test instances within the new classes
Apply skipIfHPU decorator to bypass tests that are not yet compatible with HPU devices

PS: Most of these changes were initially part of #147609 , but closed that PR due to merge conflicts. The review comments were handled in this PR.

Pull Request resolved: #149499
Approved by: https://github.com/EikanWang, https://github.com/desertfire, https://github.com/cyyever
timocafe pushed a commit to timocafe/pytorch that referenced this pull request Apr 16, 2025
This PR is related to pytorch#145476 . That PR had two files (test_functions.py and test_misc.py) . test_functions was causing CI/rebase/merge issues and hence removed for now. This PR contains only test_misc.py.

This is a continuation of pytorch#144387 .

## MOTIVATION
We recently integrated support for Intel Gaudi devices (identified as 'hpu') into the common_device_type framework via the pull request at pytorch#126970. This integration allows tests to be automatically instantiated for Gaudi devices upon loading the relevant library. Building on this development, the current pull request extends the utility of these hooks by adapting selected CUDA tests to operate on Gaudi devices. Additionally, we have confirmed that these modifications do not interfere with the existing tests on CUDA devices.

Other accelerators can also extend the functionality by adding the device in the devices list. ( For eg: xpu )

## CHANGES
Create a separate class for test functions running on CUDA devices
Extend the functionality of these tests to include HPUs
Use instantiate_device_type_tests with targeted attributes to generate device-specific test instances within the new classes
Apply skipIfHPU decorator to bypass tests that are not yet compatible with HPU devices

PS: Most of these changes were initially part of pytorch#147609 , but closed that PR due to merge conflicts. The review comments were handled in this PR.

Pull Request resolved: pytorch#149499
Approved by: https://github.com/EikanWang, https://github.com/desertfire, https://github.com/cyyever
amathewc added a commit to amathewc/pytorch that referenced this pull request Apr 17, 2025
This PR is related to pytorch#145476 . That PR had two files (test_functions.py and test_misc.py) . test_functions was causing CI/rebase/merge issues and hence removed for now. This PR contains only test_misc.py.

This is a continuation of pytorch#144387 .

## MOTIVATION
We recently integrated support for Intel Gaudi devices (identified as 'hpu') into the common_device_type framework via the pull request at pytorch#126970. This integration allows tests to be automatically instantiated for Gaudi devices upon loading the relevant library. Building on this development, the current pull request extends the utility of these hooks by adapting selected CUDA tests to operate on Gaudi devices. Additionally, we have confirmed that these modifications do not interfere with the existing tests on CUDA devices.

Other accelerators can also extend the functionality by adding the device in the devices list. ( For eg: xpu )

## CHANGES
Create a separate class for test functions running on CUDA devices
Extend the functionality of these tests to include HPUs
Use instantiate_device_type_tests with targeted attributes to generate device-specific test instances within the new classes
Apply skipIfHPU decorator to bypass tests that are not yet compatible with HPU devices

PS: Most of these changes were initially part of pytorch#147609 , but closed that PR due to merge conflicts. The review comments were handled in this PR.

Pull Request resolved: pytorch#149499
Approved by: https://github.com/EikanWang, https://github.com/desertfire, https://github.com/cyyever
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

module: dynamo open source topic: not user facing topic category triaged This issue has been looked at a team member, and triaged and prioritized into an appropriate module

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants