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][METAL] Fix unaligned vector load #14332

Merged
merged 1 commit into from
Mar 20, 2023
Merged

Conversation

tqchen
Copy link
Member

@tqchen tqchen commented Mar 19, 2023

This PR fixes the implementation of unaligned vector load. Previously vector construction was printed as (float2)(v0, v1). This will cause problem as C have comma expression, and (v0, v1) will be evaluated as v1. The final result will become float2(v1, v1). The bug affects all codegen that uses the default implementation, such as metal. We added a testcase on metal to cover this case.

@tvm-bot
Copy link
Collaborator

tvm-bot commented Mar 19, 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

Copy link
Contributor

@spectrometerHBH spectrometerHBH left a comment

Choose a reason for hiding this comment

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

Shall we somehow examine the output C source code is as expected?

@tqchen
Copy link
Member Author

tqchen commented Mar 19, 2023

I have thought a bit about it in the end feel test correctness coverage is better in this case if we want future edits. We can indeed followup with source checking if new related regression arises

@junrushao
Copy link
Member

junrushao commented Mar 19, 2023

it seems that this patch breaks OpenCL/Vulkan codegen tests..

@tqchen
Copy link
Member Author

tqchen commented Mar 19, 2023

interesting, will dig a bit.

@tqchen
Copy link
Member Author

tqchen commented Mar 19, 2023

seems that (float2)(v0,v1) was the right syntax for opencl, will add an overload to the opencl codegen

This PR fixes the implementation of unaligned vector load.
Previously vector construction was printed as (float2)(v0, v1).
This will cause problem as C have comma expression, and (v0, v1) will be evaluated as v1.
The final result will become float2(v1, v1). The bug affects all codegen that uses
the default implementation, such as metal. We added a testcase on metal to cover this case.

Also updated codegen opencl to keep the old style as that is the convention opencl follows.
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