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

Broadcast the two input shapes for transposed matmul #1413

Closed

Conversation

FelixXidddd
Copy link

@FelixXidddd FelixXidddd commented Oct 19, 2022

Description

There is a transposed matmul layer(cases from meta_benchmark), has two inputs src0 and src1(which is a const).
Error message:

src[0] (Unnamed Layer* 1286) [Shuffle]_output,nbExtraDims 1, [2048,752,200], op TRANSPOSE; src[1] (Unnamed Layer* 1287) [Constant]_output, [752,60], op NONE; 
[10/19/2022-01:00:22] [TRT] [E] 4: [optimizer/shapeof/graphShapeAnalyzer.cpp::analyzeShapes::1877] Error Code 4: Miscellaneous (IMatrixMultiplyLayer [MATRIX_MULTIPLY]-[acc_ops.trt_transposed_matmul]-[trt_transposed_matmul]: broadcast dimensions must be conformable)
getDimensions failed xx: (Unnamed Layer* 1288) [Matrix Multiply]_output

As you can see from the error message, the src0 is [2048,752,200] and src1 is [752,60] which is not broadcast conformable. Actually torch should unsqueeze src1 from [752,60] to [1,752,60]

Fixes # (issue)
So we need to broadcast the inputs of transposed matmul layer.

Type of change

Please delete options that are not relevant and/or add your own.

  • Bug fix (non-breaking change which fixes an issue)

Checklist:

  • My code follows the style guidelines of this project (You can use the linters)
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas and hacks
  • I have made corresponding changes to the documentation
  • I have added tests to verify my fix or my feature
  • New and existing unit tests pass locally with my changes
  • I have added the relevant labels to my PR in so that relevant reviewers are notified

@nvpohanh
Copy link
Contributor

@ncomly-nvidia Could you let us know what we need to do to have this reviewed and merged? Thanks

@ncomly-nvidia
Copy link
Contributor

@narendasan @frank-wei can you please review or assign?

Copy link

@yinghai yinghai left a comment

Choose a reason for hiding this comment

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

Thank you for the contribution. Could you add a unittest?

@FelixXidddd
Copy link
Author

@yinghai Could you help to point out where should I add a unit test which can save me a lot of time.

@facebook-github-bot
Copy link
Contributor

Hi @FelixXidddd!

Thank you for your pull request and welcome to our community.

Action Required

In order to merge any pull request (code, docs, etc.), we require contributors to sign our Contributor License Agreement, and we don't seem to have one on file for you.

Process

In order for us to review and merge your suggested changes, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA.

Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with CLA signed. The tagging process may take up to 1 hour after signing. Please give it that time before contacting us about it.

If you have received this in error or have any questions, please contact us at cla@meta.com. Thanks!

@FelixXidddd
Copy link
Author

The corresponding test is added. Please help to review.

@FelixXidddd
Copy link
Author

@narendasan Should I sign up at https://code.facebook.com/cla? Should not we (Nvidia employees) already sign?

@frank-wei
Copy link
Contributor

LGTM! Pls sign up for it since every contributor needs to do so.

@ncomly-nvidia
Copy link
Contributor

@narendasan Should I sign up at https://code.facebook.com/cla? Should not we (Nvidia employees) already sign?

@FelixXidddd you need to sign the corporate one. @narendasan can you please send the info over?

	modified:   py/torch_tensorrt/fx/converters/acc_ops_converters.py
	modified:   py/torch_tensorrt/fx/test/passes/test_fuse_permute_matmul_trt.py
@nvpohanh
Copy link
Contributor

Let's use #1457 instead and close this. Thanks

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

Successfully merging this pull request may close these issues.

6 participants