Samsung / ONE

On-device Neural Engine
Other
429 stars 157 forks source link

[one-optimize] Remove unnecessary Cast Op #13623

Open jinevening opened 1 month ago

jinevening commented 1 month ago

What

Let's remove unnecessary cast (input dtype == output dtype). The final goal of this task is to add --remove_unnecessary_cast option to one-optimize.

image

Why

Our frontend converter (circle-exir) sometimes generates unnecessary cast in diffusion model.

jiwaszki commented 1 month ago

@jinevening Could you assign me to this issue?

seanshpark commented 1 month ago

... sometimes generates unnecessary cast in diffusion model.

So, it's hard or impossible to fix circle-exir for this case? Why am I asking? Cast with F32-F32 looks a bug to me.

jinevening commented 1 month ago

It's possible to fix circle-exir. I made this issue in ONE, because it looks like a general optimization. This can be seen as a bug, but sometimes converting tools just generate redundant patterns. We've handled many such patterns in ONE.

If you think this is unnecessary, I'll close this issue. Could you give your opinion?

seanshpark commented 1 month ago

but sometimes converting tools just generate redundant patterns.

I was just curious about the task. I'll give a +1 for this :) Let's go on with this task !