Skip to content

Conversation

@junrushao
Copy link
Member

@junrushao junrushao commented Feb 11, 2023

Previously, when writing a BufferStore statement in TVMScript, dtype
mismatch will not be detected but silently allowed.

For example, in the snippet below:

buffer[indices] = RHS

even if the elements of buffer is floating point numbers, while RHS
is a handle, there is no mechanism to warn, fix, or error out.

This PR introduces auto casting mechanism in TVMScript to ensure that
the dtype of RHS matches LHS. When there is possible precision loss, it
will emit a warning so that the users could adjust accordingly.

@tvm-bot
Copy link
Collaborator

tvm-bot commented Feb 11, 2023

Thanks for contributing to TVM! Please refer to the contributing guidelines https://tvm.apache.org/docs/contribute/ for useful information and tips. Please request code reviews from Reviewers by @-ing them in a comment.

Generated by tvm-bot

@junrushao junrushao force-pushed the feature/2023-02-11/buffer-store-dtype branch 4 times, most recently from d3a51c4 to da1ebd5 Compare February 11, 2023 14:54
@junrushao junrushao marked this pull request as ready for review February 12, 2023 03:18
Copy link
Member

@Hzfengsy Hzfengsy left a comment

Choose a reason for hiding this comment

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

Please update the PR description and we can get it in

@junrushao
Copy link
Member Author

I will tweak it a bit by adding some more warning messages today and ping you guys back tomorrow

Previously, when writing a BufferStore statement in TVMScript, dtype
mismatch will not be detected but silently allowed.

For example, in the snippet below:

```python
buffer[indices] = RHS
```

even if the elements of `buffer` is floating point numbers, while RHS
is a handle, there is no mechanism to warn, fix, or error out.

This PR introduces auto casting mechanism in TVMScript to ensure that
the dtype of RHS matches LHS. When there is possible precision loss, it
will emit a warning so that the users could adjust accordingly.
@junrushao junrushao force-pushed the feature/2023-02-11/buffer-store-dtype branch from 4c103f4 to 9d1c070 Compare February 12, 2023 07:29
@junrushao junrushao changed the title [TIR] Assert DataType Equality in BufferStore [TVMScript] Enable Safe Autocasting in BufferStore Feb 12, 2023
@junrushao
Copy link
Member Author

@Hzfengsy @MasterJH5574 I added an extra warning when there is potential precision loss, for example, casting floating point numbers to integers. It should be good to go

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.

5 participants