forked from apache/tvm
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[OpenCL] Fix type casting error (apache#11021)
Faced situation when generated OpenCL kernel contained the following if condition: ``` if (uint4(...) && (int4(...) == int4(...))) ``` In this case, got the following error: "can't convert between vector values of different size ('uint4' and 'int __attribute__((ext_vector_type(4)))')" Added casts for binary ops. But it was necessary to modify `CastFromTo` and add new method `CastTo`. Because with `CastFromTo` the following code was generated: ``` if (uint4(...) && (convert_uint4(int4(...)) == convert_uint4(int4(...)))) ``` But the OpenCL compiler still generated the same error. This is why added new method `CastTo`. In this method we don't check the current type of op and just add cast to a new type. Finally the following code will be generated: ``` if (uint4(...) && convert_uint4(convert_uint4(int4(...)) == convert_uint4(int4(...)))) ```
- Loading branch information
Showing
3 changed files
with
70 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters