This PR refactors and generalizes the `test_mkldnn.py` tests to support multiple accelerator devices (CUDA, XPU, etc.) instead of being hard-coded to CUDA. The changes extract device-dependent tests into a separate class and parameterize them to run on all supported devices.
Changes/Commits:
1) Cleanup `TestMkldnn` class:
- Remove obsolete empty lines
- Remove unused `device` arguments
- **review can be brief, focusing on code organization and readability**
2) Refactor `TestMkldnn` into parametrized class
For CPU-only test classes we don't need to instantiate them using `instantiate_device_type_tests`, so this commit refactors the class into a parametrized class:
- replace `@dtypes` decorator with `@parametrize`
- replace `instantiate_device_type_tests` with `instantiate_parametrized_tests`
- hardcode `device = "cpu"` for a CPU-only test
- **review can be brief, focusing on code organization and readability**
3) Extract device-dependent test case into separate class
- move the `test_unsupported` into the `TestMkldnnDevice` class
- instantiate `TestMkldnnDevice` via `instantiate_device_type_tests` for CPU-only
- **review can be brief, focusing on code organization and readability**
4) Generalize device dependent tests
- add `device` argument to test method
- replace hard-coded CUDA device with the new argument
- add an `@onlyAccelerator` decorator
- remove CPU-only restriction when instantiating test class
5) Enable `test_mkldnn.py` on XPU
- add `allow_xpu=True` parameter to `instantiate_device_type_tests()` call
6) Add hardware classification
7) Rename `compiled_autograd_skips/` and `dynamo_expected_failures/` files
8) Update `test_lstm` entry in the `slow_tests.json` file
Pull Request resolved: https://github.com/pytorch/pytorch/pull/191740
Approved by: https://github.com/AKloniecki, https://github.com/daisyden, https://github.com/etaf, https://github.com/CuiYifeng, https://github.com/jansel