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

[PyTorch] Add contiguous check for te_grouped_gemm #1146

Conversation

BeingGod
Copy link
Contributor

@BeingGod BeingGod commented Aug 29, 2024

Description

The type of input and output of te_grouped_gemm is std::vector<at::Tensor>. If the tensor is not contiguous it will causes potential accuracy problem and it is hard to debug. It's a useful safe operator to check every tensor is contiguous.

Why use is_contiguous instead of contiguous?
If tensor is non-contiguous contiguous will call aten::clone to generate a new tensor. It will cause potential performance fallback and generally user is hard to find reason (maybe them need profile).

Fixes # (issue)

Type of change

  • Documentation change (change only to the documentation, either a fix or a new content)
  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Infra/Build change
  • Code refractor

Changes

Please list the changes introduced in this PR:

  • Add contiguous check for te_grouped_gemm

Checklist:

  • I have read and followed the contributing guidelines
  • The functionality is complete
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes

Copy link
Collaborator

@timmoon10 timmoon10 left a comment

Choose a reason for hiding this comment

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

This is a good idea. Can you sign your commit to pass the DCO check?

@BeingGod BeingGod force-pushed the dev/zhangrb/add_contiguous_check_for_grouped_gemm branch from 88fbcb8 to 4862d27 Compare August 30, 2024 02:58
@BeingGod
Copy link
Contributor Author

This is a good idea. Can you sign your commit to pass the DCO check?

Done.

@timmoon10
Copy link
Collaborator

/te-ci pytorch

@ksivaman ksivaman merged commit ddc5774 into NVIDIA:main Sep 3, 2024
13 of 14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants