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

[HVX] EliminateInterleaves is broken #7100

Closed
rootjalex opened this issue Oct 18, 2022 · 5 comments · Fixed by #7279
Closed

[HVX] EliminateInterleaves is broken #7100

rootjalex opened this issue Oct 18, 2022 · 5 comments · Fixed by #7279
Labels
hexagon Related to the hexagon (HVX) target

Comments

@rootjalex
Copy link
Member

On a benchmark I see the following pattern enter EliminateInterleaves:

x + interleave(y)

The output is:

interleave(deinterleave(x) + y)

I understand that EliminateInterleaves is supposed to push interleave towards the top of an Expr, but producing two swizzles from one swizzle seems like it does not follow a good cost model. I think the issue is simple to fix, this line:

return removable > 0 && removable >= does_not_yield;

should probably use a > instead of a >=. I'm only opening this issue in case there's something more complicated that I don't understand happening - otherwise I'll just open a PR to fix this.

I also think FuseInterleaves should be merged with EliminateInterleaves, as they seem to essentially perform the same function, but FuseInterleaves only tries to fix widening ops while EliminateInterleaves tries to fix narrowing ops (in the Call visitor).

@pranavb-ca @steven-johnson

@rootjalex rootjalex added the hexagon Related to the hexagon (HVX) target label Oct 18, 2022
@steven-johnson
Copy link
Contributor

Unfortunately, no, I have no thoughts on this. Is this in the category of "always been broken" or do we think it's a new breakage?

@rootjalex
Copy link
Member Author

It looks like Dillon changed the behavior ~17 months ago to be less restrictive (it used to require does_not_yield == 0 essentially). I think it's been broken since then.

@steven-johnson
Copy link
Contributor

I leave it to the judgement of you and @pranavb-ca -- this is outside of my expertise

@pranavb-ca
Copy link
Contributor

Hey, @rootjalex - I looked at this and I think you are right. I couldn't find a counter-example to argue against your change. I can push a change if you want or you could fold it into an upcoming PR if you are planning one imminently.

@rootjalex
Copy link
Member Author

Awesome, thanks @pranavb-ca ! I have a small PR to merge with this, I’ll try to make it this week.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
hexagon Related to the hexagon (HVX) target
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants