Skip to content

Commit 1642dae

Browse files
davidberard98pytorchmergebot
authored andcommitted
[inductor] codegen dynamic shapes tests: reset inductor metrics (pytorch#106481)
A bunch of the tests are getting skipped/xfailed because of generated_kernel_count checks. In other tests, inductor metrics automatically get reset in the common() function, so we should do this in the test_torchinductor_codegen_dynamic_shapes tests as well. Pull Request resolved: pytorch#106481 Approved by: https://github.com/eellison
1 parent 424dc23 commit 1642dae

File tree

2 files changed

+3
-19
lines changed

2 files changed

+3
-19
lines changed

test/inductor/test_torchinductor.py

+2-4
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,7 @@ def tearDownClass(cls):
121121

122122
def setUp(self):
123123
torch._dynamo.reset()
124+
torch._inductor.metrics.reset()
124125
super().setUp()
125126
self._start = time.perf_counter()
126127

@@ -6696,10 +6697,7 @@ def fn(input, offsets, out_int32, right):
66966697

66976698
@patch.object(config.triton, "autotune_pointwise", True)
66986699
def test_inductor_bucketize_add_autotune(self):
6699-
"""
6700-
Causes a @pointwise(size_hints) where size_hints is 2D
6701-
"""
6702-
torch._inductor.metrics.generated_kernel_count = 0
6700+
# Causes a @pointwise(size_hints) where size_hints is 2D
67036701

67046702
def fn(input, offsets, add_value):
67056703
return torch.ops.prims._inductor_bucketize(input, offsets) + add_value

test/inductor/test_torchinductor_codegen_dynamic_shapes.py

+1-15
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ def copy_fn(x):
6464
example_inputs = tuple(copy_fn(x) for x in example_inputs)
6565

6666
torch._dynamo.reset()
67+
torch._inductor.metrics.reset()
6768

6869
called = False
6970

@@ -123,7 +124,6 @@ def run(*ex, **kwargs):
123124
"test_expand_dynamic_shapes": TestFailure(("cpu",)),
124125
"test_glu_dynamic_shapes": TestFailure(("cpu",)),
125126
"test_isinf2_dynamic_shapes": TestFailure(("cpu",)),
126-
"test_layer_norm_dynamic_shapes": TestFailure("cuda"),
127127
"test_linspace1_dynamic_shapes": TestFailure(("cpu",)),
128128
"test_reflection_pad2d_backward_dynamic_shapes": TestFailure(("cpu",)),
129129
"test_reflection_pad2d_dynamic_shapes": TestFailure(("cpu",)),
@@ -205,7 +205,6 @@ def run(*ex, **kwargs):
205205
"test_cat_of_loops_and_extern_kernel_dynamic_shapes": TestFailure(
206206
("cpu", "cuda"), is_skip=True
207207
),
208-
"test_cauchy_dynamic_shapes": TestFailure(("cpu", "cuda"), is_skip=True),
209208
"test_scaled_dot_product_efficient_attention_dynamic_shapes": TestFailure(
210209
("cpu", "cuda"), is_skip=True
211210
),
@@ -220,7 +219,6 @@ def run(*ex, **kwargs):
220219
("cpu", "cuda"), is_skip=True
221220
),
222221
"test_gather2_dynamic_shapes": TestFailure(("cpu", "cuda"), is_skip=True),
223-
"test_gather_scatter_dynamic_shapes": TestFailure(("cpu", "cuda"), is_skip=True),
224222
"test_inplace_add_dynamic_shapes": TestFailure(("cpu", "cuda"), is_skip=True),
225223
"test_inplace_mixed_dtype_ops_dynamic_shapes": TestFailure(
226224
("cpu", "cuda"), is_skip=True
@@ -241,7 +239,6 @@ def run(*ex, **kwargs):
241239
("cpu", "cuda"), is_skip=True
242240
),
243241
"test_min_max_reduction_dynamic_shapes": TestFailure(("cpu", "cuda"), is_skip=True),
244-
"test_move_arange_dynamic_shapes": TestFailure(("cpu", "cuda"), is_skip=True),
245242
"test_multi_gpu_recompile_on_index_dynamic_shapes": TestFailure(
246243
("cpu", "cuda"), is_skip=True
247244
),
@@ -253,23 +250,12 @@ def run(*ex, **kwargs):
253250
"test_rand_like_deterministic_dynamic_shapes": TestFailure(
254251
("cpu", "cuda"), is_skip=True
255252
),
256-
"test_scheduler_vertical_fusion1_dynamic_shapes": TestFailure(
257-
("cpu", "cuda"), is_skip=True
258-
),
259253
"test_slice_mutation2_dynamic_shapes": TestFailure(("cpu", "cuda"), is_skip=True),
260-
"test_softmax_one_kernel_loop_dynamic_shapes": TestFailure(
261-
("cpu", "cuda"), is_skip=True
262-
),
263-
"test_softmax_one_kernel_persist_dynamic_shapes": TestFailure(
264-
("cpu", "cuda"), is_skip=True
265-
),
266254
"test_strided_inputs_dynamic_shapes": TestFailure(("cpu", "cuda"), is_skip=True),
267-
"test_transpose_add_dynamic_shapes": TestFailure(("cpu", "cuda"), is_skip=True),
268255
"test_transposed_propagates_dynamic_shapes": TestFailure(
269256
("cpu", "cuda"), is_skip=True
270257
),
271258
"test_unspec_inputs_dynamic_shapes": TestFailure(("cpu", "cuda"), is_skip=True),
272-
"test_vertical_fusion1_dynamic_shapes": TestFailure(("cpu", "cuda"), is_skip=True),
273259
"test_zero_dim_reductions_dynamic_shapes": TestFailure(
274260
("cpu", "cuda"), is_skip=True
275261
),

0 commit comments

Comments
 (0)