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

[Cuda] Slight optimize the default injective schedule #7158

Merged
merged 1 commit into from Dec 24, 2020

Conversation

ANSHUMAN87
Copy link
Contributor

We do not need additional thread extent when the tensor size is known.
Below output shows the impact of the change, taken Transpose Op for illustration.

Before:

producer_realize T_transpose([0, 3], [0, 4]) {
  // attr [iter_var(blockIdx.x, , blockIdx.x)] thread_extent = 1
  // attr [iter_var(threadIdx.x, , threadIdx.x)] thread_extent = 1024
  if (tir.likely((floordiv(threadIdx.x, 4) < 3))) {
    if (tir.likely((threadIdx.x < 12))) {
      T_transpose[floordiv(threadIdx.x, 4), floormod(threadIdx.x, 4)] =placeholder[floormod(threadIdx.x, 4), floordiv(threadIdx.x, 4)]
    }
  }
}

After:

producer_realize T_transpose([0, 3], [0, 4]) {
  // attr [iter_var(blockIdx.x, , blockIdx.x)] thread_extent = 1
  // attr [iter_var(threadIdx.x, , threadIdx.x)] thread_extent = 12
  T_transpose[floordiv(threadIdx.x, 4), floormod(threadIdx.x, 4)] =placeholder[floormod(threadIdx.x, 4), floordiv(threadIdx.x, 4)]
}

Copy link
Member

@junrushao junrushao left a comment

Choose a reason for hiding this comment

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

LGTM. Thanks!

@ANSHUMAN87
Copy link
Contributor Author

Thanks @junrushao1994 ! Looks like the test case is flaky. Does not depend on this PR change. Will re-trigger CI.

@junrushao
Copy link
Member

Thanks @ANSHUMAN87! I don’t have other comments. @comaniac would you like to take a look?

@comaniac comaniac merged commit e27ad08 into apache:main Dec 24, 2020
@comaniac
Copy link
Contributor

Thanks @ANSHUMAN87 @junrushao1994

tkonolige pushed a commit to tkonolige/incubator-tvm that referenced this pull request Jan 11, 2021
TusharKanekiDey pushed a commit to TusharKanekiDey/tvm that referenced this pull request Jan 20, 2021
trevor-m pushed a commit to neo-ai/tvm that referenced this pull request Jan 21, 2021
electriclilies pushed a commit to electriclilies/tvm that referenced this pull request Feb 18, 2021
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.

None yet

3 participants