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: make onednn linear inputs are always real contiguous #108560

Closed
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Update on "inductor: make onednn linear inputs are always real contig…
…uous"



For OneDNN linear, if packed linear inputs are not the default contiguous tensor, it always calls in ref pat and gets a worse performance, this PR will force its inputs to the actual default contiguous tensor.

cc voznesenskym penguinwu EikanWang jgong5 Guobing-Chen zhuhaozhe blzheng Xia-Weiwen wenzhe-nrv jiayisunx peterbell10 ipiszy ngimel yf225 chenyang78 kadeng muchulee8 aakhundov

[ghstack-poisoned]
  • Loading branch information
XiaobingSuper committed Sep 8, 2023
commit a64f6d209702822f55adaeffa250c59fdf396364
2 changes: 1 addition & 1 deletion test/inductor/test_cpu_repro.py
Original file line number Diff line number Diff line change
Expand Up @@ -2472,7 +2472,7 @@ def fn(x, y):
def test_linear_with_no_default_contiguous_input(self):
mod = torch.nn.Sequential(torch.nn.Linear(16, 16)).eval()
temp = torch.randn(1, 16, 1, 1)
v = torch.ops.inductor._reinterpret_tensor(temp, [1, 16], [0, 1], 0)
v = torch.as_strided(temp, [1, 16], [0, 1], 0)
self.assertTrue(v.is_contiguous())
with torch.no_grad():
self.common(
Expand Down
1 change: 0 additions & 1 deletion torch/_inductor/fx_passes/mkldnn_fusion.py
Original file line number Diff line number Diff line change
Expand Up @@ -1006,7 +1006,6 @@ def linear(match, *args, **kwargs):
if free_symbols(batch_size)
else batch_size,
)
packed_weight_inputs = (transpose_weight_node, batch_size)
packed_weight_op = (
mkldnn._reorder_linear_weight
if is_bf16_weight
Expand Down