Skip to content

Conversation

@rafey1104
Copy link

Add Lowering for conv2d and conv2d_transpose to ttir::ConvolutionOp

Ticket

Fix : 596

Problem description

Lower TTForge conv2d and conv2d_transpose ops to the new, unified ttir::ConvolutionOp.

What's changed

  • Added a new handler emit_mlir_ttforge_convolution_op for lowering conv2d and conv2d_transpose.
  • Updated lowering_handler_map to use the new handler for both convolution op types.
  • Updated AttributeMapper to remap groups -> feature_groups_count and stride -> window_strides.
  • Added logic to build the ConvolutionLayoutAttr assuming a channel-last (NHWC) layout.
  • Added handling for optional bias operands by inserting ttir.none when no bias is present.
  • Sets the is_transpose attribute in ttir::ConvolutionOp based on the source op.
  • Added E2E test test_conv2d_transpose to validate the new lowering path.

@github-actions github-actions bot added the community issue was filed by a community member (not TT) label Nov 16, 2025
@rafey1104
Copy link
Author

Testing it is required. I could not test it since i lost the koyeb access

(
(1, 16, 64, 56, 56, 4, 4, 1, 1), # Flipped output/input channels
(1, 64, 64, 56, 56, 3, 3, 1, 1),
(1, 128, 128, 28, 28, 3, 3, 2, 2), # Stride > 1

Check failure

Code scanning / flake8

at least two spaces before inline comment Error test

at least two spaces before inline comment
(1, 64, 64, 56, 56, 3, 3, 1, 1),
(1, 128, 128, 28, 28, 3, 3, 2, 2), # Stride > 1
(1, 128, 128, 14, 14, 3, 3, 1, 1),
(1, 256, 256, 14, 14, 3, 3, 2, 2), # Stride > 1

Check failure

Code scanning / flake8

at least two spaces before inline comment Error test

at least two spaces before inline comment
(1, 64, 64, 8, 8, 3, 3, 1, 1),
(1, 64, 64, 16, 16, 3, 3, 1, 1),
(1, 256, 256, 7, 7, 3, 3, 1, 1),
(1, 64, 256, 28, 28, 1, 1, 2, 2), # Flipped output/input channels, Stride > 1

Check failure

Code scanning / flake8

at least two spaces before inline comment Error test

at least two spaces before inline comment
def __init__(self):
super().__init__()
self.conv2d_transpose = tf.keras.layers.Conv2DTranspose(
output_channels, # `filters` argument specifies output channels

Check failure

Code scanning / flake8

at least two spaces before inline comment Error test

at least two spaces before inline comment

compiled_model = forge.compile(framework_model, sample_inputs=inputs)

verify(inputs, framework_model, compiled_model)

Check warning

Code scanning / flake8

no newline at end of file Warning test

no newline at end of file
@nvukobratTT
Copy link
Collaborator

Testing it is required. I could not test it since i lost the koyeb access

Thanks for the contribution @rafey1104!

Before our initial review, @marty1885, can we help @rafey1104 with his instance to test out the changes first?

@marty1885
Copy link
Contributor

marty1885 commented Nov 17, 2025

Sure! @rafey1104 can you send an message to mchang \at tenstorrent.com or marty1885 on discord so I can get you access? No NDA or anything, just avoiding spammers.

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

Labels

community issue was filed by a community member (not TT)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bounty $500] New Convolution op in MLIR. Need to change lowering of Conv2d

3 participants