[DISCUSS] Module based Model Runtime Interface

I wasn’t proposing that as a solution, that is one of the options. I’m merely stating that this is still a problem that will hit others most notably anyone using the C backend .

Ramana

ok make sense. if all agree, we could improve our fallback way to make tvm blob in the rodata section

HI All, I was wondering, whether we can use flatbuffer for serializing params.

In that way we can customize the framework according to our suit as its opensource and it will be target agnostic. I am working on a prototype currently. However i wanted to know all your expert opinions before hand.

Thanks

It would be helpful to ask why and why not when introducing new dependencies. See some of the examples in the design decision above. Flatbuffer could be useful when we need to serialize a complicated set of objects, but also introduces an additional layer of abstraction.

Given that we are only dealing with a limited spec and current params serialization is already target agnostic, we do not need to introduce another layer of abstraction and dependency in this case.

@tqchen: Thank you very much for your enlightening response!

I agree it will introduce an additional layer, but it may have an additional performance benefit as well even when the store is for simple objects with Flatbuffer or more precisely Flexbuffers used. I was thinking of a scenario when we intend to load only partial memory because of system memory limit, in that case this can be helpful. Just a thought :slightly_smiling_face:.

I just have a basic question here, currently Relay Build emits Params as Map, what format it should be saved and offered to user for future reuse?(Note: I am aware of save_dict api)

Note that the parameter has to be loaded into DRAM, so there is no place where we could do partial weight load.

For memory limited scenarios like embedded devices, we would certainly need to go for a different solution, for example directly store weights in the rodata section to remove the need of serialization at all.

Thanks! Agree we can utilize rodata for that case.

May be that is for another thread of discussion.

Would you please help me about the basic question i raised? What i am trying to figure out here is from the user perspective - the standard way to save and reuse weights. As in the current thread, it is concluded to be unpackaged. Some insight would be helpful!

Please start another discuss thread for new questions(of weight serialization). The current proposal does have a package_params option that packages the weight.

Thank you, will start a new thread about that.

About the original post in the thread, i do have one small concern. Whenever we provide Export_library a path, it always has to be accompanied with correct extension name.

Like below:

mod.export_library("xx.so")

As we are coming up with a Packed Module, is it possible to lose this extension spec in the name and let TVM internally decide the extension based on the Target spec.

Can be like below:

mod.export_library("/Path-to-Module/Module-name")

or

mod.export_library("/Path-to-Module") --> Here default name can be assigned.

@tqchen: Any thoughts on above point?