Samsung / ONE

On-device Neural Engine

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Compiler FE: Introduce target configuration

mhs4670go opened this issue · comments

What

Let's introduce target configuration feature.

"Target" here refers to an instance from the core architecture of the system. For instance, say there is a NPU core architecture. Different systems can have same architecture but have different configurations like their global size, DSPM size and clock rate, etc. Basically, the target configuration will be introduced for changing behaviors according to such different systems. But, sometimes we can support the case where one system with two or more different cores.

When users try to support multiple backends, they should write dedicated configuration files per the backends. But, the contents of the file from importing the model to optimizing it could be almost same since the only difference would be from the codegen things. Also, it's kinda tricky to maintain so many backend properties for the backend tools: one-codegen, one-infer and one-profile. And it's also hard to align such parameters among the tools, which can be resolved if they see the same properties or a file that contains them.

So, I'd like to introduce target configuration feature for resolving these discomfort.

target key will be added to the configuration file. Then, onecc automatically will add keys to the keys of one-cmds tools and add --target ${TARGET} to the backend commands.

[onecc]
one-import-tf=True
one-optimize=True
one-codegen=True
target=npu0

Adding target key to the onecc section is same with belows.

[one-import-tf]
# ..
target=npu0
[one-optimize]
# ..
target=npu0
[one-codegen]
# ..
command=${COMMAND} --target command

Simply put, users just need to do two things.

  • Write target configuration file to the /usr/share/one/target/${TARGET_NAME}.${EXT}
  • Add target key to the onecc section

TODO

  • Decide file format of the target configuration file. (e.g. ini, json, etc)
  • Decide file content template or hierarchy.

@mhs4670go , thank you for your suggestion.

I have two questions.

  1. What happens if there is a component that does not support the --target ${TARGET} option?
  2. In the case of 'target=xxx', the characteristics seem to be different from other keys in [onecc] section. How about introducing a separate section like [common-options]?

@lemmaa

What happens if there is a component that does not support the --target ${TARGET} option?

I think that case users'd better just not use target option.

In the case of 'target=xxx', the characteristics seem to be different from other keys in [onecc] section. How about introducing a separate section like [common-options]?

Sounds a good idea:)