Repository navigation
Conversation
Add HardwareClassification import and classify 6 non-mixed classes: - FakeTensorConstHandling: GENERIC - FakeTensorOpInfoTest: ACCELERATOR - FakeTensorConverterTest: GENERIC - FakeTensorSerialization: GENERIC - FakeTensorMetaDevicePropagation: GENERIC - FakeTensorViewCopy: GENERIC 459/459 test count preserved.
- FakeTensorPreferDeviceType (GENERIC): test_fake_tensor_prefer_device_type_cpu_only - FakeTensorPreferDeviceTypeCUDA (CUDA): test_fake_tensor_prefer_device_type 459/459 test count preserved.
- FakeTensorPropTest (GENERIC): 6 CPU tests - FakeTensorPropTestCUDA (CUDA): test_torch_load_with_fake_mode - Added make_propagate_real_tensors_cls for CUDA class 459/459 test count preserved.
- FakeTensorDispatchCache (GENERIC): 29 CPU tests - FakeTensorDispatchCacheCUDA (CUDA): test_cache_key_device, test_cache_default_device, test_wrapper_tensor_subclass_different_device 459/459 test count preserved.
- FakeTensorOperatorInvariants (GENERIC): 12 CPU tests - FakeTensorOperatorInvariantsCUDA (CUDA): test_move_meta_tensor, test_conv_c1_backward, test_module_to 459/459 test count preserved.
Split FakeTensorTest (140 test methods) into: - FakeTensorTest (GENERIC): ~108 CPU/device-agnostic tests - FakeTensorTestCUDA (CUDA): 32 CUDA-guarded tests Both classes have instantiate_parametrized_tests() and make_propagate_real_tensors_cls() called on them to preserve parametrized test expansion and PropagateRealTensors variants. Test count verified: 459/459 tests preserved. CUDA tests extracted include: - 29 tests guarded with @skipIf(not RUN_CUDA)/@skipUnless(RUN_CUDA) - 2 tests guarded with @skipIf(not torch.cuda._is_compiled()) - 1 test guarded with @skipIf(not torch.backends.cuda.is_built()) Helper methods checkType() and checkMetaProps() were duplicated into FakeTensorTestCUDA since CUDA tests reference them via self. Depends on pytorch#186918 for the HardwareClassification enum. Follows the RFC Test class classification (pytorch#185142, pytorch#185590).
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/193986
Note: Links to docs will display an error until the docs builds have been completed. This comment was automatically generated by Dr. CI and updates every 15 minutes. |
vishalgoyal316
left a comment
There was a problem hiding this comment.
Request changes — good overall split strategy, but a few blocking issues:
-
Rebase onto current main — branch is ~537 commits behind with a merge conflict in test/test_fake_tensor.py. Main added 7 tests since this branch diverged; classify them after rebase.
-
FakeTensorDispatchCacheCUDA missing helpers — it extends TestCase but calls _test_cache_key() and assertHitsMisses() from FakeTensorDispatchCache. Prefer class FakeTensorDispatchCacheCUDA(FakeTensorDispatchCache) with hw_classification = CUDA over duplicating helpers.
-
test_move_module_under_fake in wrong class — on main it's in FakeTensorOperatorInvariants; the PR put it in FakeTensorTestCUDA. Move it to FakeTensorOperatorInvariantsCUDA with the other CUDA operator-invariant tests.
Split integrity otherwise looks good — 459/459 preserved at branch time, instantiate_parametrized_tests / make_propagate_real_tensors_cls applied correctly.
|
Looks like this PR hasn't been updated in a while so we're going to go ahead and mark this as |
Summary
Classifies all 16 test classes in
test/test_fake_tensor.pywithHardwareClassificationattributes6 non-mixed classes classified directly:
FakeTensorConstHandling→ GENERICFakeTensorOpInfoTest→ ACCELERATORFakeTensorConverterTest→ GENERICFakeTensorSerialization→ GENERICFakeTensorMetaDevicePropagation→ GENERICFakeTensorViewCopy→ GENERIC5 mixed classes split into GENERIC + CUDA pairs:
FakeTensorTest(140 methods) → GENERIC (~108 CPU) +FakeTensorTestCUDA(32 CUDA)FakeTensorPreferDeviceType→ GENERIC (1 CPU) +FakeTensorPreferDeviceTypeCUDA(1 CUDA)FakeTensorPropTest→ GENERIC (6 CPU) +FakeTensorPropTestCUDA(1 CUDA)FakeTensorDispatchCache→ GENERIC (29 CPU) +FakeTensorDispatchCacheCUDA(3 CUDA)FakeTensorOperatorInvariants→ GENERIC (12 CPU) +FakeTensorOperatorInvariantsCUDA(3 CUDA)All split CUDA classes have
instantiate_parametrized_tests()and/ormake_propagate_real_tensors_cls()called on them where the original class had those calls, preserving parametrized test expansion and PropagateRealTensors variants. 459/459 tests preserved.Test plan
python -m pytest --collect-only -q test/test_fake_tensor.py→ 459 teststest_cuda_gru—UnsupportedOperatorExceptionforaten._thnn_fused_gru_cell.default, reproduces on cleanupstream/main)lintrunner -acleanast.parsevalidates after every extraction stepDepends on #186918 for the
HardwareClassificationenum. Follows the RFC test class classification (#185142, #185390)Co-authored with Opus 4.6
cc @RiyaP2508 @mansiag05 @vishalgoyal316