Skip to content

Commit

Permalink
[inductor] switch assume_aligned_inputs to False
Browse files Browse the repository at this point in the history
ghstack-source-id: 60bdeb4950106b0f170202a40577059057686dfd
Pull Request resolved: #124336
  • Loading branch information
davidberard98 committed Apr 26, 2024
1 parent 63d4dc5 commit be95643
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
12 changes: 6 additions & 6 deletions test/inductor/test_cudagraph_trees.py
Original file line number Diff line number Diff line change
Expand Up @@ -634,7 +634,7 @@ def foo(x, y):
new_id = self.get_manager().new_graph_id().id
self.assertEqual(new_id, 3)

def _test_unaligned_static_input_impl(self):
def _test_unaligned_static_input_impl(self, expected_clones):
def fn(x, y):
return (x + y,)

Expand Down Expand Up @@ -665,21 +665,21 @@ def __torch_dispatch__(self, func, types, args=(), kwargs=None):
for _ in range(3):
with CloneCounterMode() as m:
compiled_f(get_unaligned_inputs())
self.assertEqual(m.count, 2)
self.assertEqual(m.count, expected_clones)

compiled_f(get_aligned_inputs())
self.assertEqual(m.count, 2)
self.assertEqual(m.count, expected_clones)

def test_unaligned_static_input_trees(self):
self._test_unaligned_static_input_impl()
self._test_unaligned_static_input_impl(expected_clones=0)

@torch._inductor.config.patch("triton.cudagraph_trees", False)
def test_unaligned_static_input_non_trees(self):
self._test_unaligned_static_input_impl()
self._test_unaligned_static_input_impl(expected_clones=0)

@torch._inductor.config.patch("triton.cudagraphs", False)
def test_unaligned_static_input_no_cudagraphs(self):
self._test_unaligned_static_input_impl()
self._test_unaligned_static_input_impl(expected_clones=0)

def test_sparsity(self):
def foo(view_6, buf31):
Expand Down
2 changes: 1 addition & 1 deletion torch/_inductor/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -510,7 +510,7 @@ def decide_compile_threads():
# assume_aligned_inputs means that we assume that inputs will be aligned; we generate
# code using this assumption, and clone tensors before use if they aren't aligned.
# In the common case, most inputs will be aligned.
assume_aligned_inputs: bool = True
assume_aligned_inputs: bool = False


# config specific to codegen/cpp.py
Expand Down

0 comments on commit be95643

Please sign in to comment.