Uh oh!
There was an error while loading. Please reload this page.
[BACKEND][CODEGEN] C codegen with tests - #2161
Conversation
tqchen
commented
Nov 24, 2018
@Huyuwei can you help review this? |
Huyuwei
commented
Nov 24, 2018
@mutinifni Can you briefly describe the current compilation flow? Most importantly, is it using DSOModule for the runtime? |
mutinifni
commented
Nov 24, 2018
@Huyuwei It uses CSourceModule for saving the C source code - I have verified this by checking the type_key. Loading is done via the DSOModule. I was a bit uncertain about this module design and the export_library functionality as well, so please feel let me know if you think a different flow would be better instead. |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
| namespace codegen { | ||
| CodeGenCHost::CodeGenCHost() { | ||
| module_name = GetUniqueName("__tvm_module_ctx"); |
There was a problem hiding this comment.
replace "__tvm_module_ctx" with tvm::runtime::symbol::tvm_module_ctx?
There was a problem hiding this comment.
This would make the generated code necessarily dependent on C++, but we want to keep the option of pure C as well. If there's a reason to use the latter symbol, I can change it.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
tqchen
commented
Nov 27, 2018
@Huyuwei please take another look |
Uh oh!
There was an error while loading. Please reload this page.
srkreddy1238
commented
Nov 29, 2018
This PR cause the below issue with llvm target. python3 tutorials/get_started.py |
tqchen
commented
Nov 29, 2018
Thanks @srkreddy1238 for reporting this, @mutinifni can you send in a quick fix? We should not directly raise error when the headers are not found in general create_shared, instead, we should only call find_include_path and add it to the options in created_shared when it is a c module |
* Implement C code generation with tests * Code cleanup * Implement C code generation with tests * Code cleanup * tabs to spaces * make lint compliant * update export_library and reserve unique C keywords * move ReserveKeywordsAsUnique to codegen_c * some documentation and code cleanup * use tvm.contrib.util for tempdir in testcases
* Implement C code generation with tests * Code cleanup * Implement C code generation with tests * Code cleanup * tabs to spaces * make lint compliant * update export_library and reserve unique C keywords * move ReserveKeywordsAsUnique to codegen_c * some documentation and code cleanup * use tvm.contrib.util for tempdir in testcases
* Implement C code generation with tests * Code cleanup * Implement C code generation with tests * Code cleanup * tabs to spaces * make lint compliant * update export_library and reserve unique C keywords * move ReserveKeywordsAsUnique to codegen_c * some documentation and code cleanup * use tvm.contrib.util for tempdir in testcases
dongxiao92
commented
Apr 29, 2019
Hello, is there any documents or examples about how to use this c backend? |
Hi @dongxiao92, you can look at |
wujiaqi6630
commented
Sep 9, 2019
Hello, I want to generate C code too:
But failed: |
mutinifni
commented
Sep 9, 2019
Hi @wujiaqi6630, if you want to see the C source code that is generated, you can use |
wujiaqi6630
commented
Sep 10, 2019
Thank you ! |
Jie-KUN
commented
Nov 26, 2021
Hi@Mutinifni, I use the func.get_source(), but the code printed on the screen seems not to run on the X86 platform. How can I execute the C code. Looking forward to your reply |
NiteshNarayana
commented
Dec 7, 2021
Hi Any update on how to execute the generated C source code? I observe that when you generate the c source code for a module that is generated through a user-defined relay function you get a Thanks in advance! |
shreyashvi
commented
Feb 3, 2023
Hey, did you find out a way how to compile that generated c code? Thanks |
This PR introduces a gcc / g++ compatible C code generator for TVM, tested on x86 host.