Skip to content

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

@kongroo kongroo force-pushed the fix_cuda_vectorized_cast branch from 0ecc450 to 4a9aeec Compare March 2, 2021 05:36
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

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 <[email protected]>
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 <[email protected]>
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