You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tvm.apache.org by Manupa Karunaratne via Apache TVM Discuss <no...@discuss.tvm.ai> on 2021/05/11 08:26:17 UTC

[Apache TVM Discuss] [Development/RFC] mini-RFC] Name mangling in AOT


Hi @areusch @tqchen @giuseros 

I think its best to use _tvm prefix nonetheless. -- so we dont pollute a namespace based on a user given variable.

I dont follow why a "prefix" necessarily mean user being able to select it? If "prefix" is not the right term we should not call it a prefix. The goal of this RFC is to propose mechanism to reduce namespace pollution. Therefore having "_tvm" states that this belongs tvm codegen'd artifacts and moreover allowing a model name allows to further categorize artifacts of multiple compilations.

Therefore, I'd suggest we use :

* _tvm_MYNET_run (lets drop the func :) )

and (if a model name is not given)

* _tvm_run 

@tqchen , I'd assume if a model name is not given the second option would be backward compatible DSOModule loader ?





---
[Visit Topic](https://discuss.tvm.apache.org/t/mini-rfc-name-mangling-in-aot/9907/7) to respond.

You are receiving this because you enabled mailing list mode.

To unsubscribe from these emails, [click here](https://discuss.tvm.apache.org/email/unsubscribe/65d6ae5991e49e86b42bd4ae8fd7c8ff6f24a8851186a67b8ea165626a1050ec).

[Apache TVM Discuss] [Development/RFC] [mini-RFC] Name mangling in AOT

Posted by Andrew Reusch via Apache TVM Discuss <no...@discuss.tvm.ai>.

@tqchen @manupa-arm @mjs @giuseros great discussions so far! 

> Identifiers that begin with underscore are reserved by the C standard. Conformant C code should not use them, dropping the _ and using just “tvm_…” would be conformant.

I agree with this. Do we need to consider distinguishing this prefix from that used within TVM itself? e.g. `tvmgen_` so that stacktraces when compute is launched from the shared library are clear.

> I dont follow why a “prefix” necessarily mean user being able to select it? If “prefix” is not the right term we should not call it a prefix.

Yeah this is just me stating that we were proposing `tvm_<model_name>_<function_name>`, where `<model_name>` is termed a prefix. I'd call `tvm_<model_name>_` a prefix here.

> I agree that having a common prefix is helpful in the dso landscape to clearly identify function generated by tvm. To faciliate discussion, consider the following code
> 
> ```
> m = tvm.runtime.load_module("x.so")
> # Option P0: require explicit query using tvm_run
> run = m["tvm_run"]
> # Option P1: the underlying symbol is "tvm_run" 
> run = m["run"]
> ```
> 
> I believe we are still talking about P0 atm for simplicity(direct correspondence of symbol and packed func name), but allow the AOT generator to append a prefix(like @areusch 's comment of prefix starting from char 0). My main comment of backward compact is when we start to choose P1. If we go with P1, then we will need to put more thoughts into it.

@tqchen, in this case, the main function being queried should be the factory function for Module-based Model Runtime Interface, no? In that case, it seems reasonable to require:
```
m = tvm.runtime.load_module("x.so")
# User looks up module via prefix
executor = m["customprefix_tvm_modelname"]()
# Or perhaps TVM can fall back to the standard one
executor = m["modelname"](). # Looks up tvmgen_modelname

executor["set_input"]("foo", bar)
# ...
```

It should be possible to include the prefix when looking up the module-specific functions. It's also worth pointing out here that this discussion is for the case of loading a module using the C++ runtime. With the C runtime, I think it's expected that the user chooses `<prefix>` to match their firmware implementation.





---
[Visit Topic](https://discuss.tvm.apache.org/t/mini-rfc-name-mangling-in-aot/9907/10) to respond.

You are receiving this because you enabled mailing list mode.

To unsubscribe from these emails, [click here](https://discuss.tvm.apache.org/email/unsubscribe/14e17e1c7fe0e39662228f4b7fe0fbf061aacf7166b9c33c13747def03efc8f2).

[Apache TVM Discuss] [Development/RFC] mini-RFC] Name mangling in AOT

Posted by tqchen via Apache TVM Discuss <no...@discuss.tvm.ai>.

I agree that having a common prefix is helpful in the dso landscape to clearly identify function generated by tvm.  To faciliate discussion, consider the following code

```python
m = tvm.runtime.load_module("x.so")
# Option P0: require explicit query using tvm_run
run = m["tvm_run"]
# Option P1: the underlying symbol is "tvm_run" 
run = m["run"]
```

I believe we are still talking about P0 atm for simplicity(direct correspondence of symbol and packed func name), but allow the AOT generator to append a prefix(like @areusch 's comment of prefix starting from char 0). My main comment of backward compact is when we start to choose P1. If we go with P1, then we will need to put more thoughts into it.





---
[Visit Topic](https://discuss.tvm.apache.org/t/mini-rfc-name-mangling-in-aot/9907/9) to respond.

You are receiving this because you enabled mailing list mode.

To unsubscribe from these emails, [click here](https://discuss.tvm.apache.org/email/unsubscribe/95eda1633dc5d95326e90f215a951163bc873289b75a83e7d172f8041985a94b).