Skip to content

[passes] Optimize ConvertConv3dToConv2d for special case#518

Open
llFreetimell wants to merge 3 commits intoSamsung:mainfrom
llFreetimell:conv3d_to_conv2d_opt
Open

[passes] Optimize ConvertConv3dToConv2d for special case#518
llFreetimell wants to merge 3 commits intoSamsung:mainfrom
llFreetimell:conv3d_to_conv2d_opt

Conversation

@llFreetimell
Copy link
Contributor

This commit optimizes ConvertConv3dToConv2d pass for special case.

TICO-DCO-1.0-Signed-off-by: Seok Namkoong seok9311@naver.com


For #475
Draft #517

This commit optimizes `ConvertConv3dToConv2d` pass for special case.

TICO-DCO-1.0-Signed-off-by: Seok Namkoong <seok9311@naver.com>
return (torch.randn(5, 3, 2, 16, 16),), {}


class ConvertConv3dPerfectFitKernelTest(SinglePassValueTest):
Copy link
Contributor

Choose a reason for hiding this comment

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

(optional) How about adding it to op test too? test/modules/op/conv3d.py

dayo09
dayo09 previously approved these changes Feb 26, 2026
Copy link
Contributor

@dayo09 dayo09 left a comment

Choose a reason for hiding this comment

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

LGTM!

@dayo09
Copy link
Contributor

dayo09 commented Feb 26, 2026

@llFreetimell style failure 😢

Comment on lines +452 to +465
conv2d = create_node(
graph,
torch.ops.aten.conv2d.default,
args=(
input_reshape,
weight_reshape,
bias,
[1, 1], # stride
[0, 0], # padding
[1, 1], # dilation
groups,
),
origin=node,
)
Copy link
Contributor

Choose a reason for hiding this comment

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

@llFreetimell We have considered Linear vs Conv2d for TRIV optimization, so, in the end, is Conv2d better?

N, C_in, T_in, H_in, W_in = input_shape
C_out, C_in_weight, kT, kH, kW = weight_shape

if T_in == kT and H_in == kH and W_in == kW and groups == 1:
Copy link
Contributor

@seockho-kim seockho-kim Feb 26, 2026

Choose a reason for hiding this comment

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

Does this pass work when input shape(T,H,W) is same with kernel's?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants