Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[inductor] switch assume_aligned_inputs to False #124336

Closed
Closed
Show file tree
Hide file tree
Changes from 12 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
12 changes: 6 additions & 6 deletions test/inductor/test_cudagraph_trees.py
Original file line number Diff line number Diff line change
Expand Up @@ -616,7 +616,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 @@ -647,21 +647,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.
Comment on lines 510 to 512
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Docstring now could be updated

assume_aligned_inputs: bool = True
assume_aligned_inputs: bool = False


# config specific to codegen/cpp.py
Expand Down