Repository navigation
[Test] Refactor test/functorch/test_leaf_function.py and add hardware classification - #193950
tszulist-hbn wants to merge 1 commit into
Conversation
PR Status: Approved 🚀Please fix all CI failures and trigger merge by commenting "@pytorchbot merge". ✅ AUTOMATED REVIEW - Ready for human review:
Reviewed commit: 🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/193950
Note: Links to docs will display an error until the docs builds have been completed. ✅ No FailuresAs of commit 2a5cff8 with merge base e7039c1 ( This comment was automatically generated by Dr. CI and updates every 15 minutes. |
|
@pytorchbot rebase |
|
@pytorchbot started a rebase job onto refs/remotes/origin/viable/strict. Check the current status here |
|
Successfully rebased |
17337b0 to
2a9814e
Compare
|
|
|
@pytorchbot rebase |
|
@pytorchbot started a rebase job onto refs/remotes/origin/viable/strict. Check the current status here |
… classification ## Summary Tag the test classes in `test/functorch/test_leaf_function.py` as `GENERIC` so CI can route them via `--hw-classification`. These are Dynamo/AOTAutograd framework tests: every tensor is on CPU, no class requires an accelerator, and the file intentionally does not use `instantiate_device_type_tests` (its dtype coverage comes from `@parametrize`). No runtime behavior is changed -- without the flag, discovery and execution are identical. ## Changes Import `HardwareClassification` and set `hw_classification = GENERIC` on `TestLeafFunctionMakeFx`, `TestLeafFunctionAotFunction`, `TestLeafFunctionEscapedGradients`, `TestLeafFunctionMakeFxAndCompile`, `TestLeafFunctionDynamo`, `TestLeafFunctionRegisterHook` and `TestLeafFunctionGradDtype`. ## Test Plan ```bash python test/functorch/test_leaf_function.py # Ran 103 tests -> OK (skipped=1), unchanged from before python test/functorch/test_leaf_function.py --hw-classification GENERIC # Ran 103 tests -> OK (skipped=1) # HW classification mode active (['GENERIC']): total=103, passed=103, unclassified=0, mismatched=0 python test/functorch/test_leaf_function.py --hw-classification ACCELERATOR # NO TESTS RAN, mismatched=103 ``` ## Notes The existing `@skipIfXpu` on `test_leaf_function_closure_constants_without_grad` is kept as-is: the test passes on a local XPU device, but the goldens encode an accelerator-dependent `nn_module_index`, so dropping the skip is deferred until XPU CI confirms it. `GENERIC` is still the correct tag -- the classes run on CPU and none requires an accelerator; the skip is a per-test exclusion. Part of pytorch#142029. This change was authored with the assistance of an AI coding agent.
|
Successfully rebased |
2a9814e to
2a5cff8
Compare
There was a problem hiding this comment.
Automated review of 2a5cff8: nothing blocking; ready for human review.
Adds hw_classification = HardwareClassification.GENERIC to all seven TestCase classes in test/functorch/test_leaf_function.py. This matches the established pattern, the tests are device-agnostic and CPU-only, and behavior is unchanged when --hw-classification is not passed. No problems found.
This review is AI-generated and advisory. Each new automated review replaces the previous one.
|
@pytorchbot merge |
Merge startedYour 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 |
… classification (pytorch#193950) ## Summary Tag the test classes in `test/functorch/test_leaf_function.py` as `GENERIC` so CI can route them via `--hw-classification`. These are Dynamo/AOTAutograd framework tests: every tensor is on CPU, no class requires an accelerator, and the file intentionally does not use `instantiate_device_type_tests` (its dtype coverage comes from `@parametrize`). No runtime behavior is changed -- without the flag, discovery and execution are identical. ## Changes Import `HardwareClassification` and set `hw_classification = GENERIC` on `TestLeafFunctionMakeFx`, `TestLeafFunctionAotFunction`, `TestLeafFunctionEscapedGradients`, `TestLeafFunctionMakeFxAndCompile`, `TestLeafFunctionDynamo`, `TestLeafFunctionRegisterHook` and `TestLeafFunctionGradDtype`. ## Test Plan ```bash python test/functorch/test_leaf_function.py # Ran 103 tests -> OK (skipped=1), unchanged from before python test/functorch/test_leaf_function.py --hw-classification GENERIC # Ran 103 tests -> OK (skipped=1) # HW classification mode active (['GENERIC']): total=103, passed=103, unclassified=0, mismatched=0 python test/functorch/test_leaf_function.py --hw-classification ACCELERATOR # NO TESTS RAN, mismatched=103 ``` Part of pytorch#142029. Pull Request resolved: pytorch#193950 Approved by: https://github.com/pbielak, https://github.com/etaf, https://github.com/jansel
) Next PR for synchronizing upstream generalization with local files: 1) **functorch/test_eager_transforms.py** Upstream PR: pytorch/pytorch#192806 Before: 682 passed, 7 skipped, 2 xfailed After: 721 passed, 6 skipped, 2 xfailed Changes: - 11 new test cases: `TestGradTransform::test_inference_mode_*` - 4 new test cases: `TestCompileTransforms::test_compile_dynamic_grad_*` - 2 new test cases: `TestGradTransform::test_pop_dynamic_layer_stack_to_depth_*` - 2 new test cases: `TestFunctionalize::test_multioutput_view_*` - new test case: `TestGradTransform::test_linear_nd_inplace_activation` - new test case: `TestAutogradFunction::test_unwrap_dead_wrappers` - 1 less skipped: `test_unrelated_hessian` now passes on XPU - `TestGradTrackingTensorToList` is no longer device-parametrized: the local copy ran its 4 device-agnostic test cases twice (CPU and XPU), upstream marks the class `GENERIC` and runs them once - the 15 device-parametrized classes are renamed to `Test*Device` 2) **functorch/test_leaf_function.py** Upstream PR: pytorch/pytorch#193950 Before: not run After: 102 passed, 1 skipped 3) **export/test_passes.py** Upstream PR: pytorch/pytorch#196974 Before: 25 passed, 2 xfailed After: 26 passed, 4 skipped, 2 xfailed Changes: - 5 new test cases: `TestMoveToDevicePassCuda`, 4 require CUDA and are skipped, `test_move_to_device_pass_interpreter_only_graph` passes - move `test_move_device_example_inputs`, `test_move_device_submod`, `test_move_device_to` and `test_move_to_device_pass` from `TestPasses` to the new device-parametrized `TestMoveToDevicePassDevice` 4) **export/test_converter.py** Upstream PR: pytorch/pytorch#197113 Before: 46 passed, 2 skipped After: 46 passed, 2 skipped Changes: - move `test_prim_device` from `TestConverter` to the new device-parametrized `TestConverterDevice`, which runs it on both CPU and XPU. The local copy carried it as `test_prim_device_cuda` with a hardcoded `device="xpu:0"`, so a single misnamed test case becomes two properly parametrized ones
…tel#5693) Next PR for synchronizing upstream generalization with local files: 1) **functorch/test_eager_transforms.py** Upstream PR: pytorch/pytorch#192806 Before: 682 passed, 7 skipped, 2 xfailed After: 721 passed, 6 skipped, 2 xfailed Changes: - 11 new test cases: `TestGradTransform::test_inference_mode_*` - 4 new test cases: `TestCompileTransforms::test_compile_dynamic_grad_*` - 2 new test cases: `TestGradTransform::test_pop_dynamic_layer_stack_to_depth_*` - 2 new test cases: `TestFunctionalize::test_multioutput_view_*` - new test case: `TestGradTransform::test_linear_nd_inplace_activation` - new test case: `TestAutogradFunction::test_unwrap_dead_wrappers` - 1 less skipped: `test_unrelated_hessian` now passes on XPU - `TestGradTrackingTensorToList` is no longer device-parametrized: the local copy ran its 4 device-agnostic test cases twice (CPU and XPU), upstream marks the class `GENERIC` and runs them once - the 15 device-parametrized classes are renamed to `Test*Device` 2) **functorch/test_leaf_function.py** Upstream PR: pytorch/pytorch#193950 Before: not run After: 102 passed, 1 skipped 3) **export/test_passes.py** Upstream PR: pytorch/pytorch#196974 Before: 25 passed, 2 xfailed After: 26 passed, 4 skipped, 2 xfailed Changes: - 5 new test cases: `TestMoveToDevicePassCuda`, 4 require CUDA and are skipped, `test_move_to_device_pass_interpreter_only_graph` passes - move `test_move_device_example_inputs`, `test_move_device_submod`, `test_move_device_to` and `test_move_to_device_pass` from `TestPasses` to the new device-parametrized `TestMoveToDevicePassDevice` 4) **export/test_converter.py** Upstream PR: pytorch/pytorch#197113 Before: 46 passed, 2 skipped After: 46 passed, 2 skipped Changes: - move `test_prim_device` from `TestConverter` to the new device-parametrized `TestConverterDevice`, which runs it on both CPU and XPU. The local copy carried it as `test_prim_device_cuda` with a hardcoded `device="xpu:0"`, so a single misnamed test case becomes two properly parametrized ones
Summary
Tag the test classes in
test/functorch/test_leaf_function.pyasGENERICso CI can route them via--hw-classification. These are Dynamo/AOTAutograd framework tests: every tensor is on CPU, no class requires an accelerator, and the file intentionally does not useinstantiate_device_type_tests(its dtype coverage comes from@parametrize). No runtime behavior is changed -- without the flag, discovery and execution are identical.Changes
Import
HardwareClassificationand sethw_classification = GENERIConTestLeafFunctionMakeFx,TestLeafFunctionAotFunction,TestLeafFunctionEscapedGradients,TestLeafFunctionMakeFxAndCompile,TestLeafFunctionDynamo,TestLeafFunctionRegisterHookandTestLeafFunctionGradDtype.Test Plan
Part of #142029.