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

[Codegen][CUDA] Fix: cuda codegen vectorize cast #7561

Merged
merged 4 commits into from
Mar 2, 2021

Conversation

kongroo
Copy link
Contributor

@kongroo kongroo commented Mar 2, 2021

Data types such as float32x8 and int32x8 are not supported in CUDA, which will result in errors like "Cannot convert type float32x8 to CUDA type!" in code generation. I tried to fix this by storing 2 32-bits values in 1 64-bits value.
Could you please help review this fix? @Laurawly

Copy link
Contributor

@Laurawly Laurawly left a comment

Choose a reason for hiding this comment

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

Just a few comments. Also cc @wpan11nv @vinx13 .

}
if (!fail) {
return;
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Missing break here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed

@@ -511,8 +511,8 @@ def check(t0, t1):

# schedule
s = tvm.te.create_schedule(C.op)
ob, ib = s[C].split(s[C].op.axis[0], nparts=32)
_, iib = s[C].split(ib, factor=4)
ob, ib = s[C].split(s[C].op.axis[0], nparts=n // factor)
Copy link
Contributor

Choose a reason for hiding this comment

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

We can also directly say factor=factor here.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

like this?

ob, ib = s[C].split(s[C].op.axis[0], factor=factor)
# _, iib = s[C].split(ib, factor=factor)
s[C].vectorize(ib)

Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

changed

@vinx13 vinx13 merged commit 5d354e4 into apache:main Mar 2, 2021
@vinx13
Copy link
Member

vinx13 commented Mar 2, 2021

Thanks @kongroo @Laurawly

trevor-m pushed a commit to trevor-m/tvm that referenced this pull request May 6, 2021
* fix: cuda codegen vectorize cast

* style: fix python coding style

* fix: missing break

* refactor: directly split by factor

Co-authored-by: jiangchengquan <jiangchengquan@bytedance.com>
trevor-m pushed a commit to neo-ai/tvm that referenced this pull request May 11, 2021
* fix: cuda codegen vectorize cast

* style: fix python coding style

* fix: missing break

* refactor: directly split by factor

Co-authored-by: jiangchengquan <jiangchengquan@bytedance.com>
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.

4 participants