ONE icon indicating copy to clipboard operation
ONE copied to clipboard

[onert] Remove frontend layout feature

Open ragmani opened this issue 2 years ago • 9 comments

What

Let's remove frontend layout feature.

Why

onert supports only NHWC model(circle, tflite) and probably will supports only NHWC model in the future. If so, the feature is meaningless.

How

  • Change default layout to ir::Layout::UNKNOWN
  • Remove frontend_layout from ir::Graph.
  • Remove layout from compiler::PermuteFactor.
  • Remove layout from compiler::OperationLowerInfo.
  • Add layout to compiler::OperandLowerInfo.
  • Add layout to ir::Operand to support ops like Conv2D that has layout.
  • Delegate dealing with layouts to backends.
    • Remove layout feature for each backend.
    • Enable each backend to update their partial graph

Draft #12224

ragmani avatar Nov 28 '23 05:11 ragmani

onert supports only NHWC model(circle, tflite) and probably will supports only NHWC model in the future

Then, will we remove data_format field in circle schema?

hseok-oh avatar Nov 29 '23 07:11 hseok-oh

onert is not the only user of circle schema. Other tools (like ONE front end and/or NPU Compiler) may make use of data_format.

onert supports only NHWC model(circle, tflite)

I am not sure it is valid. We've supported some model in NHWC at least for some operators a long time ago.

glistening avatar Nov 29 '23 07:11 glistening

@hseok-oh

Then, will we remove data_format field in circle schema?

Thanks for your information. I didn't know circle schema has data_format. I will stop this task.

ragmani avatar Nov 29 '23 08:11 ragmani

@glistening

onert is not the only user of circle schema. Other tools (like ONE front end and/or NPU Compiler) may make use of data_format.

What is ONE front and NPU Compiler? onert get models from them? I didn't catch the reason why you are talking about other tools.

I am not sure it is valid. We've supported some model in NHWC at least for some operators a long time ago.

OK, I will stop this task.

ragmani avatar Nov 29 '23 08:11 ragmani

@ragmani

What is ONE front and NPU Compiler? onert get models from them? I didn't catch the reason why you are talking about other tools.

It was my comment about @hseok-oh's

Then, will we remove data_format field in circle schema?

What is ONE front and NPU Compiler?

CFE in this repo, and NPU_Compiler in our internal repo.

glistening avatar Nov 29 '23 23:11 glistening

But if we don't use data_format field on compiler frontend and runtime (in other word, use NHWC only as default value), I think we can consider removing this feature from schema.

hseok-oh avatar Nov 30 '23 06:11 hseok-oh

But if we don't use data_format field on compiler frontend and runtime (in other word, use NHWC only as default value),

I also felt that compiler frontend converts models(i.g. ONNX model) to circle models in NHWC when I was working on compiler frontend.

ragmani avatar Nov 30 '23 07:11 ragmani

I talked with @seanshpark about this yesterday, and he also said that data_format is not used on compiler frontend and assume NHWC only. Let's deprecate this feature.

hseok-oh avatar Dec 01 '23 02:12 hseok-oh

several modules in compiler has access to data_format but doesn't seem to do valid things. I'll check with a draft change.

seanshpark avatar Dec 01 '23 03:12 seanshpark

Now layout is removes in frontend and backend all, and layout is used for input/output setting only.

hseok-oh avatar Aug 29 '24 11:08 hseok-oh