Skip to content

Conversation

@amathewc
Copy link
Contributor

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.

CHANGES

  • Add support for HPU devices within the test_move_exported_model_bn using TEST_HPU flag
  • Use instantiate_device_type_tests with targeted attributes to generate device-specific test instances.
  • Apply skipIfHPU decorator to bypass tests that are not yet compatible with HPU devices.

@amathewc amathewc requested a review from jerryzh168 as a code owner October 13, 2024 13:13
@pytorch-bot
Copy link

pytorch-bot bot commented Oct 13, 2024

🔗 Helpful Links

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

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

✅ No Failures

As of commit 5e7e7ed with merge base 23fb8ba (image):
💚 Looks good so far! There are no failures yet. 💚

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

@pytorch-bot pytorch-bot bot added release notes: quantization release notes category topic: not user facing topic category labels Oct 13, 2024
@albanD albanD added the triaged This issue has been looked at a team member, and triaged and prioritized into an appropriate module label Oct 15, 2024
@amathewc
Copy link
Contributor Author

amathewc commented Oct 28, 2024

@jerryzh168, @albanD : Could you review this PR?

Copy link
Contributor

Choose a reason for hiding this comment

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

is this the only test you need to add hpu?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

currently we are adapting only those tests which are run on CUDA devices. Not adapting the CPU only tests.

@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

Successfully rebased quantization_pt2e_hpu onto refs/remotes/origin/viable/strict, please pull locally before adding more changes (for example, via git checkout quantization_pt2e_hpu && git pull --rebase)

@ankurneog
Copy link

@pytorchbot merge

@pytorch-bot pytorch-bot bot added the ciflow/trunk Trigger trunk jobs on your pull request label Oct 29, 2024
@pytorchmergebot
Copy link
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

rahulsingh-intel pushed a commit to rahulsingh-intel/pytorch that referenced this pull request Nov 5, 2024
**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.

**CHANGES**
- Add support for HPU devices within the test_move_exported_model_bn using TEST_HPU flag
- Use instantiate_device_type_tests with targeted attributes to generate device-specific test instances.
- Apply skipIfHPU decorator to bypass tests that are not yet compatible with HPU devices.
Pull Request resolved: pytorch#137863
Approved by: https://github.com/jerryzh168
@amathewc amathewc deleted the quantization_pt2e_hpu branch November 8, 2024 09:13
Comment on lines +2345 to +2348
devices = ["cpu", "cuda"]
if TEST_HPU:
devices.append("hpu")
instantiate_device_type_tests(TestQuantizePT2E, globals(), only_for=devices)
Copy link
Contributor

Choose a reason for hiding this comment

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

cc @amathewc this seems to break the import of TestQuantizePT2E, did you run test for the change?

WARNING:root:cannot import name 'TestQuantizePT2E' from 'quantization.pt2e.test_quantize_pt2e' (/data/users/jerryzh/pytorch/test/quantization/pt2e/test_quantize_pt2e.py)

Copy link
Contributor Author

@amathewc amathewc Nov 12, 2024

Choose a reason for hiding this comment

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

@jerryzh168 : Since we are using instantiate_device_type_tests , the test will get instantiated for each device in the system.
Launching the tests with # pytest -vs test_quantize_pt2e.py (without specifying a class name ) will launch the tests on all devices.
If you want the tests to be run

  • specifically on CPUs : pytest -vs test_quantize_pt2e.py::TestQuantizePT2ECPU
  • specifically on CUDA devices: pytest -vs test_quantize_pt2e.py::TestQuantizePT2ECUDA
  • specifically on HPUs: pytest -vs test_quantize_pt2e.py::TestQuantizePT2EHPU

image

Copy link
Contributor

Choose a reason for hiding this comment

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

I see, thanks, but we are using python test/test_quantization.py -k test_name e.g. python test/test_quantization.py -k test_simple_quantizer to run all the other tests, so this should work, can you check how to make this work?

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 release notes: quantization release notes category 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.

6 participants