For a custom operator I am currently implementing I generate C-code following 
the BYOC approach. As I have to include 3rd party C++ header files containing 
namespaces etc. I have not really found a way to compile my kernels (In my case 
`src/lib2.c`) without changing the file extension to `.cc` or `.cpp`.

Also it would be great to use C++ features in the kernel Implementations as 
well. Is this currently not supported (maybe due to the overhead this would 
have for embedded deployment) or have I overlooked anything?

My implementations should be mainly deployed in an uTVM environment I am 
exporting the output files for the target device using either of these 
approaches:

1. following the (default) uTVM Flow using `tvm.micro.build_static_runtime()`)
2. Using the Model Library Format (`tvm.micro.export_model_format()`) from uTVM 
(and compile externally)

However I think my concern is not uTVM specific.

My Quick fix to generate `lib*.cc` files instead of `lib*.c` files without 
needing to rename them manually after the export is based on hardcoding the 
file extension in `python/tvm/micro/model_library_format.py` (for (2)) and 
`python/tvm/runtime/module.py` (for (1)).

Now I would like to find something more robust to contribute it to the TVM 
codebase but I am not sure on how to integrate it in a meaningful way. My main 
two question are:

* How to tell TVM that C++ files need to be generated instead of using the 
default .c file extension. This maybe passed in as an optional argument by the 
user (for all `CSourceModules` that are going to be build together) or 
internally on a per-module basis (f.e. in by BYOC code)
* Can I reuse the available `CSourceModule` and stick with the type_key `"c"` 
for C++ as well by just changing the filename extension or should I add another 
type key like `"cc"`/`"cpp"` with an separate `SourceModuleNode`.

I would appreciate a lot if someone could give me a hint on wether I have 
misunderstood anything and if my proposal sounds like an improvement to the TVM 
ecosystem, feel free to discuss my questions on the possible implementations as 
well.





---
[Visit 
Topic](https://discuss.tvm.apache.org/t/exporting-sources-for-c-only-operator-kernel-implementations/10062/1)
 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/9707679303796f2f4dde19d8487ad572d0ebb4d26105f0da7375b4ed01be6f30).

Reply via email to